Skip to content

Commit 0fa7e73

Browse files
authored
Run pyright on matrix of platforms and python versions (#5072)
* Run pyright on matrix of platforms and python versions * Drop 3.10 from matrix, as it fails
1 parent 4b4ced5 commit 0fa7e73

File tree

3 files changed

+22
-11
lines changed

3 files changed

+22
-11
lines changed

.github/workflows/tests.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,18 @@ jobs:
8888
pyright:
8989
name: Run pyright against the stubs
9090
runs-on: ubuntu-latest
91+
strategy:
92+
matrix:
93+
python-platform: ["Linux", "Windows", "Darwin"]
94+
python-version: [3.6, 3.7, 3.8, 3.9]
95+
fail-fast: false
9196
steps:
9297
- uses: actions/checkout@v2
9398
- uses: actions/setup-python@v2
9499
- uses: actions/setup-node@v2
95100
with:
96101
node-version: '14'
97-
- run: ./tests/pyright_test.py
102+
- run: ./tests/pyright_test.py --pythonplatform ${{ matrix.python-platform }} --pythonversion ${{ matrix.python-version }}
98103

99104
stubtest:
100105
name: Check stdlib with stubtest

pyrightconfig.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
"stubs/waitress",
4040
"stubs/Werkzeug"
4141
],
42-
"pythonVersion": "3.9",
4342
"typeCheckingMode": "basic",
4443
"strictListInference": true,
4544
"strictDictionaryInference": true,

tests/pyright_test.py

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,37 @@
11
#!/usr/bin/env python3
22

3+
import shutil
34
import subprocess
45
import sys
56
from pathlib import Path
67

7-
8+
_PYRIGHT_VERSION = "1.1.115"
89
_WELL_KNOWN_FILE = Path("tests", "pyright_test.py")
9-
_PYRIGHT_COMMAND = ["npx", "-p", "[email protected]", "pyright"]
1010

1111

1212
def main() -> None:
13-
assert_npm_is_installed()
14-
ret = subprocess.run(_PYRIGHT_COMMAND).returncode
15-
sys.exit(ret)
16-
17-
18-
def assert_npm_is_installed() -> None:
1913
if not _WELL_KNOWN_FILE.exists():
2014
print("pyright_test.py must be run from the typeshed root directory", file=sys.stderr)
2115
sys.exit(1)
16+
17+
# subprocess.run on Windows does not look in PATH.
18+
npx = shutil.which("npx")
19+
20+
if npx is None:
21+
print("error finding npx; is Node.js installed?", file=sys.stderr)
22+
sys.exit(1)
23+
2224
try:
23-
subprocess.run(["npx", "--version"])
25+
subprocess.run([npx, "--version"])
2426
except OSError:
2527
print("error running npx; is Node.js installed?", file=sys.stderr)
2628
sys.exit(1)
2729

30+
command = [npx, "-p", "pyright@" + _PYRIGHT_VERSION, "pyright"] + sys.argv[1:]
31+
32+
ret = subprocess.run(command).returncode
33+
sys.exit(ret)
34+
2835

2936
if __name__ == "__main__":
3037
main()

0 commit comments

Comments
 (0)