-
-
Notifications
You must be signed in to change notification settings - Fork 30k
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
gh-111031: Check more files in test_tokenize
#111032
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By default, this test only tests a random sample of ten test files:
cpython/Lib/test/test_tokenize.py
Lines 1917 to 1918 in baefbb2
if not support.is_resource_enabled("cpu"): | |
testfiles = random.sample(testfiles, 10) |
You have to pass -ucpu
to run the test on all test files. If I run python -m test test_tokenize -ucpu
with your PR branch, the test fails:
======================================================================
ERROR: test_random_files (test.test_tokenize.TestRoundtrip.test_random_files) (file='C:\\Users\\alexw\\coding\\cpython\\Lib\\test\\test_fstring.py')
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Users\alexw\coding\cpython\Lib\test\test_tokenize.py", line 1915, in test_random_files
self.check_roundtrip(f)
File "C:\Users\alexw\coding\cpython\Lib\test\test_tokenize.py", line 1812, in check_roundtrip
tokens2_from2 = [tok[:2] for tok in tokenize.tokenize(readline2)]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\alexw\coding\cpython\Lib\tokenize.py", line 445, in tokenize
yield from _generate_tokens_from_c_tokenizer(rl_gen.__next__, encoding, extra_tokens=True)
File "C:\Users\alexw\coding\cpython\Lib\tokenize.py", line 541, in _generate_tokens_from_c_tokenizer
raise TokenError(msg, (e.lineno, e.offset)) from None
tokenize.TokenError: ('unterminated string literal (detected at line 708)', (708, 40))
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
Hm, indeed. Let's convert this PR to remove other stuff (I planned to create 2 PRs anyway for this).
5f6fa82#diff-b07c4f10c75a22e102f114227a0a9b7b763ddda7a330109994e69b29540ea9bbL583-L586
Before:
After (+1 sec):
|
test_fstring.py
in test_tokenize
test_tokenize
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, this is now correct. We still cannot untokenize test_fstring.py
yet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one buildbot failure, and test_tokenize passed on that buildbot. Thanks!
Thanks @sobolevn for the PR, and @AlexWaygood for merging it 🌮🎉.. I'm working now to backport this PR to: 3.12. |
(cherry picked from commit e9b5399) Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
GH-111061 is a backport of this pull request to the 3.12 branch. |
I'll defer to Pablo and Lys, but I feel we probably shouldn't backport this to 3.11, since the |
Yup, 3.12 should be fine, but not 3.11. |
test_tokenize
needs an update #111031