Inject $TOX_REQUIRES to tox config

E.g. use TOX_REQUIRES="virtualenv<20.22.0" to test tox provision for old Pythons.
This commit is contained in:
Miro Hrončok 2024-11-11 16:59:01 +01:00
commit 5c46fa4679
3 changed files with 15 additions and 7 deletions

View file

@ -35,6 +35,7 @@ environment:
VERSION: 3.7
METHOD: venv
TOX: true
TOX_REQUIRES: ""
duration: 10m
component+:
- python2

View file

@ -8,6 +8,7 @@ VERSION=${VERSION:-3.8}
PYTHON=${PYTHON:-python$VERSION}
METHOD=${METHOD:-venv}
TOX=${TOX:-true}
TOX_REQUIRES=${TOX_REQUIRES:-}
CYTHON=${CYTHON:-true}
INSTALL_OR_SKIP=${INSTALL_OR_SKIP:-false}
@ -109,8 +110,11 @@ else
export TOXENV=$PYTHON
fi
cat > tox.ini << EOF
[tox]
echo '[tox]' > tox.ini
if [ -n "$TOX_REQUIRES" ]; then
echo 'requires = '"$TOX_REQUIRES" >> tox.ini
fi
cat >> tox.ini << EOF
skipsdist = True
[testenv]
commands = python -c 'import sys; print(sys.version)'
@ -120,8 +124,11 @@ EOF
tox | tee toxlog
grep "^$VERSION\.[0-9]" toxlog
cat > tox.ini << EOF
[tox]
echo '[tox]' > tox.ini
if [ -n "$TOX_REQUIRES" ]; then
echo 'requires = '"$TOX_REQUIRES" >> tox.ini
fi
cat >> tox.ini << EOF
skipsdist = True
[testenv]
deps = pytest

View file

@ -20,13 +20,13 @@
run: runuser testuser -c './venv.sh'
- smoke27:
dir: smoke
run: VERSION=2.7 INSTALL_OR_SKIP=true METHOD=virtualenv ./venv.sh
run: VERSION=2.7 INSTALL_OR_SKIP=true METHOD=virtualenv TOX_REQUIRES="virtualenv<20.22.0" ./venv.sh
- smoke27_seeder_pip:
dir: smoke
run: VERSION=2.7 INSTALL_OR_SKIP=true METHOD=virtualenv-seeder-pip ./venv.sh
run: VERSION=2.7 INSTALL_OR_SKIP=true METHOD=virtualenv-seeder-pip TOX=false ./venv.sh
- smoke36:
dir: smoke
run: runuser testuser -c 'VERSION=3.6 METHOD=venv TOX=false ./venv.sh'
run: runuser testuser -c 'VERSION=3.6 METHOD=venv TOX_REQUIRES="virtualenv<20.22.0" ./venv.sh'
- smoke37:
dir: smoke
run: VERSION=3.7 METHOD=venv INSTALL_OR_SKIP=true ./venv.sh