Skip to content

Commit

Permalink
Test local env for all systems
Browse files Browse the repository at this point in the history
Some of the tests are irrelevant to Windows. These were mearked to be skipped when run on Windows machine.
Added one test for Windows, wchich is skipped for a non-Windows run.
  • Loading branch information
mknorps committed Dec 21, 2023
1 parent d689171 commit 442db96
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions tests/test_local_env.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
"""Verify behavior of package module looking at a given Python environment."""
import os
import platform
import sys
import venv
from pathlib import Path
Expand Down Expand Up @@ -46,6 +48,23 @@
os.path.join("Lib", "site-packages"),
]


@pytest.mark.skipif(
platform.system() != "Windows", reason="Not relevant to Windows virtual environment"
)
@pytest.mark.parametrize(
"subdir", [pytest.param(d, id=f"venv:{d}") for d in windows_subdirs]
)
def test_find_package_dirs__various_paths_in_venv_windows(tmp_path, subdir):
venv.create(tmp_path, with_pip=False)
path = tmp_path / subdir
expect = {tmp_path / "Lib" / "site-packages"}
assert set(LocalPackageResolver.find_package_dirs(path)) == expect


@pytest.mark.skipif(
platform.system() == "Windows", reason="Not relevant to Windows virtual environment"
)
@pytest.mark.parametrize(
"subdir", [pytest.param(d, id=f"venv:{d}") for d in env_subdirs]
)
Expand All @@ -56,6 +75,9 @@ def test_find_package_dirs__various_paths_in_venv(tmp_path, subdir):
assert set(LocalPackageResolver.find_package_dirs(path)) == expect


@pytest.mark.skipif(
platform.system() == "Windows", reason="Not relevant to Windows virtual environment"
)
@pytest.mark.parametrize(
"subdir", [pytest.param(d, id=f"poetry2nix:{d}") for d in env_subdirs]
)
Expand All @@ -72,6 +94,9 @@ def test_find_package_dirs__various_paths_in_poetry2nix_env(write_tmp_files, sub
assert set(LocalPackageResolver.find_package_dirs(path)) == expect


@pytest.mark.skipif(
platform.system() == "Windows", reason="Not relevant to Windows virtual environment"
)
@pytest.mark.parametrize(
"subdir", [pytest.param(d, id=f"pep582:{d}") for d in pep582_subdirs]
)
Expand All @@ -87,6 +112,9 @@ def test_find_package_dirs__various_paths_in_pypackages(write_tmp_files, subdir)
assert set(LocalPackageResolver.find_package_dirs(path)) == expect


@pytest.mark.skipif(
platform.system() == "Windows", reason="Not relevant to Windows virtual environment"
)
@pytest.mark.parametrize(
"subdir",
[pytest.param(d, id=f"pep582:{d}") for d in pep582_subdirs]
Expand Down

0 comments on commit 442db96

Please sign in to comment.