Skip to content

Commit cfaf154

Browse files
committed
Fix venv check by inverting exit code and adding more info
1 parent 083c7b5 commit cfaf154

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

.github/workflows/internal-check-python-venv-support.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,14 @@ jobs:
3232
env:
3333
USE_VIRTUAL_PYTHON_ENVIRONMENT_VENV: "true"
3434
# 1. Run the script under test to create, activate and install the virtual environment
35-
# 2a. Run pip in dry-run mode without installing or resolving dependencies
36-
# 2b. Suppress all pip output (stderr)
37-
# 2c. Check if pip *would install* anything using grep
38-
# 2d. If there are missing dependencies and the environment is incomplete, return 1 (indicates all requirements already satisfied)
35+
# 2. Run pip in dry-mode with full output first to get all infos and fail on missing packages.
36+
# 3a. The leading exclamation mark tells the shell to invert the returned exit code.
37+
# Failing because "Would install" is missing leads to a successful execution.
38+
# 3b. Run pip in dry-run mode without installing or resolving dependencies
39+
# 3c. Suppress all pip output (stderr)
40+
# 3d. Check if pip *would install* anything using grep
41+
# 3e. If there are missing dependencies and the environment is incomplete, fail with code 1 (indicates all requirements already satisfied)
3942
run: |
4043
./scripts/activatePythonEnvironment.sh
41-
pip install --dry-run --no-deps --requirement "./requirements.txt" 2>/dev/null | grep -q "Would install" || return 1
44+
pip install --dry-run --no-deps --requirement "./requirements.txt"
45+
! pip install --dry-run --no-deps --requirement "./requirements.txt" 2>/dev/null | grep -q "Would install"

0 commit comments

Comments
 (0)