From 5d3dac9fb9f5f52a9008f4a1929f9a3f4c5375ef Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 16 Apr 2024 10:36:33 +0200 Subject: [PATCH] tox,workflow: pass tests to run via tox `{posargs}` instead of env Using an environ for passing the tests is a bit of a headache when it comes to quoting which is important when trying to write something like: `-k "not test_stages.py"`. I (personally) also find it slightly nicer/more intuitive to be able to do: ``` $ tox -e py36 -- ./test/mod ``` compared to ``` $ TEST_CATEGORY="./test/mod" tox -e py36 ``` --- .github/workflows/test.yml | 6 ++---- tox.ini | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1f7c3621..a3dea260 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -54,10 +54,9 @@ jobs: # it to vfs for the local storage skopeo stage test. sed -i 's/overlay/vfs/g' /usr/share/containers/storage.conf # default system config sed -i 's/overlay/vfs/g' /etc/containers/storage.conf || true # potential overrides - TEST_CATEGORY="${{ matrix.test }}" \ TEST_WORKERS="${{ matrix.env_TEST_WORKERS || env.TEST_WORKERS }}" \ OSBUILD_TEST_STORE="${{ env.OSBUILD_TEST_STORE }}" \ - tox -e "${{ matrix.environment }}" + tox -e "${{ matrix.environment }}" -- ${{ matrix.test }} v1_manifests: name: "Assembler test (legacy)" @@ -73,7 +72,6 @@ jobs: with: image: ghcr.io/osbuild/osbuild-ci:latest-202308241910 run: | - TEST_CATEGORY="test.run.test_assemblers" \ TEST_WORKERS="${{ env.TEST_WORKERS }}" \ OSBUILD_TEST_STORE="${{ env.OSBUILD_TEST_STORE }}" \ - tox -e "py36" + tox -e "py36" -- test.run.test_assemblers diff --git a/tox.ini b/tox.ini index 8cd264df..0acde8a2 100644 --- a/tox.ini +++ b/tox.ini @@ -34,7 +34,7 @@ passenv = TEST_CATEGORY commands = - bash -c 'python -m pytest -v --pyargs --rootdir=. {env:TEST_CATEGORY} {env:TEST_WORKERS}' + python -m pytest -v --pyargs --rootdir=. {posargs} allowlist_externals = bash