From 5c46fa4679061b1861a18997250d2986c5f08b09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Mon, 11 Nov 2024 16:59:01 +0100 Subject: [PATCH] Inject $TOX_REQUIRES to tox config E.g. use TOX_REQUIRES="virtualenv<20.22.0" to test tox provision for old Pythons. --- smoke/venv.fmf | 1 + smoke/venv.sh | 15 +++++++++++---- tests.yml | 6 +++--- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/smoke/venv.fmf b/smoke/venv.fmf index 496b693..805ca8b 100644 --- a/smoke/venv.fmf +++ b/smoke/venv.fmf @@ -35,6 +35,7 @@ environment: VERSION: 3.7 METHOD: venv TOX: true + TOX_REQUIRES: "" duration: 10m component+: - python2 diff --git a/smoke/venv.sh b/smoke/venv.sh index b6fb842..c7e7d20 100755 --- a/smoke/venv.sh +++ b/smoke/venv.sh @@ -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 diff --git a/tests.yml b/tests.yml index 6f32fa9..172881b 100644 --- a/tests.yml +++ b/tests.yml @@ -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