-
-
Notifications
You must be signed in to change notification settings - Fork 31.5k
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
configure warnings as errors in the test suite #128770
Comments
See #110012 |
See #128816 test_doctest also has a warning |
I'm thinking we mark these as |
…ocket which still logs warnings (#128726) Co-authored-by: sobolevn <[email protected]> Co-authored-by: Brett Cannon <[email protected]>
…test_socket which still logs warnings (pythonGH-128726) (cherry picked from commit 7807b40) Co-authored-by: Thomas Grainger <[email protected]> Co-authored-by: sobolevn <[email protected]> Co-authored-by: Brett Cannon <[email protected]>
…ept for test_socket which still logs warnings (python#128726)" This reverts commit 7807b40.
…cept for test_socket which still logs warnings (python#128726)" (python#128936) This reverts commit 76856ae.
…test_socket which still logs warnings (python#128726) Co-authored-by: sobolevn <[email protected]> Co-authored-by: Brett Cannon <[email protected]>
…ept for test_socket which still logs warnings (python#128726)" (python#128936)
(cherry picked from commit 24c84d8) Co-authored-by: Thomas Grainger <[email protected]>
…ocket which still logs warnings, and internal test warnings that are now logged (#128973) Co-authored-by: Bénédikt Tran <[email protected]>
…test_socket which still logs warnings, and internal test warnings that are now logged (python#128973) Co-authored-by: Bénédikt Tran <[email protected]> (cherry picked from commit 8a00c9a)
… test_socket which still logs warnings, and internal test warnings that are now logged (#131802) Co-authored-by: Bénédikt Tran <[email protected]> (cherry picked from commit 8a00c9a)
…test_socket which still logs warnings, and internal test warnings that are now logged (python#128973) Co-authored-by: Bénédikt Tran <[email protected]>
Hi, after this change (specifically #131802), I am seeing the following errors when running ======================================================================
ERROR: test_with_stmt_with_paren (test.test_peg_generator.test_c_parser.TestCParser.test_with_stmt_with_paren)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/build/Python-3.13.3/Lib/test/test_peg_generator/test_c_parser.py", line 113, in setUp
cmd = support.missing_compiler_executable()
File "/build/Python-3.13.3/Lib/test/support/__init__.py", line 1916, in missing_compiler_executable
if spawn.find_executable(cmd[0]) is None:
~~~~~~~~~~~~~~~~~~~~~^^^^^^^^
File "/usr/lib/python3.13/vendor-packages/setuptools/_distutils/spawn.py", line 87, in find_executable
warnings.warn(
~~~~~~~~~~~~~^
'Use shutil.which instead of find_executable', DeprecationWarning, stacklevel=2
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
DeprecationWarning: Use shutil.which instead of find_executable I tried replacing ======================================================================
ERROR: test_with_stmt_with_paren (test.test_peg_generator.test_c_parser.TestCParser.test_with_stmt_with_paren)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/build/Python-3.13.3/Lib/test/test_peg_generator/test_c_parser.py", line 395, in test_with_stmt_with_paren
self.run_test(grammar_source, test_source)
~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/build/Python-3.13.3/Lib/test/test_peg_generator/test_c_parser.py", line 134, in run_test
self.build_extension(grammar_source)
~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
File "/build/Python-3.13.3/Lib/test/test_peg_generator/test_c_parser.py", line 131, in build_extension
generate_parser_c_extension(grammar, Path('.'), library_dir=self.library_dir)
~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/build/Python-3.13.3/Tools/peg_generator/pegen/testutil.py", line 107, in generate_parser_c_extension
compile_c_extension(
~~~~~~~~~~~~~~~~~~~^
str(source),
^^^^^^^^^^^^
...<3 lines>...
library_dir=library_dir,
^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/build/Python-3.13.3/Tools/peg_generator/pegen/build.py", line 98, in compile_c_extension
from setuptools._distutils.dep_util import newer_group
File "/usr/lib/python3.13/vendor-packages/setuptools/_distutils/dep_util.py", line 9, in __getattr__
warnings.warn(
~~~~~~~~~~~~~^
"dep_util is Deprecated. Use functions from setuptools instead.",
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
DeprecationWarning,
^^^^^^^^^^^^^^^^^^^
stacklevel=2,
^^^^^^^^^^^^^
)
^
DeprecationWarning: dep_util is Deprecated. Use functions from setuptools instead. This is with 3.13 only, which makes sense as that is the only one which we have setuptools for also installed. I wonder what is different about my setup considering that nobody else reported this? |
This is needed because unit tests are now run with "-W error" on the command line in CI (pythonGH-128770). We want to start with an empty list of filters to avoid supurious errors.
Feature or enhancement
Proposal:
It's very easy (especially when deprecating something) to introduce a lot of noisy test output with new warnings, eg: #127949 (comment)
I think it would be useful to either configure warnings as errors in the test suite (and then capture unraisable/threadexcept errors using a mechanism like pytest has) or tee any warnings produced, and fail CI if any have been produced that were not captured with catch_warnings or assertWarns etc like https://pypi.org/project/pytest-max-warnings/
Has this already been discussed elsewhere?
I have already discussed this feature proposal on Discourse
Links to previous discussion of this feature:
https://discuss.python.org/t/its-too-easy-to-introduce-noise-in-cpythons-test-suite-output-resourcewarnings-and-deprecationwarnings/75234
Linked PRs
The text was updated successfully, but these errors were encountered: