Skip to content

Commit e3d7f66

Browse files
committed
test: clean up read-only submodule object files on Windows
The Windows Python 3.15 CI job failed to set up twelve missing-submodule cases because `shutil.rmtree()` cannot remove read-only loose Git objects. The fixture deliberately removes retained metadata to model an absent submodule, so use the existing `git.util.rmtree()` helper, which clears read-only attributes when retrying Windows deletions. All twelve affected cases pass locally, along with Ruff lint and format checks. Production behavior and test coverage are unchanged.
1 parent a1a84ae commit e3d7f66

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎test/test_submodule_no_fetch.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33

44
from functools import partial
55
from pathlib import Path
6-
import shutil
76
from unittest import mock
87

98
import pytest
109

1110
from git import Git, Remote, Repo, RootModule, Submodule
1211
from git.exc import GitCommandError
12+
from git.util import rmtree
1313

1414

1515
def _commit_file(repo, content):
@@ -60,7 +60,7 @@ def uninitialized_submodule(request, local_submodule):
6060
else:
6161
submodule.remove(configuration=False, force=True)
6262
# Removal retains recoverable metadata; remove it explicitly for this fixture.
63-
shutil.rmtree(metadata)
63+
rmtree(metadata)
6464
assert not submodule.module_exists()
6565
assert metadata.is_dir() == (request.param == "deinitialized")
6666
return submodule, metadata

0 commit comments

Comments
 (0)