Skip to content

Commit bdaf1dc

Browse files
codexByron
authored andcommitted
test(submodule): close retained parent before checkout removal
The Windows Python 3.14 job for PR #2274 failed in `TestSubmodule.test_base_rw` when forced module-only removal called `rmtree`: Windows reported `WinError 32` for `git/ext/gitdb`. The legacy test retains that checkout's `Repo` through `csm.repo` and starts its persistent `cat-file` process while reading parent commits. Closing only the fresh handle created by `Submodule.remove()` cannot release this caller-owned process. Close the retained test-owned parent before deleting its checkout. Keep strict removal and all existing happy-path assertions, and remove the obsolete commented-out skip that claimed removal ignored this error. The original test predates the PR's base, so record this as a follow-up rather than rewriting shared history. The focused `test_base_rw` passed locally with both CLI and Gix. Relevant pre-commit hooks passed. Hosted Windows validation remains part of the PR CI loop.
1 parent 6881712 commit bdaf1dc

1 file changed

Lines changed: 1 addition & 7 deletions

File tree

‎test/test_submodule.py‎

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1419,6 +1419,7 @@ def _do_base_tests(self, rwrepo):
14191419

14201420
# Now delete only the module of the main submodule.
14211421
assert sm.module_exists()
1422+
csm.repo.close()
14221423
sm.remove(configuration=False, force=True)
14231424
assert sm.exists()
14241425
assert not sm.module_exists()
@@ -1521,13 +1522,6 @@ def _do_base_tests(self, rwrepo):
15211522
True,
15221523
)
15231524

1524-
# ACTUALLY skipped by git.util.rmtree (in local onerror function), called via
1525-
# git.objects.submodule.base.Submodule.remove at "method(mp)", line 1011.
1526-
#
1527-
# @skipIf(sys.platform == "win32",
1528-
# "FIXME: fails with: PermissionError: [WinError 32] The process cannot access the file because"
1529-
# "it is being used by another process: "
1530-
# "'C:\\Users\\ankostis\\AppData\\Local\\Temp\\tmp95c3z83bnon_bare_test_base_rw\\git\\ext\\gitdb\\gitdb\\ext\\smmap'") # noqa: E501
15311525
@with_rw_repo(k_subm_current)
15321526
def test_base_rw(self, rwrepo):
15331527
self._do_base_tests(rwrepo)

0 commit comments

Comments
 (0)