diff --git a/.github/workflows/integtests.yaml b/.github/workflows/integtests.yaml index 87bf329..0e15961 100644 --- a/.github/workflows/integtests.yaml +++ b/.github/workflows/integtests.yaml @@ -29,8 +29,7 @@ jobs: bin/fades -v -d pytest -x pytest --version - name: Using a different Python run: | - export TEST_PYTHON_VERSION=3.9 - python bin/fades -v --python=python3.9 -d pytest -x pytest -v tests/integtest.py + python bin/fades -v --python=python3.9 -d pytest -x pytest -v --integtest-pyversion=3.9 tests/integtest.py fedora: runs-on: ubuntu-latest @@ -54,8 +53,7 @@ jobs: run: | yum install --assumeyes python3.9 cd /fades - export TEST_PYTHON_VERSION=3.9 - python3.12 bin/fades -v --python=python3.9 -d pytest -x pytest -v tests/integtest.py + python3.12 bin/fades -v --python=python3.9 -d pytest -x pytest -v --integtest-pyversion=3.9 tests/integtest.py native-windows: strategy: @@ -91,7 +89,7 @@ jobs: - name: Using a different Python run: | - TEST_PYTHON_VERSION=3.10 ${{ steps.matrixpy.outputs.python-path }} bin/fades -v --python=${{ steps.otherpy.outputs.python-path }} -d pytest -x pytest -v tests/integtest.py + ${{ steps.matrixpy.outputs.python-path }} bin/fades -v --python=${{ steps.otherpy.outputs.python-path }} -d pytest -x pytest -v --integtest-pyversion=3.10 tests/integtest.py native-generic: strategy: @@ -126,5 +124,4 @@ jobs: - name: Using a different Python run: | - export TEST_PYTHON_VERSION=3.10 - ${{ steps.matrixpy.outputs.python-path }} bin/fades -v --python=python3.10 -d pytest -x pytest -v tests/integtest.py + ${{ steps.matrixpy.outputs.python-path }} bin/fades -v --python=python3.10 -d pytest -x pytest -v --integtest-pyversion=3.10 tests/integtest.py diff --git a/tests/conftest.py b/tests/conftest.py index ada0eb1..612abdb 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -29,3 +29,8 @@ def add_content(lines): yield add_content shutil.rmtree(str(dir_path)) + + +def pytest_addoption(parser): + """Define new pytest command line argument to be used by integration tests.""" + parser.addoption("--integtest-pyversion", action="store") \ No newline at end of file diff --git a/tests/integtest.py b/tests/integtest.py index 949d2a3..01f14c3 100644 --- a/tests/integtest.py +++ b/tests/integtest.py @@ -24,8 +24,8 @@ import sys -def test_assert_python_version(): - expected = os.environ.get("TEST_PYTHON_VERSION") +def test_assert_python_version(pytestconfig): + expected = pytestconfig.getoption("integtest_pyversion") vi = sys.version_info current = f"{vi.major}.{vi.minor}" assert current == expected