pytest-dev / pytest-dev/pytest

Review ignored warnings in selftests

Open
#8,556 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

type: selftests
Dominant language
Python
Stars
14.5k
Forks
3.4k
Avg merge
2d 9h
Merged PRs (30d)
35

Description

filterwarnings = [
    "error",
    "default:Using or importing the ABCs:DeprecationWarning:unittest2.*",
    # produced by older pyparsing<=2.2.0.
    "default:Using or importing the ABCs:DeprecationWarning:pyparsing.*",
    "default:the imp module is deprecated in favour of importlib:DeprecationWarning:nose.*",
    # distutils is deprecated in 3.10, scheduled for removal in 3.12
    "ignore:The distutils package is deprecated:DeprecationWarning",
    # produced by python3.6/site.py itself (3.6.7 on Travis, could not trigger it with 3.6.8)."
    "ignore:.*U.*mode is deprecated:DeprecationWarning:(?!(pytest|_pytest))",
    # produced by pytest-xdist
    "ignore:.*type argument to addoption.*:DeprecationWarning",
    # produced on execnet (pytest-xdist)
    "ignore:.*inspect.getargspec.*deprecated, use inspect.signature.*:DeprecationWarning",
    # pytest's own futurewarnings
    "ignore::pytest.PytestExperimentalApiWarning",
    # Do not cause SyntaxError for invalid escape sequences in py37.
    # Those are caught/handled by pyupgrade, and not easy to filter with the
    # module being the filename (with .py removed).
    "default:invalid escape sequence:DeprecationWarning",
    # ignore use of unregistered marks, because we use many to test the implementation
    "ignore::_pytest.warning_types.PytestUnknownMarkWarning",
    # https://github.com/benjaminp/six/issues/341
    "ignore:_SixMetaPathImporter\\.exec_module\\(\\) not found; falling back to load_module\\(\\):ImportWarning",
    # https://github.com/benjaminp/six/pull/352 
    "ignore:_SixMetaPathImporter\\.find_spec\\(\\) not found; falling back to find_module\\(\\):ImportWarning",
    # https://github.com/pypa/setuptools/pull/2517
    "ignore:VendorImporter\\.find_spec\\(\\) not found; falling back to find_module\\(\\):ImportWarning",
]

That seems like a lot, and most of those don't actually have a filter for the module. It seems to me like this would potentially hide Python deprecation warnings in pytest itself. We should probably review those and either remove them, or add a module filter too.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the TOML selftest warning-filter configuration shown in this issue and run the selftests to identify which warnings each entry suppresses. Review every broad filter, removing entries that are no longer needed or adding a module filter where appropriate; done means pytest warnings are not hidden unintentionally.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.