Commit b8c0872
Add a test that fixture directories are usable by git
Many tests rely on git accepting their fixture directories -- the
GitPython working tree and the gitdb and smmap submodules used by
the test suite as submodule fixtures (gitdb providing the direct
submodule fixture and smmap, nested inside gitdb, providing the
nested-submodule fixture). 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 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`.
`test/test_fixture_health.py` 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 only inferable from the
cascade of downstream failures.
This commit adds the test only. On the Cygwin CI workflow as it
stands, the test fails for `[gitdb]` and passes for `[repo_root]`
and `[smmap]`. The asymmetry between the two submodules is
incidental to NTFS ownership inherited from `actions/checkout`'s
clone of the main tree; commit 4 (the fix) explains the mechanism in
detail. The forthcoming commits reproduce the bug across a
temporarily introduced large CI matrix and apply the fix.
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 7b83f7a commit b8c0872
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