Closed wRAR closed 1 month ago
From the pytest's changelog:
8645: pytest.warns(None) is now deprecated because many people used it to mean “this code does not emit warnings”, but it actually had the effect of checking that the code emits at least one warning of any type - like pytest.warns() or pytest.warns(Warning).
And this is the code we are talking about:
In our testing environment with pytest 8.1.1 and urllib3 < 2.0 removing the None from pytest.warns
fixes the problem.
I'm not sure why the last comment by @kloczek has been removed but PR with the simple fix is ready.
Not sure what was this code supposed to mean (making sure that there are no warnings? I don't think it ever did that?), but on pytest 8 it no longer works: "TypeError: exceptions must be derived from Warning, not <class 'NoneType'>"
https://docs.pytest.org/en/latest/how-to/capture-warnings.html#additional-use-cases-of-warnings-in-tests