mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-10-04 19:28:50 +08:00
Enable flake8 tests
Ran both by Travis and locally. There's some setup required, README updated. A few important Flake8 checks are still disabled, we're going to enable them as soon as the stubs are fixed and we can reliably run Flake8 locally with Python 3.6.
This commit is contained in:
1 parent
82b2d8e3bc
commit
79d8757f1f
6 files changed
+103
-20
No files matched your search
Executable
+47
@@ -0,0 +1,47 @@
|
||||
#!/usr/bin/env python3
|
||||
import pathlib
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
PY2_ONLY_KEYWORDS = [
|
||||
'StandardError',
|
||||
'apply',
|
||||
'basestring',
|
||||
'buffer',
|
||||
'cmp',
|
||||
'coerce',
|
||||
'execfile',
|
||||
'file',
|
||||
'intern',
|
||||
'long',
|
||||
'raw_input',
|
||||
'reduce',
|
||||
'reload',
|
||||
'unichr',
|
||||
'unicode',
|
||||
'xrange',
|
||||
]
|
||||
|
||||
root = pathlib.Path(__file__).parent.parent
|
||||
paths = list(sorted(str(p) for p in root.glob('**/*.pyi')))
|
||||
window = 0
|
||||
size = 100
|
||||
returncode = 0
|
||||
|
||||
print('Running flake8 on {} .pyi files...'.format(len(paths)))
|
||||
|
||||
while True:
|
||||
chunk = paths[window:window + size]
|
||||
if not chunk:
|
||||
break
|
||||
|
||||
proc = subprocess.run(
|
||||
['flake8', '--builtins=' + ','.join(PY2_ONLY_KEYWORDS)] + chunk,
|
||||
)
|
||||
if proc.returncode:
|
||||
print('flake8 run failed!')
|
||||
sys.exit(1)
|
||||
|
||||
window += size
|
||||
|
||||
print('flake8 run clean.')
|
||||
Reference in new issue
Block a user