flake8-pytest-style icon indicating copy to clipboard operation
flake8-pytest-style copied to clipboard

Set of rules to lint `pytest.ini`

Open webknjaz opened this issue 5 years ago • 1 comments

Rule request

Description

On the wave of deprecation rules, here's another idea. The linter could check if the config is following the best practices:

  1. xfail_strict = True (per https://pganssle-talks.github.io/xfail-lightning/)
  2. junit_family = xunit2 (makes pytest's warnings go away)
  3. addopts args on separate lines (makes it easier to annotate the purpose with comments, ref https://github.com/ansible/pylibssh/blob/a2453ed/pytest.ini#L2-L16)
  4. filterwarnings should have error on the first line (rest of the lines could be legit temporary ignores)
  5. -ra in addopts
  6. --durations in addopts
  7. minversion should be set
  8. testpaths or pyargs should be specified
  9. norecursedirs present

Rationale

The default pytest config is not strict enough.

webknjaz avatar Apr 22 '20 19:04 webknjaz

NB: since pytest 6.0.0, the options can also reside in pyproject.toml. Docs

m-burst avatar Jul 30 '20 06:07 m-burst