|
1 | 1 | #!/usr/bin/env python3 |
2 | | -"""Script to run mypy's test suite against this version of typeshed.""" |
| 2 | +"""Script to run mypy against its own code base.""" |
3 | 3 |
|
4 | 4 | from pathlib import Path |
5 | | -import shutil |
6 | 5 | import subprocess |
7 | 6 | import sys |
8 | 7 | import tempfile |
9 | 8 |
|
| 9 | +MYPY_VERSION = "0.790" |
10 | 10 |
|
11 | | -if __name__ == '__main__': |
| 11 | + |
| 12 | +if __name__ == "__main__": |
12 | 13 | with tempfile.TemporaryDirectory() as tempdir: |
13 | 14 | dirpath = Path(tempdir) |
14 | | - subprocess.run(['python2.7', '-m', 'pip', 'install', '--user', 'typing'], check=True) |
15 | | - subprocess.run(['git', 'clone', '--depth', '1', 'git://github.com/python/mypy', |
16 | | - str(dirpath / 'mypy')], check=True) |
17 | | - subprocess.run([sys.executable, '-m', 'pip', 'install', '-U', '-r', |
18 | | - str(dirpath / 'mypy/test-requirements.txt')], check=True) |
19 | | - shutil.copytree('stdlib', str(dirpath / 'mypy/mypy/typeshed/stdlib')) |
20 | | - shutil.copytree('third_party', str(dirpath / 'mypy/mypy/typeshed/third_party')) |
| 15 | + subprocess.run( |
| 16 | + ["git", "clone", "--depth", "1", "git://github.com/python/mypy", str(dirpath)], |
| 17 | + check=True, |
| 18 | + ) |
21 | 19 | try: |
22 | | - subprocess.run(['pytest', '-n12'], cwd=str(dirpath / 'mypy'), check=True) |
| 20 | + subprocess.run([sys.executable, "-m", "pip", "install", f"mypy=={MYPY_VERSION}"], check=True) |
| 21 | + subprocess.run([sys.executable, "-m", "pip", "install", "-r", dirpath / "test-requirements.txt"], check=True) |
| 22 | + subprocess.run( |
| 23 | + [ |
| 24 | + "mypy", |
| 25 | + "--config-file", |
| 26 | + dirpath / "mypy_self_check.ini", |
| 27 | + "--custom-typeshed-dir", |
| 28 | + ".", |
| 29 | + dirpath / "mypy", |
| 30 | + dirpath / "mypyc", |
| 31 | + ], |
| 32 | + check=True, |
| 33 | + ) |
23 | 34 | except subprocess.CalledProcessError as e: |
24 | | - print('mypy tests failed', file=sys.stderr) |
| 35 | + print("mypy self test failed", file=sys.stderr) |
25 | 36 | sys.exit(e.returncode) |
26 | 37 | else: |
27 | | - print('mypy tests succeeded', file=sys.stderr) |
| 38 | + print("mypy self test succeeded", file=sys.stderr) |
28 | 39 | sys.exit(0) |
0 commit comments