test: Simplify submodule path simulation and verify metadata removal · gitpython-developers/GitPython@ef28587 · GitHub
Skip to content

Commit ef28587

Browse files
committed
test: Simplify submodule path simulation and verify metadata removal
The Python 3.7 Windows path simulation wrapped the entire os.path module in Mock. On Windows, all six simulated removal cases hit sharing violations that the default error handling converted into skipped tests. Use a SimpleNamespace copy of the path module and replace only realpath with abspath. Patch only the submodule module's osp binding so pathlib keeps its own resolver and other path operations remain ordinary calls. This retains Python 3.7 compatibility and allows the removal cases to run successfully without Windows permission-error suppression. Before removing a submodule, resolve and verify its metadata directory, then assert that removal deletes it as well as the checkout. Checking only the checkout could miss metadata left behind through a directory symlink. Validation: all 57 focused submodule compatibility and process-cleanup tests passed on Windows with Python 3.10 and HIDE_WINDOWS_KNOWN_ERRORS=0. Ruff 0.16.5 lint and formatting checks and git diff --check passed. Native Python 3.7 was unavailable; its realpath behavior is simulated.
1 parent 2bfd829 commit ef28587

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

test/test_submodule.py

Lines changed: 8 additions & 3 deletions

0 commit comments

Comments
 (0)