diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 164aeaf79f3d..ff94b54ab646 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -88,13 +88,18 @@ jobs: pyright: name: Run pyright against the stubs runs-on: ubuntu-latest + strategy: + matrix: + python-platform: ["Linux", "Windows", "Darwin"] + python-version: [3.6, 3.7, 3.8, 3.9] + fail-fast: false steps: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 - uses: actions/setup-node@v2 with: node-version: '14' - - run: ./tests/pyright_test.py + - run: ./tests/pyright_test.py --pythonplatform ${{ matrix.python-platform }} --pythonversion ${{ matrix.python-version }} stubtest: name: Check stdlib with stubtest diff --git a/pyrightconfig.json b/pyrightconfig.json index 1ffb8c0beaee..bbb3168a8193 100644 --- a/pyrightconfig.json +++ b/pyrightconfig.json @@ -39,7 +39,6 @@ "stubs/waitress", "stubs/Werkzeug" ], - "pythonVersion": "3.9", "typeCheckingMode": "basic", "strictListInference": true, "strictDictionaryInference": true, diff --git a/tests/pyright_test.py b/tests/pyright_test.py index 926fb952da45..2d4f0a8e6ff3 100755 --- a/tests/pyright_test.py +++ b/tests/pyright_test.py @@ -1,30 +1,37 @@ #!/usr/bin/env python3 +import shutil import subprocess import sys from pathlib import Path - +_PYRIGHT_VERSION = "1.1.115" _WELL_KNOWN_FILE = Path("tests", "pyright_test.py") -_PYRIGHT_COMMAND = ["npx", "-p", "pyright@1.1.114", "pyright"] def main() -> None: - assert_npm_is_installed() - ret = subprocess.run(_PYRIGHT_COMMAND).returncode - sys.exit(ret) - - -def assert_npm_is_installed() -> None: if not _WELL_KNOWN_FILE.exists(): print("pyright_test.py must be run from the typeshed root directory", file=sys.stderr) sys.exit(1) + + # subprocess.run on Windows does not look in PATH. + npx = shutil.which("npx") + + if npx is None: + print("error finding npx; is Node.js installed?", file=sys.stderr) + sys.exit(1) + try: - subprocess.run(["npx", "--version"]) + subprocess.run([npx, "--version"]) except OSError: print("error running npx; is Node.js installed?", file=sys.stderr) sys.exit(1) + command = [npx, "-p", "pyright@" + _PYRIGHT_VERSION, "pyright"] + sys.argv[1:] + + ret = subprocess.run(command).returncode + sys.exit(ret) + if __name__ == "__main__": main()