1 | initial version |
You can cause pytest to generate an error upon encountering a warning by using the --strict
command-line option or adding strict = True
to your pytest.ini
file. This option causes pytest to fail any test that generates a warning.
For example, you can run pytest with the --strict
option like this:
pytest --strict
Or you can add strict = True
to your pytest.ini
file:
[pytest]
strict = True
This method ensures that any test that produces a warning also fails, helping you identify potential issues in your code.