@@ -27,16 +27,6 @@ def pytest_configure(config: pytest.Config) -> None:
2727 os .environ ["SOURCE_DATE_EPOCH" ] = "1234567890"
2828 os .environ ["SETUPTOOLS_SCM_DEBUG" ] = "1"
2929
30- # Register custom markers
31- config .addinivalue_line (
32- "markers" ,
33- "git: mark test to use git SCM" ,
34- )
35- config .addinivalue_line (
36- "markers" ,
37- "hg: mark test to use mercurial SCM" ,
38- )
39-
4030
4131VERSION_PKGS = ["setuptools" , "setuptools_scm" , "packaging" , "build" , "wheel" ]
4232
@@ -99,48 +89,30 @@ def debug_mode() -> Iterator[DebugMode]:
9989
10090
10191def setup_git_wd (wd : WorkDir , monkeypatch : pytest .MonkeyPatch | None = None ) -> WorkDir :
102- """Set up a WorkDir with git initialized and configured for testing."""
103- if monkeypatch :
104- monkeypatch .delenv ("HOME" , raising = False )
105- wd ("git init" )
106- wd (
"git config user.email [email protected] " )
107- wd ('git config user.name "a test"' )
108- wd .add_command = "git add ."
109- wd .commit_command = "git commit -m test-{reason}"
110- wd .tag_command = "git tag {tag}"
111- return wd
92+ """Set up a WorkDir with git initialized and configured for testing.
93+
94+ Note: This is a compatibility wrapper. Consider using wd.setup_git() directly.
95+ """
96+ return wd .setup_git (monkeypatch )
11297
11398
11499def setup_hg_wd (wd : WorkDir ) -> WorkDir :
115- """Set up a WorkDir with mercurial initialized and configured for testing."""
116- wd ("hg init" )
117- wd .add_command = "hg add ."
118- wd .commit_command = 'hg commit -m test-{reason} -u test -d "0 0"'
119- wd .tag_command = "hg tag {tag}"
120- return wd
100+ """Set up a WorkDir with mercurial initialized and configured for testing.
101+
102+ Note: This is a compatibility wrapper. Consider using wd.setup_hg() directly.
103+ """
104+ return wd .setup_hg ()
121105
122106
123107@pytest .fixture
124- def wd (
125- tmp_path : Path , request : pytest .FixtureRequest , monkeypatch : pytest .MonkeyPatch
126- ) -> WorkDir :
127- """WorkDir fixture that automatically configures SCM based on markers."""
108+ def wd (tmp_path : Path ) -> WorkDir :
109+ """Base WorkDir fixture that returns an unconfigured working directory.
110+
111+ Individual test modules should override this fixture to set up specific SCM configurations.
112+ """
128113 target_wd = tmp_path .resolve () / "wd"
129114 target_wd .mkdir ()
130- wd = WorkDir (target_wd )
131-
132- # Check for SCM markers on the test function or module
133- git_marker = request .node .get_closest_marker ("git" )
134- hg_marker = request .node .get_closest_marker ("hg" )
135-
136- # Configure SCM based on markers
137- if git_marker :
138- setup_git_wd (wd , monkeypatch )
139- elif hg_marker :
140- setup_hg_wd (wd )
141- # If no SCM markers, return unconfigured workdir
142-
143- return wd
115+ return WorkDir (target_wd )
144116
145117
146118@pytest .fixture (scope = "session" )
0 commit comments