-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Closed
Labels
type: docsdocumentation improvement, missing or needing clarificationdocumentation improvement, missing or needing clarificationtype: questiongeneral question, might be closed after 2 weeks of inactivitygeneral question, might be closed after 2 weeks of inactivity
Description
I expect that pytest.warns(None)
is an assertion that no warnings are raised.
import warnings
import pytest
def test_no_warning():
with pytest.warns(None):
warnings.warn("Look out!")
Running pytest on the above does not fail. I would expect a failure, something like "a warning was raised where no warning was expected".
$ pip list
Package Version
---------- -------------------
attrs 21.2.0
certifi 2020.12.5
iniconfig 1.1.1
packaging 20.9
pip 21.0.1
pluggy 0.13.1
py 1.10.0
pyparsing 2.4.7
pytest 6.2.4
setuptools 52.0.0.post20210125
toml 0.10.2
wheel 0.36.2
$ python --version
Python 3.9.4
OS: Ubuntu 18.04
Metadata
Metadata
Assignees
Labels
type: docsdocumentation improvement, missing or needing clarificationdocumentation improvement, missing or needing clarificationtype: questiongeneral question, might be closed after 2 weeks of inactivitygeneral question, might be closed after 2 weeks of inactivity