Skip to content

epytest overrides filterwarnings ignore? #16

@cjmayo

Description

@cjmayo

https://github.com/projg2/python-guide/blob/22ad9a6764b13a5a5565879c363ff6d140a9bb6f/pytest.rst?plain=1#L415-L420

As far as I can tell, -Wdefault, as used by epytest(), causes pytest to override ignore in setup.cfg.

With dev-lang/python-3.12.6 and dev-python/pytest-8.3.2:

$ pytest
...
test_example.py .                                                                                                                [100%]

========================================================== 1 passed in 0.01s ===========================================================
$ pytest -Wdefault
...
test_example.py .                                                                                                                [100%]

=========================================================== warnings summary ===========================================================
test_example.py:1
  test_example.py:1: DeprecationWarning: 'crypt' is deprecated and slated for removal in Python 3.13
    import crypt

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
===================================================== 1 passed, 1 warning in 0.01s =====================================================
ch

test_example.py

import crypt

def test_one():
    pass

setup.cfg

[tool:pytest]
filterwarnings =
	error
	ignore::DeprecationWarning

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions