Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34k
gh-128770: raise warnings as errors in test suite - except for test_socket which still logs warnings, and internal test warnings that are now logged#128973
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
Uh oh!
There was an error while loading. Please reload this page.
Merged
Changes from all commits
Commits
Show all changes
54 commits Select commit Hold shift + click to select a range
a6bb15e Reapply "gh-128770: raise warnings as errors in test suite - except f…
graingert baab6a3 convert internal test warnings into logger calls
graingert c933487 Apply suggestions from code review
graingert 9e532fa test that support logs instead of warns
graingert c06c3db Merge branch 'main' into warnings-as-error-2
graingert ba36dc0 Merge branch 'main' into warnings-as-error-2
graingert 7123093 Merge branch 'main' into warnings-as-error-2
graingert 33c84e6 Merge branch 'main' into warnings-as-error-2
graingert 104f427 Update test_hashlib.py
graingert 1b44669 Merge branch 'main' into warnings-as-error-2
graingert 36bba4e Merge branch 'main' into warnings-as-error-2
graingert b5fc0df sort logging import
graingert 6bdaad4 Update Lib/test/test_support.py
graingert 3473aab Update Lib/test/test_support.py
graingert b49e3f9 Update Lib/test/test_support.py
graingert b92cbec Update Lib/test/test_support.py
graingert fbb99a3 Apply suggestions from code review
graingert f6909e8 move logging into alphabetical position
graingert 3b895f2 do the hanging indent
graingert 8e17c8a use indexing rather than unpacking one item
graingert 7ecc3b0 Merge branch 'main' into warnings-as-error-2
graingert 9af76bd Merge branch 'main' into warnings-as-error-2
graingert 8250358 Merge branch 'main' into warnings-as-error-2
graingert b1334ea Merge branch 'main' into warnings-as-error-2
graingert 94fd5b7 Merge branch 'main' into warnings-as-error-2
graingert 1af4d6f prevent SyntaxError/SyntaxWarning in test_fstring
graingert 122f70d Merge branch 'main' into warnings-as-error-2
graingert b44e834 Merge branch 'main' into warnings-as-error-2
graingert 2f29d80 fix SyntaxWarning in test_join_windows.py
graingert 19dc865 fix 'sys.path_hooks is empty' warning in test_permission_error_cwd
graingert 12b6c64 fix meta invalid escape in test_invalid_escape_locations_with_offset
graingert f8e4f56 fix test_string_literals SyntaxWarning
graingert b9ecf97 exclude test_grammar.py from test_write_filtered_python_package
graingert c5e77ba Merge branch 'main' into warnings-as-error-2
graingert 0305cfe fix ResourceWarning when writing a unwritable gzipfile
graingert 6dab428 fix ResourceWarnings in test_asyncio.test_events
graingert 6e83d44 prevent another ResourceWarning in GzipFile due to an unclosed myfileobj
graingert aa35271 extract UNDERSCORE_LITERALS from test_grammar
graingert 6c918b3 pre-commit
graingert 19e6a20 Merge branch 'main' into warnings-as-error-2
graingert 5eae8f4 Merge branch 'main' into warnings-as-error-2
graingert 37900e1 Merge branch 'main' into warnings-as-error-2
graingert eb01d6b Merge branch 'main' into warnings-as-error-2
graingert 3d68f6e mimimize LogCaptureHandler, and reduce pytest citation
graingert 9b438a5 Merge branch 'main' into warnings-as-error-2
graingert 774dd98 Discard changes to Lib/test/test_zipfile/test_core.py
graingert d1ae6a6 Merge branch 'main' into warnings-as-error-2
graingert 9f92698 Merge branch 'main' into warnings-as-error-2
graingert 78ffa2a gh-131707: fix unawaited coroutine warning in test_coroutines.Corouti…
graingert 009a6a0 Merge branch 'main' into warnings-as-error-2
graingert 4586652 Merge branch 'main' into warnings-as-error-2
graingert e0479be Merge branch 'main' into warnings-as-error-2
graingert a656a68 Merge branch 'main' into warnings-as-error-2
graingert f27d4a7 Merge branch 'main' into warnings-as-error-2
graingert File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| # These are shared with test_tokenize and other test modules. | ||
| # | ||
| # Note: since several test cases filter out floats by looking for "e" and ".", | ||
| # don't add hexadecimal literals that contain "e" or "E". | ||
| VALID_UNDERSCORE_LITERALS = [ | ||
| '0_0_0', | ||
| '4_2', | ||
| '1_0000_0000', | ||
| '0b1001_0100', | ||
| '0xffff_ffff', | ||
| '0o5_7_7', | ||
| '1_00_00.5', | ||
| '1_00_00.5e5', | ||
| '1_00_00e5_1', | ||
| '1e1_0', | ||
| '.1_4', | ||
| '.1_4e1', | ||
| '0b_0', | ||
| '0x_f', | ||
| '0o_5', | ||
| '1_00_00j', | ||
| '1_00_00.5j', | ||
| '1_00_00e5_1j', | ||
| '.1_4j', | ||
| '(1_2.5+3_3j)', | ||
| '(.5_6j)', | ||
| ] | ||
| INVALID_UNDERSCORE_LITERALS = [ | ||
| # Trailing underscores: | ||
| '0_', | ||
| '42_', | ||
| '1.4j_', | ||
| '0x_', | ||
| '0b1_', | ||
| '0xf_', | ||
| '0o5_', | ||
| '0 if 1_Else 1', | ||
| # Underscores in the base selector: | ||
| '0_b0', | ||
| '0_xf', | ||
| '0_o5', | ||
| # Old-style octal, still disallowed: | ||
| '0_7', | ||
| '09_99', | ||
| # Multiple consecutive underscores: | ||
| '4_______2', | ||
| '0.1__4', | ||
| '0.1__4j', | ||
| '0b1001__0100', | ||
| '0xffff__ffff', | ||
| '0x___', | ||
| '0o5__77', | ||
| '1e1__0', | ||
| '1e1__0j', | ||
| # Underscore right before a dot: | ||
| '1_.4', | ||
| '1_.4j', | ||
| # Underscore right after a dot: | ||
| '1._4', | ||
| '1._4j', | ||
| '._5', | ||
| '._5j', | ||
| # Underscore right after a sign: | ||
| '1.0e+_1', | ||
| '1.0e+_1j', | ||
| # Underscore right before j: | ||
| '1.4_j', | ||
| '1.4e5_j', | ||
| # Underscore right before e: | ||
| '1_e1', | ||
| '1.4_e1', | ||
| '1.4_e1j', | ||
| # Underscore right after e: | ||
| '1e_1', | ||
| '1.4e_1', | ||
| '1.4e_1j', | ||
| # Complex cases with parens: | ||
| '(1+1.5_j_)', | ||
| '(1+1.5_j)', | ||
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,7 @@ | ||
| import collections.abc | ||
| import contextlib | ||
| import errno | ||
| import logging | ||
| import os | ||
| import re | ||
| import stat | ||
| @@ -405,8 +406,12 @@ def _waitfor(func, pathname, waitall=False): | ||
| # Increase the timeout and try again | ||
| time.sleep(timeout) | ||
| timeout *= 2 | ||
| warnings.warn('tests may fail, delete still pending for ' + pathname, | ||
| RuntimeWarning, stacklevel=4) | ||
| logging.getLogger(__name__).warning( | ||
| 'tests may fail, delete still pending for %s', | ||
| pathname, | ||
| stack_info=True, | ||
| stacklevel=4, | ||
| ) | ||
| def _unlink(filename): | ||
| _waitfor(os.unlink, filename) | ||
| @@ -521,9 +526,14 @@ def temp_dir(path=None, quiet=False): | ||
| except OSError as exc: | ||
| if not quiet: | ||
| raise | ||
| warnings.warn(f'tests may fail, unable to create ' | ||
| f'temporary directory{path!r}:{exc}', | ||
| RuntimeWarning, stacklevel=3) | ||
| logging.getLogger(__name__).warning( | ||
| "tests may fail, unable to create temporary directory %r: %s", | ||
| path, | ||
| exc, | ||
| exc_info=exc, | ||
| stack_info=True, | ||
| stacklevel=3, | ||
| ) | ||
| if dir_created: | ||
| pid = os.getpid() | ||
| try: | ||
| @@ -554,9 +564,15 @@ def change_cwd(path, quiet=False): | ||
| except OSError as exc: | ||
| if not quiet: | ||
| raise | ||
| warnings.warn(f'tests may fail, unable to change the current working ' | ||
| f'directory to{path!r}:{exc}', | ||
| RuntimeWarning, stacklevel=3) | ||
| logging.getLogger(__name__).warning( | ||
| 'tests may fail, unable to change the current working directory ' | ||
| 'to %r: %s', | ||
| path, | ||
| exc, | ||
| exc_info=exc, | ||
graingert marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading. Please reload this page. | ||
| stack_info=True, | ||
| stacklevel=3, | ||
| ) | ||
| try: | ||
| yield os.getcwd() | ||
| finally: | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Oops, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Oops, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.