Commit 9748215
Add a test that fixture directories are usable by git
Many tests rely on git accepting their fixture directories -- the
GitPython working tree and its gitdb and smmap submodule working
trees. 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 in the cached `git cat-file
--batch-check` subprocess's flush wins: when Python wins, `ValueError`
reaches the test directly; when git wins, `BrokenPipeError` is caught
internally as `IOError`, `iter_items` returns an empty list, and the
test fails downstream of that catch with `IndexError`
(`test_docs::Tutorials::test_submodules`) or `AssertionError`
(`test_repo::TestRepo::test_submodules` and
`test_submodule::TestSubmodule::test_root_module`). In neither case
does the test output point at the underlying cause.
`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
configured at this commit, the test fails for gitdb and smmap,
demonstrating the bug. The forthcoming commits reproduce the bug at
scale and apply the fix.
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent c7648c0 commit 9748215
1 file changed
Lines changed: 84 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 | + | |
0 commit comments