Skip to content

BUG: fix broken tests for versioned_branches feature#533

Merged
asottile merged 1 commit intoasottile:masterfrom
neutrinoceros:fixup_versioned_branches_tests
Sep 13, 2021
Merged

BUG: fix broken tests for versioned_branches feature#533
asottile merged 1 commit intoasottile:masterfrom
neutrinoceros:fixup_versioned_branches_tests

Conversation

@neutrinoceros
Copy link
Copy Markdown
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 force-pushed the fixup_versioned_branches_tests branch from c213c31 to 59ba7b8 Compare September 13, 2021 19:29
@neutrinoceros neutrinoceros marked this pull request as ready for review September 13, 2021 19:32
@neutrinoceros
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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 🇫🇷

@neutrinoceros neutrinoceros force-pushed the fixup_versioned_branches_tests branch from c3d71b9 to 1e9a2fd Compare September 13, 2021 20:03
Copy link
Copy Markdown
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
Copy Markdown
Contributor Author

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

@neutrinoceros neutrinoceros force-pushed the fixup_versioned_branches_tests branch from 1e9a2fd to 9adb0c6 Compare September 13, 2021 20:07
@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.

2 participants