Allow skipping virtual environment tests

This is useful for tox end ensurepip tests for pypy 2.7.
This commit is contained in:
Miro Hrončok 2025-07-10 11:41:39 +02:00
commit 223296d711
2 changed files with 12 additions and 6 deletions

View file

@ -36,11 +36,20 @@ elif [ "$METHOD" == "virtualenv-no-download" ]; then
virtualenv --no-download --python=$PYTHON venv
elif [ "$METHOD" == "virtualenv-seeder-pip" ]; then
virtualenv --seeder pip --python=$PYTHON venv
elif [ "$METHOD" == "none" ]; then
echo 'Skipping plain virtual environment tests' >&2
else
echo 'Unsupported $METHOD' $METHOD >&2
exit 1
fi
# create tests
cat > test_foo.py << EOF
def test_foo():
assert True
EOF
if [ "$METHOD" != "none" ]; then
# and activate it
# unset variables on 3.5, it's known
@ -55,11 +64,6 @@ python -c 'import sys; print(sys.version)' | head -n1 | grep ${VERSION/t}
python -m pip install pytest
# run tests
cat > test_foo.py << EOF
def test_foo():
assert True
EOF
python -m pytest -v test_foo.py
if [ "$CYTHON" == "true" ]; then
@ -96,6 +100,8 @@ set +u
deactivate
set -u
fi # METHOD != none
# ensurepip test (when testing virtualenv, this was not covered)
# with the main Python, this will say "Requirement already satisfied", but that's OK
$PYTHON -m ensurepip --root ensurepiptestroot

View file

@ -56,7 +56,7 @@
run: VERSION=3.10 METHOD=virtualenv-download TOX=false ./venv.sh
- smokepypy:
dir: smoke
run: runuser testuser -c 'VERSION=2.7 METHOD=virtualenv PYTHON=pypy ./venv.sh'
run: runuser testuser -c 'VERSION=2.7 METHOD=none PYTHON=pypy TOX_REQUIRES="virtualenv<20.22.0" ./venv.sh'
- smokepypy39:
dir: smoke
run: runuser testuser -c 'VERSION=3.9 METHOD=venv PYTHON=pypy3.9 ./venv.sh'