Skip to content

Commit

Permalink
Autouse-pytester in test_pathlib
Browse files Browse the repository at this point in the history
  • Loading branch information
nicoddemus committed Feb 25, 2024
1 parent ffd19c9 commit 5cc0ee0
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions testing/test_pathlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,20 @@
import pytest


@pytest.fixture(autouse=True)
def autouse_pytester(pytester: Pytester) -> None:
"""
Fixture to make pytester() being autouse for all tests in this module.
pytester makes sure to restore sys.path to its previous state, and many tests in this module
import modules and change sys.path because of that, so common module names such as "test" or "test.conftest"
end up leaking to tests in other modules.
Note: we might consider extracting the sys.path restoration aspect into its own fixture, and apply it
to the entire test suite always.
"""


class TestFNMatcherPort:
"""Test our port of py.common.FNMatcher (fnmatch_ex)."""

Expand Down

0 comments on commit 5cc0ee0

Please sign in to comment.