Skip to content

Commit

Permalink
Pyright: create a more isolated environment in CI for testing stubs (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexWaygood authored May 1, 2023
1 parent f5a870b commit d208d5a
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
17 changes: 14 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,15 +125,23 @@ jobs:
python-version: "3.10"
cache: pip
cache-dependency-path: requirements-tests.txt
- name: Install external dependencies for 3rd-party stubs
- name: Install typeshed test-suite requirements
# Install these so we can run `get_external_stub_requirements.py`
run: pip install -r requirements-tests.txt
- name: Create an isolated venv for testing
run: python -m venv .venv
- name: Install 3rd-party stub dependencies
run: |
pip install -r requirements-tests.txt
DEPENDENCIES=$(python tests/get_external_stub_requirements.py)
if [ -n "$DEPENDENCIES" ]; then
source .venv/bin/activate
echo "Installing packages: $DEPENDENCIES"
pip install $DEPENDENCIES
fi
- run: pip freeze --all
- name: List 3rd-party stub dependencies installed
run: |
source .venv/bin/activate
pip freeze --all
- name: Get pyright version
uses: SebRollen/[email protected]
id: pyright_version
Expand All @@ -147,13 +155,15 @@ jobs:
python-platform: ${{ matrix.python-platform }}
python-version: ${{ matrix.python-version }}
no-comments: ${{ matrix.python-version != '3.10' || matrix.python-platform != 'Linux' }} # Having each job create the same comment is too noisy.
venv-path: .
- name: Run pyright with stricter settings on some of the stubs
uses: jakebailey/pyright-action@v1
with:
version: ${{ steps.pyright_version.outputs.value }}
python-platform: ${{ matrix.python-platform }}
python-version: ${{ matrix.python-version }}
no-comments: ${{ matrix.python-version != '3.10' || matrix.python-platform != 'Linux' }} # Having each job create the same comment is too noisy.
venv-path: .
project: ./pyrightconfig.stricter.json
- name: Run pyright on the test cases
uses: jakebailey/pyright-action@v1
Expand All @@ -162,6 +172,7 @@ jobs:
python-platform: ${{ matrix.python-platform }}
python-version: ${{ matrix.python-version }}
no-comments: ${{ matrix.python-version != '3.10' || matrix.python-platform != 'Linux' }} # Having each job create the same comment is too noisy.
venv-path: .
project: ./pyrightconfig.testcases.json

stub-uploader:
Expand Down
1 change: 1 addition & 0 deletions pyrightconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"$schema": "https://raw.githubusercontent.com/microsoft/pyright/main/packages/vscode-pyright/schemas/pyrightconfig.schema.json",
"typeshedPath": ".",
"venv": ".venv",
"include": [
"stdlib",
"stubs",
Expand Down
1 change: 1 addition & 0 deletions pyrightconfig.stricter.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"$schema": "https://raw.githubusercontent.com/microsoft/pyright/main/packages/vscode-pyright/schemas/pyrightconfig.schema.json",
"typeshedPath": ".",
"venv": ".venv",
"include": [
"stdlib",
"stubs",
Expand Down
1 change: 1 addition & 0 deletions pyrightconfig.testcases.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"$schema": "https://raw.githubusercontent.com/microsoft/pyright/main/packages/vscode-pyright/schemas/pyrightconfig.schema.json",
"typeshedPath": ".",
"venv": ".venv",
"include": [
"test_cases",
"stubs/**/@tests/test_cases"
Expand Down

0 comments on commit d208d5a

Please sign in to comment.