Skip to content
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

Open
graingert opened this issue Jan 13, 2025 · 3 comments
Open

configure warnings as errors in the test suite #128770

graingert opened this issue Jan 13, 2025 · 3 comments
Labels
tests Tests in the Lib/test dir type-feature A feature request or enhancement

Comments

@graingert
Copy link
Contributor

graingert commented Jan 13, 2025

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

@sobolevn
Copy link
Member

See #110012 test_socket raises warnings right now.

@graingert
Copy link
Contributor Author

See #128816 test_doctest also has a warning

@graingert
Copy link
Contributor Author

See #110012 test_socket raises warnings right now.

I'm thinking we mark these as default with catch_warnings in the test for now?

hugovk pushed a commit that referenced this issue Jan 17, 2025
…ocket which still logs warnings (#128726)

Co-authored-by: sobolevn <mail@sobolevn.me>
Co-authored-by: Brett Cannon <brett@python.org>
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Jan 17, 2025
…test_socket which still logs warnings (pythonGH-128726)

(cherry picked from commit 7807b40)

Co-authored-by: Thomas Grainger <tagrain@gmail.com>
Co-authored-by: sobolevn <mail@sobolevn.me>
Co-authored-by: Brett Cannon <brett@python.org>
hugovk added a commit to hugovk/cpython that referenced this issue Jan 17, 2025
…ept for test_socket which still logs warnings (python#128726)"

This reverts commit 7807b40.
hugovk added a commit that referenced this issue Jan 17, 2025
graingert added a commit to graingert/cpython that referenced this issue Jan 18, 2025
…cept for test_socket which still logs warnings (python#128726)" (python#128936)

This reverts commit 76856ae.
srinivasreddy pushed a commit to srinivasreddy/cpython that referenced this issue Jan 21, 2025
…test_socket which still logs warnings (python#128726)

Co-authored-by: sobolevn <mail@sobolevn.me>
Co-authored-by: Brett Cannon <brett@python.org>
srinivasreddy pushed a commit to srinivasreddy/cpython that referenced this issue Jan 21, 2025
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Jan 22, 2025
(cherry picked from commit 24c84d8)

Co-authored-by: Thomas Grainger <tagrain@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tests Tests in the Lib/test dir type-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

3 participants