Commit d5fb280
Add a test that required submodules are initialized
This adds the new test, `test_required_submodule_is_initialized`, to
`test_fixture_health.py`. For the gitdb and smmap submodules, the test
asserts that the working tree directory exists and contains a `.git`
marker (file or directory). The failure message reminds the developer to
run `git submodule update --init --recursive`.
This is a regression test for a different contract than the preexisting
`test_fixture_dir_is_trusted_by_git` in `test_fixture_health.py`. That
test verifies git's willingness to operate in each fixture directory
(the `safe.directory` / dubious-ownership contract). This one verifies
that the directories are populated at all.
When the gitdb and smmap submodules aren't populated, the rest of the
suite fails in ways that don't name the cause: a cascade of failures
across `test_docs.py`, `test_repo.py`, and `test_submodule.py` -- tests
that need submodule content but don't set out to check for it. That
cascade was the failure mode of #1713 on the Arch Linux build, where
`init-tests-after-clone.sh` had stopped running `git submodule update`
on CI. Wherever the submodules are actually missing, this test reports
the missing path directly instead.
The test skips when the source tree is not a git clone (no `.git` at
`REPO_ROOT`). This is to accommodate 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) <[email protected]>1 parent fa0d9bc commit d5fb280
1 file changed
Lines changed: 58 additions & 18 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
12 | 12 | | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
| 13 | + | |
| 14 | + | |
25 | 15 | | |
26 | 16 | | |
27 | 17 | | |
| |||
45 | 35 | | |
46 | 36 | | |
47 | 37 | | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
48 | 51 | | |
49 | 52 | | |
50 | 53 | | |
| |||
89 | 92 | | |
90 | 93 | | |
91 | 94 | | |
| 95 | + | |
| 96 | + | |
| 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 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
0 commit comments