Skip to content

Commit

Permalink
Skip tests that use pyenv Python 2.7 on Windows. (#2705)
Browse files Browse the repository at this point in the history
More work towards #2658.
  • Loading branch information
jsirois authored Feb 27, 2025
1 parent c1a20f2 commit ff17647
Show file tree
Hide file tree
Showing 40 changed files with 46 additions and 42 deletions.
12 changes: 8 additions & 4 deletions testing/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
from contextlib import contextmanager
from textwrap import dedent

import pytest

from pex.atomic_directory import atomic_directory
from pex.common import open_zip, safe_mkdir, safe_mkdtemp, safe_rmtree, safe_sleep, temporary_dir
from pex.dist_metadata import Distribution
Expand Down Expand Up @@ -608,10 +610,12 @@ def ensure_python_distribution(version):
if version not in ALL_PY_VERSIONS:
raise ValueError("Please constrain version to one of {}".format(ALL_PY_VERSIONS))

assert not WINDOWS or _ALL_PY_VERSIONS_TO_VERSION_INFO[version][:2] >= (
3,
8,
), "Test uses pyenv {} interpreter which is not supported on Windows.".format(version)
if WINDOWS and _ALL_PY_VERSIONS_TO_VERSION_INFO[version][:2] < (3, 8):
pytest.skip(
"Test uses pyenv {version} interpreter which is not supported on Windows.".format(
version=version
)
)

clone_dir = os.path.abspath(
os.path.join(PEX_TEST_DEV_ROOT, "pyenv-win" if WINDOWS else "pyenv")
Expand Down
2 changes: 1 addition & 1 deletion testing/bin/run_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def main():

args = [sys.executable, "-m", "pytest", "-n", "auto"]
if options.it:
args.extend(["tests/integration", "-p", "testing.pytest.shard"])
args.extend(["tests/integration", "-p", "testing.pytest_utils.shard"])
else:
args.extend(["tests", "--ignore", "tests/integration"])
args.extend(passthrough_args or ["-vvs"])
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from pex.compatibility import PY2
from pex.typing import TYPE_CHECKING
from testing.pytest.tmp import RetentionPolicy
from testing.pytest_utils.tmp import RetentionPolicy

if TYPE_CHECKING:
from typing import Dict
Expand All @@ -32,9 +32,9 @@ def passed(node):


if PY2:
from testing.pytest.track_status_hook_py2 import track_status_hook as _track_status_hook
from testing.pytest_utils.track_status_hook_py2 import track_status_hook as _track_status_hook
else:
from testing.pytest.track_status_hook_py3 import track_status_hook as _track_status_hook
from testing.pytest_utils.track_status_hook_py3 import track_status_hook as _track_status_hook

hook = _track_status_hook

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def track_status_hook(
):
# type: (...) -> Generator[None, _Result, None]

from testing.pytest.track_status_hook import mark_passed
from testing.pytest_utils.track_status_hook import mark_passed

report = yield
result = report.get_result()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def track_status_hook(
):
# type: (...) -> Generator[None, TestReport, TestReport]

from testing.pytest.track_status_hook import mark_passed
from testing.pytest_utils.track_status_hook import mark_passed

report = yield
if sys.version_info[:2] < (3, 7):
Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from pex.platforms import Platform
from pex.typing import TYPE_CHECKING
from testing import PY27, PY38, PY39, PY310, ensure_python_interpreter
from testing.pytest import tmp, track_status_hook
from testing.pytest_utils import tmp, track_status_hook

if TYPE_CHECKING:
from typing import Iterator
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/cli/commands/test_cache_prune.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
from pex.variables import ENV
from testing import run_pex_command, subprocess
from testing.cli import run_pex3
from testing.pytest.tmp import Tempdir
from testing.pytest_utils.tmp import Tempdir

if TYPE_CHECKING:
from typing import Iterable, Iterator, Optional
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/cli/commands/test_issue_1413.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from pex.typing import TYPE_CHECKING
from testing import make_env, run_pex_command, subprocess
from testing.cli import run_pex3
from testing.pytest.tmp import Tempdir, TempdirFactory
from testing.pytest_utils.tmp import Tempdir, TempdirFactory

if TYPE_CHECKING:
from typing import Any
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/cli/commands/test_issue_2098.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from pex.interpreter import PythonInterpreter
from testing import run_pex_command
from testing.cli import run_pex3
from testing.pytest.tmp import Tempdir
from testing.pytest_utils.tmp import Tempdir


def test_missing_download_lock_analysis_handling(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from pex.resolve.lockfile import json_codec
from pex.sorted_tuple import SortedTuple
from testing.cli import run_pex3
from testing.pytest.tmp import Tempdir
from testing.pytest_utils.tmp import Tempdir

req = Requirement.parse

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from pex.resolve.lockfile import json_codec
from pex.resolve.lockfile.model import Lockfile
from testing.cli import run_pex3
from testing.pytest.tmp import Tempdir
from testing.pytest_utils.tmp import Tempdir


def index_locked_reqs(lockfile):
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/cli/commands/test_lock_resolve_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from pex.typing import TYPE_CHECKING
from testing import IntegResults, make_env, run_pex_command
from testing.cli import run_pex3
from testing.pytest.tmp import TempdirFactory
from testing.pytest_utils.tmp import TempdirFactory

if TYPE_CHECKING:
from typing import Any, Iterator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from pex.typing import TYPE_CHECKING
from testing import run_pex_command
from testing.cli import run_pex3
from testing.pytest.tmp import Tempdir
from testing.pytest_utils.tmp import Tempdir

if TYPE_CHECKING:
from typing import Union
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/cli/commands/test_lock_subset.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from pex.sorted_tuple import SortedTuple
from testing import PY_VER, data
from testing.cli import run_pex3
from testing.pytest.tmp import Tempdir
from testing.pytest_utils.tmp import Tempdir


@pytest.fixture(scope="session")
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/cli/commands/test_venv_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
subprocess,
)
from testing.cli import run_pex3
from testing.pytest.tmp import Tempdir, TempdirFactory
from testing.pytest_utils.tmp import Tempdir, TempdirFactory

if TYPE_CHECKING:
from typing import Any
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/resolve/test_dependency_groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from pex.pep_503 import ProjectName
from pex.pex import PEX
from testing import run_pex_command, subprocess
from testing.pytest.tmp import Tempdir
from testing.pytest_utils.tmp import Tempdir


def test_pex_from_dependency_groups(tmpdir):
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/resolve/test_issue_2568.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

from pex import targets
from testing.cli import run_pex3
from testing.pytest.tmp import Tempdir
from testing.pytest_utils.tmp import Tempdir


def test_independent_logs_for_independent_runs(tmpdir):
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_excludes.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
from testing import PY_VER, IntegResults, data, make_env, run_pex_command, subprocess
from testing.cli import run_pex3
from testing.lock import extract_lock_option_args, index_lock_artifacts
from testing.pytest.tmp import Tempdir, TempdirFactory
from testing.pytest_utils.tmp import Tempdir, TempdirFactory

if TYPE_CHECKING:
from typing import Any
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
)
from testing.mitmproxy import Proxy
from testing.pep_427 import get_installable_type_flag
from testing.pytest import IS_CI
from testing.pytest_utils import IS_CI

if TYPE_CHECKING:
from typing import Any, Callable, Iterator, List, Optional, Tuple
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_issue_1560.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
run_pex_command,
subprocess,
)
from testing.pytest.tmp import Tempdir
from testing.pytest_utils.tmp import Tempdir
from testing.pythonPI import skip_flit_core_39

