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 17, 2024
1 parent e054ca6 commit b7bdb67
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 @@ -34,6 +34,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 b7bdb67

Please sign in to comment.