Skip to content

Commit b215b86

Browse files
mock os.pathsep when running macOS tests on non-macOS systems
1 parent 40f11de commit b215b86

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

tests/test_macos.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,17 @@
1313
from pytest_mock import MockerFixture
1414

1515

16+
@pytest.fixture(autouse=True)
17+
def _fix_os_pathsep(mocker: MockerFixture) -> None:
18+
"""
19+
If we're not actually running on macOS, set `os.pathsep` to
20+
what it should be on macOS.
21+
"""
22+
if sys.platform != "darwin":
23+
mocker.patch("os.pathsep", ":")
24+
mocker.patch("os.path.pathsep", ":")
25+
26+
1627
@pytest.mark.parametrize(
1728
"params",
1829
[

0 commit comments

Comments
 (0)