diff --git a/.github/workflows/test_conan_extensions.yml b/.github/workflows/test_conan_extensions.yml index 0f8817c..19db4cc 100644 --- a/.github/workflows/test_conan_extensions.yml +++ b/.github/workflows/test_conan_extensions.yml @@ -31,4 +31,20 @@ jobs: pip install git+https://github.com/conan-io/conan.git@release/2.0 - name: Run tests - Conan develop / Python 3.8 run: | - pytest -v tests \ No newline at end of file + pytest -v tests + + conan_windows: + runs-on: windows-latest + steps: + - uses: actions/checkout@v3 + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: 3.8 + - name: Install dependencies and Conan latest + run: | + pip install -U pip + pip install pytest conan + - name: Run Windows-specific tests - Conan latest / Python 3.8 + run: | + pytest -v -m win32 tests diff --git a/tests/conftest.py b/tests/conftest.py index 427d9c2..07ab26c 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,4 +1,6 @@ import os +import sys + import pytest @@ -14,3 +16,12 @@ def pytest_collection_modifyitems(items): ): item.add_marker(pytest.mark.skip(reason="Missing required credentials environment variables")) print(f"Skipping test {item.nodeid}. Missing required credentials environment variables.") + +ALL_OS = set("darwin linux win32".split()) + + +def pytest_runtest_setup(item): + supported_platforms = ALL_OS.intersection(mark.name for mark in item.iter_markers()) + plat = sys.platform + if supported_platforms and plat not in supported_platforms: + pytest.skip("cannot run on platform {}".format(plat)) diff --git a/tests/test_pdb_hook.py b/tests/test_pdb_hook.py index eb86192..7a5931a 100644 --- a/tests/test_pdb_hook.py +++ b/tests/test_pdb_hook.py @@ -1,10 +1,12 @@ -import pytest import os import tempfile -from tools import run import json import platform +import pytest + +from tools import run + @pytest.fixture(autouse=True) def conan_test(): @@ -22,7 +24,7 @@ def conan_test(): os.environ.update(old_env) -@pytest.mark.skipif(platform.system() != "Windows", reason="Only for Windows with msvc") +@pytest.mark.win32 def test_copy_pdb_hook(): repo = os.path.join(os.path.dirname(__file__), "..") run(f'conan config install {repo}') @@ -42,4 +44,3 @@ def test_copy_pdb_hook(): package_id = next(iter(revision_info['packages'])) path = run(fr'conan cache path lib/1.0:{package_id}').strip() assert os.path.isfile(os.path.join(path, 'bin', 'lib.pdb')) -