From 223296d711c2d6c2590b23bc2533d6bbe64fa0fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Thu, 10 Jul 2025 11:41:39 +0200 Subject: [PATCH] Allow skipping virtual environment tests This is useful for tox end ensurepip tests for pypy 2.7. --- smoke/venv.sh | 16 +++++++++++----- tests.yml | 2 +- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/smoke/venv.sh b/smoke/venv.sh index 39d7186..56ffd1e 100755 --- a/smoke/venv.sh +++ b/smoke/venv.sh @@ -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 diff --git a/tests.yml b/tests.yml index 172881b..ec2599e 100644 --- a/tests.yml +++ b/tests.yml @@ -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'