Commit 76ceb4e
Add a check that required submodules are initialized
Adds test_required_submodule_is_initialized to test/test_fixture_health.py.
For each of the gitdb and smmap submodule working trees -- anchored at
the GitPython source tree, since submodule paths are recorded in
.gitmodules and are properties of the source tree itself -- asserts
that the working tree directory exists and contains a .git marker
(file or directory). Failure prints an actionable message naming
init-tests-after-clone.sh as the remedy.
This is a regression test for a different contract than the existing
test_fixture_dir_is_trusted_by_git in this module. That test verifies
git's willingness to operate in each fixture directory (the
safe.directory / dubious-ownership contract). The new test verifies
that the directories are populated at all (the init-tests-after-clone.sh
contract). A bug class along these lines affected Arch Linux in gitpython-developers#1713
when init-tests-after-clone.sh stopped running git submodule update on
CI -- if a similar regression returns, this test catches it loudly with
a message naming the cause, instead of producing a cascade of opaque
downstream failures.
The test skips when the source tree is not a git clone (no .git at
REPO_ROOT). This accommodates setups that run pytest from an extracted
release tarball and prepare submodules in a separately-pointed tree
via GIT_PYTHON_TEST_GIT_REPO_BASE (e.g. OpenIndiana's package build):
in such setups, `git submodule update` cannot operate on the source
tree, and the submodule paths checked here would never be populated
there -- but the test suite still works because rorepo points
elsewhere.
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 9748215 commit 76ceb4e
1 file changed
Lines changed: 42 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
43 | 56 | | |
44 | 57 | | |
45 | 58 | | |
| |||
82 | 95 | | |
83 | 96 | | |
84 | 97 | | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
0 commit comments