pythonpytest

Pytest: Only run linter checks (pytest-flake8), don't run tests


I'm using the pytest-flake8 plugin to lint my Python code. Everytime I run the linting like this:

pytest --flake8

In addition to the linting, all tests are run. But I would like to run the linter checks only.

How can I configure pytest so it only lints the code but skips all my tests, preferrably via commandline (or conftest.py) - without having to add skip markers to my tests?


Solution

  • flake8 tests are marked with the flake8 marker, so you can select only those by running:

    pytest --flake8 -m flake8