Commit ef28587
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
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| |||
316 | 317 | | |
317 | 318 | | |
318 | 319 | | |
319 | | - | |
320 | | - | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
321 | 323 | | |
322 | 324 | | |
323 | 325 | | |
| |||
361 | 363 | | |
362 | 364 | | |
363 | 365 | | |
364 | | - | |
| 366 | + | |
365 | 367 | | |
366 | 368 | | |
367 | 369 | | |
| |||
387 | 389 | | |
388 | 390 | | |
389 | 391 | | |
| 392 | + | |
| 393 | + | |
390 | 394 | | |
391 | 395 | | |
| 396 | + | |
392 | 397 | | |
393 | 398 | | |
394 | 399 | | |
| |||
0 commit comments