Create test for virtual environment (#6007)

* Create test for virtual environment

* Figure out why python path test is failing

* Eliminate quotes on venv_path

* Actually set the python path

* Try just printing path on windows

* Print a different variable

* Try other echo patterns

* user powershell commands to append

* Fix prettier
This commit is contained in:
Rich Chiodo 2023-09-25 10:21:21 -07:00 committed by GitHub
parent 0e95e48650
commit 21aee77eb5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 830 additions and 564 deletions

View File

@ -2,6 +2,7 @@ name: 'Validation'
env:
NODE_VERSION: '16' # Shipped with VS Code.
PYTHON_VERSION: 3.11
on:
push:
@ -107,6 +108,48 @@ jobs:
run: npm test
working-directory: packages/pyright-internal
# Install python so we can create a VENV for tests
- name: Use Python ${{env.PYTHON_VERSION}}
uses: actions/setup-python@v4
id: install_python
with:
python-version: ${{env.PYTHON_VERSION}}
- name: Create Venv
run: |
${{ steps.install_python.outputs.python-path }} -m venv .venv
- name: Activate and install pytest (linux)
if: runner.os != 'Windows'
run: |
source .venv/bin/activate
python -m pip install pytest
python -c "import sys;print('python_venv_path=' + sys.executable)" >> $GITHUB_ENV
- name: Activate and install pytest (windows)
if: runner.os == 'Windows'
run: |
.venv\scripts\activate
python -m pip install pytest
python -c "import sys;print('python_venv_path=' + sys.executable)" | Out-File -FilePath $env:GITHUB_ENV -Append
- name: Echo python_venv_path
run: |
echo python_venv_path=${{env.python_venv_path}}
- name: Run import tests with venv
env:
CI_IMPORT_TEST_VENVPATH: '../../'
CI_IMPORT_TEST_VENV: '.venv'
run: npm run test:imports
working-directory: packages/pyright-internal
- name: Run import tests with pythonpath
env:
CI_IMPORT_TEST_PYTHONPATH: ${{env.python_venv_path}}
run: npm run test:imports
working-directory: packages/pyright-internal
build:
runs-on: ubuntu-latest
name: Build

5
.gitignore vendored
View File

@ -122,4 +122,7 @@ junit.xml
# OS files
.DS_Store
Thumbs.db
Thumbs.db
# Potential venv
.venv

View File

@ -12,7 +12,8 @@
"build": "tsc",
"clean": "shx rm -rf ./dist ./out",
"test": "jest --forceExit",
"test:coverage": "jest --forceExit --reporters=jest-junit --reporters=default --coverage --coverageReporters=cobertura --coverageReporters=html --coverageReporters=json"
"test:coverage": "jest --forceExit --reporters=jest-junit --reporters=default --coverage --coverageReporters=cobertura --coverageReporters=html --coverageReporters=json",
"test:imports": "jest importResolver.test --forceExit --runInBand"
},
"dependencies": {
"@iarna/toml": "2.2.5",

File diff suppressed because it is too large Load Diff