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

@graingert graingert added the type-feature A feature request or enhancement label Jan 13, 2025
@erlend-aasland erlend-aasland added the tests Tests in the Lib/test dir label Jan 13, 2025
@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?

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