if TYPE_CHECKING:
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_issue_1656.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from pex.pex_info import PexInfo
from pex.typing import TYPE_CHECKING
from testing import IS_PYPY, PY_VER, make_env, run_pex_command, subprocess
from testing.pytest.tmp import TempdirFactory
from testing.pytest_utils.tmp import TempdirFactory

if TYPE_CHECKING:
from typing import Any, List, Text
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_issue_2572.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

from pex.fs import safe_symlink
from testing import make_env, run_pex_command, subprocess
from testing.pytest.tmp import Tempdir
from testing.pytest_utils.tmp import Tempdir


def test_symlinked_home(tmpdir):
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_issue_996.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
run_pex_command,
subprocess,
)
from testing.pytest.tmp import Tempdir
from testing.pytest_utils.tmp import Tempdir

if TYPE_CHECKING:
from typing import List
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_lock_resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from testing import IS_PYPY, PY_VER, built_wheel, make_env, run_pex_command, subprocess
from testing.cli import run_pex3
from testing.lock import index_lock_artifacts
from testing.pytest.tmp import Tempdir, TempdirFactory
from testing.pytest_utils.tmp import Tempdir, TempdirFactory

if TYPE_CHECKING:
from typing import Any, Mapping, Tuple
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_pex_bootstrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
run_pex_command,
subprocess,
)
from testing.pytest.tmp import Tempdir
from testing.pytest_utils.tmp import Tempdir

