[Python] AttributeError: module 'builtins' has no attribute 'RemovedIn20Warning'

Discussão em 'Python' iniciado por Stack, Março 5, 2025.

  1. Stack

    Stack Membro Participativo

    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

    Continue reading...

Compartilhe esta Página