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

Check for `allow_module_level=True` in module-level `pytest.skip`

Open sobolevn opened this issue 3 years ago • 1 comments

Rule request

Description

Right now this is not detected as an error:

import pytest

pytest.skip('Ignore this module')

Rationale

This is also an error with pytest:

_____________ ERROR collecting tests/test_multiprocess_aioredis.py _____________
Using pytest.skip outside of a test will skip the entire module. If that's your intention, pass `allow_module_level=True`. If you want to skip a specific test or an entire class, use the @pytest.mark.skip or @pytest.mark.skipif decorators.

sobolevn avatar Jun 27 '22 08:06 sobolevn

Hi @sobolevn, I'm not sure that duplicating pytest's runtime checks on the linter level is the way to go. Linters and tests are typically run in the same CI pipeline, so the problem will be detected either way, and this duplication will only lead to extra work (both for me as the developer of the plugin and for the interpreter in runtime). What do you think?

m-burst avatar Jun 27 '22 08:06 m-burst