Commit fa0d9bc
Add a test that fixture directories are usable by git
Many tests rely on git accepting their fixture directories: the
GitPython repository itself, and the gitdb and smmap submodules used by
the test suite as direct and nested submodule fixtures. When git rejects
one for "dubious ownership" (typically because a CI workflow's
`safe.directory` list is missing an entry), three submodule-related
tests fail in opaque ways.
The exact failure type depends on which side of a race wins in the flush
to the cached `git cat-file --batch-check` subprocess:
- When Python wins, `ValueError` reaches the test directly.
- When git wins, `BrokenPipeError` is caught internally as `IOError` and
`iter_items` returns early.
Each test then fails on the empty-or-short result in its own way:
- `test_docs::Tutorials::test_submodules` indexes the empty
`sm.children()` list with `[0]` and raises `IndexError`.
- `test_repo::TestRepo::test_submodules` and
`test_submodule::TestSubmodule::test_root_module` see a length-1
(not length-2) submodule list from their recursive traversals and fail
their length assertion with `AssertionError`.
This commit adds `test/test_fixture_health.py`, which runs
`git rev-parse --show-toplevel` in each fixture directory and asserts
both that git is willing to operate there and that it reports the
directory as its own toplevel.
The failure message names `safe.directory` and ownership as the likely
causes, so a misconfigured environment is recognizable directly from the
test output rather than needing to be pieced together from a cascade of
failing tests not conceptually related to safe directory protections.
This adds the test only. Further replication and a fix are forthcoming.
On the Cygwin CI workflow now, the test fails for `[gitdb]` and passes
for `[repo_root]` and `[smmap]`. The asymmetry between the two
submodules relates to NTFS ownership inherited from `actions/checkout`'s
clone of the main tree.
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 9c5b57b commit fa0d9bc
1 file changed
Lines changed: 91 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
0 commit comments