I'd like pytest to ignore the RemovedInDjango20Warning.
I currently have this in pytest.ini
[pytest]
filterwarnings =
ignore:RemovedInDjango20Warning
And that allows pytest to run, but does not suppress the warnings.
If I add a second colon, I get a lot of "INTERNAL ERROR" messages.
If I add a third colon, the tests run, but do not suppress the warnings.
I am afraid to add a fourth colon :)
~
I've also tried being more specific about the error:
ignore:django.RemovedInDjango20Warning
and
ignore:django.utils.deprecation.RemovedInDjango20Warning
and while those run, I'm still warned every time.
The INTERNALERRORs that I get are:
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR> File "/home/chris/.pyenv/versions/3.6.10/lib/python3.6/warnings.py", line 246, in _getcategory
INTERNALERROR> cat = getattr(m, klass)
INTERNALERROR> AttributeError: module 'django' has no attribute 'RemovedInDjango20Warning'
INTERNALERROR>
INTERNALERROR> During handling of the above exception, another exception occurred:
INTERNALERROR>
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR> File "/home/chris/.virtualenvs/website-36/lib/python3.6/site-packages/_pytest/main.py", line 196, in wrap_session
INTERNALERROR> session.exitstatus = doit(config, session) or 0
[long traceback snipped]
INTERNALERROR> raise _OptionError("unknown warning category: %r" % (category,))
INTERNALERROR> warnings._OptionError: unknown warning category: 'django.RemovedInDjango20Warning'
While taking a second look based on @LaurentBristiel 's comments, I realized that I need two colons, PLUS the full path to the exception, so
[pytest]
filterwarnings =
ignore::django.utils.deprecation.RemovedInDjango20Warning
Thanks to all!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With