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?
flake8 tests are marked with the flake8
marker, so you can select only those by running:
pytest --flake8 -m flake8
Pytests --ignore <<path>>
option also works well here if all of your tests are in one directory.
I usually hide this behind a make command. In this case my Makefile
and tests
directory are both at the root of the repository.
.PHONY: lint
lint:
pytest --flake8 --ignore tests
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With