[prerelease] pytest.warns() doesn't seem to work properly for coverage.py
See original GitHub issueFrom @nedbat via Twitter:
This message could be better, because removing None doesn’t work now:
PytestRemovedIn8Warning: Passing None to catch any warning has been deprecated, pass no arguments instead: Replace pytest.warns(None) by simply pytest.warns().
When I remove None and run with pytest 7, I get failures:
No idea off-hand what’s going on there, as that seems exactly what we did in #8677 too.
Issue Analytics
- State:
- Created 2 years ago
- Comments:10 (10 by maintainers)
Top Results From Across the Web
Improve pytest.warns() docs to clarify difference with ...
Zac-HD mentioned this issue on Dec 7, 2021. [prerelease] pytest.warns() doesn't seem to work properly for coverage.py #9386.
Read more >Release 7.0.0b1 unknown
Coverage.py is a tool for measuring code coverage of Python programs. It monitors your program, noting which parts.
Read more >How to capture warnings
This test will fail if myfunction does not issue a deprecation warning when called with a 17 argument. Asserting warnings with the warns...
Read more >py.test gives Coverage.py warning: Module sample.py was ...
Anyone has an idea why coverage.py does not work? hence, if I run coverage run -m py.test test.py separately, it does not show...
Read more >pytest Documentation
pytest will run all files of the form test_*.py or *_test.py in the ... Note: Calling pytest.main() will result in importing your tests...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I see! I was definitely misunderstanding it then. If a new context manager isn’t available in 7.0, I can write one of my own for my test suite. Thanks.
Ah, makes sense! I guess in @nedbat’s scenario indeed the warning is “optional”. So I suppose we can close this one as a duplicate then?