Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: fix broken tests for versioned_branches feature #533

Merged

Conversation

neutrinoceros
Copy link
Contributor

Followup to #530, thanks to a comment from @graingert

Actually the bug now fails, revealing a bug in #530 ? I'll try to fix this promptly

@neutrinoceros neutrinoceros marked this pull request as ready for review September 13, 2021 19:32
@neutrinoceros
Copy link
Contributor Author

@asottile !

yield ast_to_offset(node), _fix_py3_block
else:
# don't try to fix, e.g., >= (3, 6) if there's no else clause
yield ast_to_offset(node), lambda i, tokens: None
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we shouldn't put noop callbacks into the callback machinery -- I think the original logic was fine here (?)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually the result with the original logic for that one broken test is

import sys
if True:
-    if sys.version_info >= (3, 6):
-        pass
+   pass

so that sounds about right to me, I guess this test was misplaced and shouldn't have been in the "noop" zone at all ?
I'll push to revert this.

'import sys'
'if True'
'import sys\n'
'if True\n'
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh yeah this'll need a : too

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch

'if sys.version_info >= (3, 6):\n'
' pass'
)
expected = 'import sys\n'
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I expect import sys\npass\n -- and my checkout of pyupgrade correctly makes that happen (?)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you're right, sorry, it's getting late in 🇫🇷

Copy link
Owner

@asottile asottile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@neutrinoceros neutrinoceros changed the title BUG: fix broken tests (missing newlines) BUG: fix broken tests for versioned_branches feature Sep 13, 2021
@neutrinoceros
Copy link
Contributor Author

wait don't merge I can add an id to the test

@asottile asottile merged commit cb501c4 into asottile:master Sep 13, 2021
@neutrinoceros neutrinoceros deleted the fixup_versioned_branches_tests branch September 13, 2021 20:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants