Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions tests/test_asyncio.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,15 @@
import pytest


@pytest.fixture
def pytester(pytester: pytest.Pytester) -> pytest.Pytester:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inside the pytester fixture they create a new pytest.Pytester instance which inside their constructor overrides these env vars. This overrides the pytester fixture so it runs after it was created, resets the env vars and returns the original instance back.

# Pytester internally in their constructor overrides the HOME and USERPROFILE env variables. This confuses Chromium hence we unset them.
# See https://github.com/pytest-dev/pytest/blob/83536b4b0074ca35d90933d3ad46cb6efe7f5145/src/_pytest/pytester.py#L704-L705
os.environ.pop("HOME", None)
os.environ.pop("USERPROFILE", None)
return pytester


@pytest.fixture(autouse=True)
def _add_async_marker(testdir: pytest.Testdir) -> None:
testdir.makefile(
Expand Down
9 changes: 9 additions & 0 deletions tests/test_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,15 @@
import pytest


@pytest.fixture
def pytester(pytester: pytest.Pytester) -> pytest.Pytester:
# Pytester internally in their constructor overrides the HOME and USERPROFILE env variables. This confuses Chromium hence we unset them.
# See https://github.com/pytest-dev/pytest/blob/83536b4b0074ca35d90933d3ad46cb6efe7f5145/src/_pytest/pytester.py#L704-L705
os.environ.pop("HOME", None)
os.environ.pop("USERPROFILE", None)
return pytester


@pytest.fixture(autouse=True)
def _add_ini(testdir: pytest.Testdir) -> None:
testdir.makefile(
Expand Down
Loading