set the expected warning in pytest.warns()
Bad code:
import pytest
def test_foo():
with pytest.warns():
do_something()
Good code:
import pytest
def test_foo():
with pytest.warns(SomeWarning):
do_something()
- not passing the warning class will fail at runtime