Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trying to set up envvar in windows correctly. #437

Merged
merged 6 commits into from
Jul 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading