8000 gh-96276: suppress SyntaxWarning in test_compile by iritkatriel · Pull Request #96277 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-96276: suppress SyntaxWarning in test_compile #96277

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

Merged
merged 1 commit into from
Aug 25, 2022

Conversation

iritkatriel
Copy link
Member
@iritkatriel iritkatriel commented Aug 25, 2022

@@ -1231,7 +1232,9 @@ def f():
with self.subTest(body):
namespace = {}
source = textwrap.dedent(source_template.format(body))
exec(source, namespace)
with warnings.catch_warnings():
warnings.simplefilter('ignore', SyntaxWarning)
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there value in asserting that the warning is emitted rather than just ignoring it? (Or is that already tested by another test elsewhere?)

Copy link
Member Author

Choose a reason for hiding this comment

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

It's covered in test_grammar:

check('[[i for i in range(5)] (3, 4)]')

@iritkatriel iritkatriel merged commit 1e74361 into python:main Aug 25, 2022
@iritkatriel iritkatriel deleted the test_compile branch August 25, 2022 21:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.12 only security fixes skip news tests Tests in the Lib/test dir
Projects
None yet
Development

Successfully merging this pull request may close these issues.

test_compile emits a SyntaxWarning
3 participants
0