mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-16 00:37:10 +08:00
8
.github/workflows/tests.yml
vendored
8
.github/workflows/tests.yml
vendored
@@ -72,14 +72,6 @@ jobs:
|
||||
- run: pip install -U git+git://github.com/python/mypy
|
||||
- run: ./tests/mypy_test.py --platform=${{ matrix.platform }}
|
||||
|
||||
mypy-self-check:
|
||||
name: Check mypy source with itself
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-python@v2
|
||||
- run: ./tests/mypy_self_check.py
|
||||
|
||||
mypy-test-suite:
|
||||
name: Run the mypy test suite
|
||||
# Ubuntu 20.04 doesn't have the Python 2 venv module.
|
||||
|
||||
14
README.md
14
README.md
@@ -110,8 +110,6 @@ tests typeshed with [mypy](https://github.com/python/mypy/)
|
||||
[pytype](https://github.com/google/pytype/).
|
||||
- `tests/pyright_test.py` tests typeshed with
|
||||
[pyright](https://github.com/microsoft/pyright).
|
||||
- `tests/mypy_self_check.py` checks mypy's code base using this version of
|
||||
typeshed.
|
||||
- `tests/mypy_test_suite.py` runs a subset of mypy's test suite using this version of
|
||||
typeshed.
|
||||
- `tests/check_consistent.py` checks certain files in typeshed remain
|
||||
@@ -175,17 +173,7 @@ This test works similarly to `mypy_test.py`, except it uses `pytype`.
|
||||
|
||||
This test requires Node.js to be installed.
|
||||
|
||||
### mypy_self_check.py
|
||||
|
||||
This test requires Python 3.6 or higher; Python 3.6.1 or higher is recommended.
|
||||
Run using:
|
||||
```
|
||||
(.venv3)$ python3 tests/mypy_self_check.py
|
||||
```
|
||||
|
||||
This test checks mypy's code base using mypy and typeshed code in this repo.
|
||||
|
||||
### mypy_test_suite.py
|
||||
### mypy\_test\_suite.py
|
||||
|
||||
This test requires Python 3.5 or higher; Python 3.6.1 or higher is recommended.
|
||||
Run using:
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Script to run mypy against its own code base."""
|
||||
|
||||
import os
|
||||
import re
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
from pathlib import Path
|
||||
|
||||
REQUIREMENTS_FILE = "requirements-tests-py3.txt"
|
||||
MYPY_REQUIREMENTS_REGEXPS = [r"^mypy[ =>]", r"^git\+.*/mypy.git\W"]
|
||||
|
||||
|
||||
def determine_mypy_version() -> str:
|
||||
with open(REQUIREMENTS_FILE) as f:
|
||||
for line in f:
|
||||
for regexp in MYPY_REQUIREMENTS_REGEXPS:
|
||||
m = re.match(regexp, line)
|
||||
if m:
|
||||
return line.strip()
|
||||
raise RuntimeError(f"no mypy version found in {REQUIREMENTS_FILE}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
mypy_version = determine_mypy_version()
|
||||
|
||||
with tempfile.TemporaryDirectory() as tempdir:
|
||||
dirpath = Path(tempdir)
|
||||
subprocess.run(
|
||||
["git", "clone", "--depth", "1", "git://github.com/python/mypy", dirpath],
|
||||
check=True,
|
||||
)
|
||||
os.environ["MYPYPATH"] = str(dirpath)
|
||||
try:
|
||||
subprocess.run([sys.executable, "-m", "pip", "install", "-U", mypy_version], check=True)
|
||||
subprocess.run([sys.executable, "-m", "pip", "install", "-r", dirpath / "test-requirements.txt"], check=True)
|
||||
subprocess.run(
|
||||
[
|
||||
"mypy",
|
||||
"--config-file",
|
||||
dirpath / "mypy_self_check.ini",
|
||||
"--custom-typeshed-dir",
|
||||
".",
|
||||
"-p", "mypy",
|
||||
"-p", "mypyc",
|
||||
],
|
||||
check=True,
|
||||
)
|
||||
except subprocess.CalledProcessError as e:
|
||||
print("mypy self test failed", file=sys.stderr)
|
||||
sys.exit(e.returncode)
|
||||
else:
|
||||
print("mypy self test succeeded", file=sys.stderr)
|
||||
sys.exit(0)
|
||||
Reference in New Issue
Block a user