Skip to content

Commit 765d781

Browse files
committed
Move linting to pytest
1 parent 88a6a4e commit 765d781

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

mypy/test/testselfcheck.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
"""Self check mypy package"""
22

3+
import pytest # type: ignore # no pytest in typeshed
4+
from flake8.api import legacy as flake8
5+
36
from mypy.test.helpers import Suite, run_mypy
47

58

@@ -9,3 +12,11 @@ def test_mypy_package(self) -> None:
912

1013
def test_testrunner(self) -> None:
1114
run_mypy(['runtests.py', 'waiter.py'])
15+
16+
17+
class LintSuite(Suite):
18+
def test_flake8(self) -> None:
19+
style_guide = flake8.get_style_guide()
20+
report = style_guide.check_files('.')
21+
if report.total_errors != 0:
22+
pytest.fail('Lint error', pytrace=False)

runtests.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -94,14 +94,6 @@ def add_pytest(self, files: List[Tuple[str, str]], coverage: bool = True) -> Non
9494
passthrough=self.verbosity),
9595
sequential=True)
9696

97-
def add_flake8(self, cwd: Optional[str] = None) -> None:
98-
name = 'lint'
99-
if not self.allow(name):
100-
return
101-
largs = ['flake8', '-j0']
102-
env = self.env
103-
self.waiter.add(LazySubprocess(name, largs, cwd=cwd, env=env))
104-
10597
def list_tasks(self) -> None:
10698
for id, task in enumerate(self.waiter.queue):
10799
print('{id}:{task}'.format(id=id, task=task.name))
@@ -308,7 +300,6 @@ def main() -> None:
308300
driver.prepend_path('MYPYPATH', [driver.cwd])
309301
driver.prepend_path('PYTHONPATH', [driver.cwd])
310302

311-
driver.add_flake8()
312303
add_pytest(driver)
313304
add_stdlibsamples(driver)
314305

0 commit comments

Comments
 (0)