mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-06 12:14:27 +08:00
add mypy_selftest.py (#1102)
* add mypy_selftest.py * add selftest to Travis
This commit is contained in:
committed by
Łukasz Langa
parent
7e58389a27
commit
e50fcaf658
27
tests/mypy_selftest.py
Executable file
27
tests/mypy_selftest.py
Executable file
@@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Script to run mypy's test suite against this version of typeshed."""
|
||||
|
||||
from pathlib import Path
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
with tempfile.TemporaryDirectory() as tempdir:
|
||||
dirpath = Path(tempdir)
|
||||
subprocess.run(['git', 'clone', '--depth', '1', 'git://github.com/python/mypy',
|
||||
str(dirpath / 'mypy')], check=True)
|
||||
subprocess.run([sys.executable, '-m', 'pip', 'install', '-U', '-r',
|
||||
str(dirpath / 'mypy/test-requirements.txt')], check=True)
|
||||
shutil.copytree('stdlib', str(dirpath / 'mypy/typeshed/stdlib'))
|
||||
shutil.copytree('third_party', str(dirpath / 'mypy/typeshed/third_party'))
|
||||
try:
|
||||
subprocess.run(['./runtests.py'], cwd=str(dirpath / 'mypy'), check=True)
|
||||
except subprocess.CalledProcessError as e:
|
||||
print('mypy tests failed', file=sys.stderr)
|
||||
sys.exit(e.returncode)
|
||||
else:
|
||||
print('mypy tests succeeded', file=sys.stderr)
|
||||
sys.exit(0)
|
||||
Reference in New Issue
Block a user