diff --git a/pytest_flake8.py b/pytest_flake8.py index 80d5b0a..1e45d8f 100644 --- a/pytest_flake8.py +++ b/pytest_flake8.py @@ -145,6 +145,9 @@ def reportinfo(self): ignores = "" return (self.fspath, -1, "FLAKE8-check%s" % ignores) + def collect(self): + return iter((self,)) + class Ignorer: def __init__(self, ignorelines, coderex=re.compile(r"[EW]\d\d\d")): diff --git a/test_flake8.py b/test_flake8.py index 96bba79..0bc2461 100644 --- a/test_flake8.py +++ b/test_flake8.py @@ -153,6 +153,12 @@ def test_hello(): result.assert_outcomes(failed=1) +def test_run_on_init_file(testdir): + d = testdir.mkpydir("tests") + result = testdir.runpytest("--flake8", d / "__init__.py") + result.assert_outcomes(passed=1) + + @pytest.mark.xfail("sys.platform == 'win32'") def test_unicode_error(testdir): x = testdir.tmpdir.join("x.py")