Skip to content

Commit 569d313

Browse files
committed
fix: reload after tests that modify behaviour
1 parent c6f435a commit 569d313

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

tests/test_unix.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@
1818
from pytest_mock import MockerFixture
1919

2020

21+
@pytest.fixture
22+
def _reload_after_test() -> typing.Iterator[None]:
23+
global Unix # noqa: PLW0603 - we need to rewrite this full import.
24+
yield
25+
importlib.reload(unix)
26+
Unix = unix.Unix
27+
28+
2129
@pytest.mark.parametrize(
2230
"prop",
2331
[
@@ -175,7 +183,7 @@ def test_platform_on_win32(monkeypatch: pytest.MonkeyPatch, mocker: MockerFixtur
175183
sys.modules["platformdirs.unix"] = prev_unix
176184

177185

178-
@pytest.mark.usefixtures("_getuid")
186+
@pytest.mark.usefixtures("_getuid", "_reload_after_test")
179187
@pytest.mark.parametrize(
180188
("platform", "default_dir"),
181189
[

0 commit comments

Comments
 (0)