Skip to content

Commit

Permalink
Merge pull request #437 from PyAr/fix-windows-integtest
Browse files Browse the repository at this point in the history
Trying to set up envvar in windows correctly.
  • Loading branch information
facundobatista authored Jul 17, 2024
2 parents b908c2d + b8f69e5 commit 1819975
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 11 deletions.
12 changes: 4 additions & 8 deletions .github/workflows/integtests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down Expand Up @@ -91,8 +89,7 @@ jobs:
- name: Using a different Python
run: |
set 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:
Expand Down Expand Up @@ -127,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
21 changes: 21 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
# Copyright 2019-2024 Facundo Batista, Nicolás Demarchi
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 3, as published
# by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranties of
# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
# For further info, check https://github.com/PyAr/fades

import shutil
import uuid

Expand Down Expand Up @@ -29,3 +45,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")
5 changes: 2 additions & 3 deletions tests/integtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,11 @@
way from the integration tests defined in the Github CI infrastructure.
"""

import os
import sys


def test_assert_python_version():
expected = os.environ["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

0 comments on commit 1819975

Please sign in to comment.