Skip to content

Commit c9e392b

Browse files
authored
test: fix Chromium tests on Windows (#281)
1 parent 67f7ea3 commit c9e392b

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

tests/test_asyncio.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,15 @@
2020
import pytest
2121

2222

23+
@pytest.fixture
24+
def pytester(pytester: pytest.Pytester) -> pytest.Pytester:
25+
# Pytester internally in their constructor overrides the HOME and USERPROFILE env variables. This confuses Chromium hence we unset them.
26+
# See https://github.com/pytest-dev/pytest/blob/83536b4b0074ca35d90933d3ad46cb6efe7f5145/src/_pytest/pytester.py#L704-L705
27+
os.environ.pop("HOME", None)
28+
os.environ.pop("USERPROFILE", None)
29+
return pytester
30+
31+
2332
@pytest.fixture(autouse=True)
2433
def _add_async_marker(testdir: pytest.Testdir) -> None:
2534
testdir.makefile(

tests/test_sync.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,15 @@
2121
import pytest
2222

2323

24+
@pytest.fixture
25+
def pytester(pytester: pytest.Pytester) -> pytest.Pytester:
26+
# Pytester internally in their constructor overrides the HOME and USERPROFILE env variables. This confuses Chromium hence we unset them.
27+
# See https://github.com/pytest-dev/pytest/blob/83536b4b0074ca35d90933d3ad46cb6efe7f5145/src/_pytest/pytester.py#L704-L705
28+
os.environ.pop("HOME", None)
29+
os.environ.pop("USERPROFILE", None)
30+
return pytester
31+
32+
2433
@pytest.fixture(autouse=True)
2534
def _add_ini(testdir: pytest.Testdir) -> None:
2635
testdir.makefile(

0 commit comments

Comments
 (0)