Skip to content

Commit b6bed7d

Browse files
fix(tests): scope submodule fixture to module, restore env after tests
1 parent 0df0349 commit b6bed7d

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

tests/test_vcs.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -205,17 +205,20 @@ def test_remote_clone_recovers_from_corrupt_mirror(
205205
assert Path(dst2, "README.md").read_text() == "hello world"
206206

207207

208-
@pytest.fixture(scope="session", autouse=True)
208+
@pytest.fixture(scope="module", autouse=True)
209209
def allow_file_submodules() -> None:
210210
"""Allow the fixture repos below to be used as submodules.
211211
212212
Since Git 2.38.1 the file protocol is blocked for submodules by default
213213
(see GHSA-3wp6-j8xr-qw85), so local submodules require this setting. Set
214214
it via the environment so it also applies to Copier's own subprocesses.
215215
"""
216-
local.env["GIT_CONFIG_COUNT"] = "1"
217-
local.env["GIT_CONFIG_KEY_0"] = "protocol.file.allow"
218-
local.env["GIT_CONFIG_VALUE_0"] = "always"
216+
with local.env(
217+
GIT_CONFIG_COUNT="1",
218+
GIT_CONFIG_KEY_0="protocol.file.allow",
219+
GIT_CONFIG_VALUE_0="always",
220+
):
221+
yield
219222

220223

221224
def test_remote_clone_submodule_with_moved_url(

0 commit comments

Comments
 (0)