Pytest:仅运行 linter 检查(pytest-flake8),不运行测试

Ing*_*her 6 python pytest

我正在使用pytest-flake8插件来检查我的 Python 代码。每次我这样运行 linting 时:

pytest --flake8
Run Code Online (Sandbox Code Playgroud)

除了 linting 之外,还运行所有测试。但我只想运行 linter 检查。

我如何配置 pytest 以便它只检查代码但跳过所有测试,最好通过命令行(或conftest.py) - 而不必向我的测试添加跳过标记

ban*_*ela 5

flake8 测试标有标记flake8,因此您可以通过运行以下命令仅选择这些测试:

pytest --flake8 -m flake8