if TYPE_CHECKING:
from typing import Any, List, Optional, Set, Text
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_reproducible.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
run_commands_with_jitter,
)
from testing.cli import run_pex3
from testing.pytest.tmp import Tempdir
from testing.pytest_utils.tmp import Tempdir

if TYPE_CHECKING:
from typing import Iterable, List, Optional, Tuple
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_sh_boot.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from pex.os import WINDOWS
from pex.typing import TYPE_CHECKING
from testing import all_pythons, make_env, run_pex_command, subprocess
from testing.pytest.tmp import Tempdir
from testing.pytest_utils.tmp import Tempdir

if TYPE_CHECKING:
from typing import Any, Iterable, Iterator, List, Text, Tuple
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/tools/commands/test_issue_2105.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from pex.typing import TYPE_CHECKING
from pex.venv.virtualenv import InstallationChoice, Virtualenv
from testing import make_env, run_pex_command, subprocess
from testing.pytest.tmp import Tempdir, TempdirFactory
from testing.pytest_utils.tmp import Tempdir, TempdirFactory

if TYPE_CHECKING:
from typing import Any, Iterable, Mapping, Optional
Expand Down
2 changes: 1 addition & 1 deletion tests/resolve/test_dependency_groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from pex.resolve import project
from pex.typing import cast
from testing import pushd
from testing.pytest.tmp import Tempdir
from testing.pytest_utils.tmp import Tempdir


def create_dependency_groups_project(
Expand Down
2 changes: 1 addition & 1 deletion tests/resolve/test_script_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from pex.resolve.resolvers import Unsatisfiable
from pex.resolve.target_configuration import InterpreterConfiguration, TargetConfiguration
from pex.third_party.packaging.specifiers import SpecifierSet
from testing.pytest.tmp import Tempdir
from testing.pytest_utils.tmp import Tempdir


@pytest.fixture
Expand Down
2 changes: 1 addition & 1 deletion tests/test_executables.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from pex.os import WINDOWS, is_exe
from pex.pep_427 import install_wheel_interpreter
from pex.venv.virtualenv import InstallationChoice, Virtualenv
from testing.pytest.tmp import Tempdir
from testing.pytest_utils.tmp import Tempdir


@pytest.mark.skipif(WINDOWS, reason="This test checks posix expectations of a script.")
Expand Down
2 changes: 1 addition & 1 deletion tests/test_interpreter.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
pushd,
subprocess,
)
from testing.pytest.tmp import TempdirFactory
from testing.pytest_utils.tmp import TempdirFactory

try:
from unittest.mock import Mock, patch # type: ignore[import]
Expand Down
2 changes: 1 addition & 1 deletion tests/test_os.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from pex.common import touch
from pex.executables import chmod_plus_x
from pex.os import is_exe
from testing.pytest.tmp import Tempdir
from testing.pytest_utils.tmp import Tempdir


def test_is_exe(tmpdir):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_pex_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from pex.typing import TYPE_CHECKING
from pex.variables import Variables
from pex.version import __version__ as pex_version
from testing.pytest.tmp import Tempdir
from testing.pytest_utils.tmp import Tempdir

if TYPE_CHECKING:
from typing import Dict, List, Text
Expand Down
2 changes: 1 addition & 1 deletion tests/test_pip.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
from pex.variables import ENV
from pex.venv.virtualenv import Virtualenv
from testing import IS_LINUX, PY310, ensure_python_interpreter
from testing.pytest.tmp import Tempdir
from testing.pytest_utils.tmp import Tempdir

if TYPE_CHECKING:
from typing import Any, Iterable, Iterator, Optional, Protocol
Expand Down
2 changes: 1 addition & 1 deletion tests/test_variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from pex.typing import TYPE_CHECKING
from pex.util import named_temporary_file
from pex.variables import NoValueError, Variables
from testing.pytest.tmp import Tempdir
from testing.pytest_utils.tmp import Tempdir

if TYPE_CHECKING:
from typing import Any
Expand Down
2 changes: 1 addition & 1 deletion tests/test_windows.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from pex import windows
from pex.sysconfig import SysPlatform
from testing.pytest.tmp import Tempdir
from testing.pytest_utils.tmp import Tempdir


def test_is_script(tmpdir):
Expand Down

0 comments on commit ff17647

Please sign in to comment.