Skip to content

Commit

Permalink
Fix inappropriate ":" -> os.pathsep in tests.
Browse files Browse the repository at this point in the history
More work towards pex-tool#2658.
  • Loading branch information
jsirois committed Feb 21, 2025
1 parent 3e4a3df commit b46215c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
14 changes: 9 additions & 5 deletions tests/test_pex.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,20 +325,24 @@ def test_pex_run_extra_sys_path():
with named_temporary_file() as fake_stdout:
with temporary_dir() as temp_dir:
pex = write_simple_pex(
temp_dir, 'import sys; sys.stdout.write(":".join(sys.path)); sys.exit(0)'
temp_dir, "import os, sys; sys.stdout.write(os.pathsep.join(sys.path)); sys.exit(0)"
)
rc = PEX(pex.path()).run(
stdin=None,
stdout=fake_stdout,
stderr=None,
env={"PEX_EXTRA_SYS_PATH": "extra/syspath/entry1:extra/syspath/entry2"},
env={
"PEX_EXTRA_SYS_PATH": os.pathsep.join(
("extra/syspath/entry1", "extra/syspath/entry2")
)
},
)
assert rc == 0

fake_stdout.seek(0)
syspath = fake_stdout.read().split(b":")
assert b"extra/syspath/entry1" in syspath
assert b"extra/syspath/entry2" in syspath
syspath = fake_stdout.read().decode("utf-8").split(os.pathsep)
assert "extra/syspath/entry1" in syspath
assert "extra/syspath/entry2" in syspath


@attr.s(frozen=True)
Expand Down
5 changes: 3 additions & 2 deletions tests/test_pex_bootstrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ def test_pp_exact_on_ppp():

with ENV.patch(
PEX_PYTHON=py310,
PEX_PYTHON_PATH=":".join(os.path.dirname(py) for py in (py38, py39, py310)),
PEX_PYTHON_PATH=os.pathsep.join(os.path.dirname(py) for py in (py38, py39, py310)),
):
assert PythonInterpreter.from_binary(py310) == find_compatible_interpreter()

Expand Down Expand Up @@ -325,7 +325,8 @@ def test_pp_exact_not_on_ppp():
py310 = ensure_python_interpreter(PY310)

with ENV.patch(
PEX_PYTHON=py310, PEX_PYTHON_PATH=":".join(os.path.dirname(py) for py in (py38, py39))
PEX_PYTHON=py310,
PEX_PYTHON_PATH=os.pathsep.join(os.path.dirname(py) for py in (py38, py39)),
):
with pytest.raises(
UnsatisfiableInterpreterConstraintsError,
Expand Down

0 comments on commit b46215c

Please sign in to comment.