AttributeError: module 'builtins' has no attribute 'RemovedIn20Warning'

57 Views Asked by At

I am trying to run tests and setting certain types of warnings as errors. No matter which warning I set to be treated in pytest.ini I get same exception, just the type changes. What do I need to do to get passed this exception?

ERROR: while parsing the following warning configuration:

  error::RemovedIn20Warning

This error occurred:

Traceback (most recent call last):
  File "/Users/edv/Library/Caches/pypoetry/virtualenvs/api-gX2kb1zU-py3.11/lib/python3.11/site-packages/_pytest/config/__init__.py", line 1761, in parse_warning_filter
    category: Type[Warning] = _resolve_warning_category(category_)
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/edv/Library/Caches/pypoetry/virtualenvs/api-gX2kb1zU-py3.11/lib/python3.11/site-packages/_pytest/config/__init__.py", line 1800, in _resolve_warning_category
    cat = getattr(m, klass)
          ^^^^^^^^^^^^^^^^^
AttributeError: module 'builtins' has no attribute 'RemovedIn20Warning'

pytest.ini

[pytest]
filterwarnings =
    always::DeprecationWarning
    #ignore::pytest.PytestAssertRewriteWarning
    #ignore::pluggy.PluggyTeardownRaisedWarning
    #ignore::PytestUnknownMarkWarning
    #ignore::PydanticDeprecatedSince20
    #ignore::PytestAssertRewriteWarning
    ignore:.*Setting backref.*
    error::RemovedIn20Warning
0

There are 0 best solutions below