Skip to content

Commit 146b9c3

Browse files
authored
CI: cherry-pick shell:bash + OS-split test filename convention from PR 820 (#12)
* CI: add shell: bash to unit-test-linux + integration-test steps Root cause of "Unit Tests (Linux)" and "Integration Tests (Gramps)" failures was not broken test modules — the steps never invoked unittest. The container's default shell is /bin/sh (dash on python:3.12-slim), and the inline scripts use bash-only parameter expansions (${f%.py}, ${mod//\//.}) to build the dotted module list. Dash fails with "Bad substitution" on the first such line; the rest of the script never runs. continue-on-error: true masked this as a generic job failure for two CI rounds. Add "shell: bash" explicitly to: - unit-test-linux / Run per-addon unit tests (bashisms) - integration-test / Run per-addon integration tests (bashisms) - integration-test / Run plugin registration tests (no bashisms today, but consistent and future-proof) Compile Check already sets shell: bash. Windows jobs inherit bash via defaults.run at the job level. No other steps affected. * CI: split OS-specific addon tests via filename convention The Windows unit-test job hung on TMGimporter's DB-backed tests because make_database("sqlite").load(":memory:", None) deadlocks under the conda-forge GTK + pip Gramps combination. Rather than patch the hang, introduce a filename convention so per-addon authors can declare OS scope up front: test_*.py general (every OS) test_linux_*.py Linux-only test_windows_*.py Windows-only test_integration_*.py Linux-only, full-pipeline/DB-backed (pre-existing) unit-test-linux skips test_windows_* and test_integration_*; unit-test-windows skips test_linux_* and test_integration_*. Applied to TMGimporter: the 13 DB-backed classes in tests/test_libtmg.py move to tests/test_linux_libtmg.py (along with the _Rec/_table/_make_db/ _add_person/_MockUser helpers they use). The 7 pure-logic classes (TestStripTmgCodes, TestTmgDateToGrampsDate, TestNumTo{Month,Date}, TestParseDate, TestRepoTypeFromName, TestUrlFromName) stay in test_libtmg.py and will run on every OS. Locally all 175 tests still pass via run-addon-unit.sh TMGimporter.
1 parent 774a9ac commit 146b9c3

3 files changed

Lines changed: 1244 additions & 1191 deletions

File tree

.github/workflows/ci.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,19 @@ jobs:
101101
- uses: actions/checkout@v4
102102

103103
- name: Run per-addon unit tests
104+
# Filename convention (all OSes):
105+
# test_*.py — general (any OS)
106+
# test_linux_*.py — Linux-only
107+
# test_windows_*.py — Windows-only
108+
# test_integration_*.py — Linux-only, full-pipeline/DB-backed
109+
# The Linux job runs test_*.py except the Windows-only and
110+
# integration buckets. Integration tests run in their own job.
111+
#
112+
# shell: bash — the container's default shell is /bin/sh
113+
# (dash on python:3.12-slim), which does not support the
114+
# ${var//pattern/repl} and ${var%.py} parameter expansions
115+
# used below. Falls silently under continue-on-error.
116+
shell: bash
104117
env:
105118
PYTHONPATH: .
106119
run: |
@@ -109,6 +122,7 @@ jobs:
109122
[ -f "$f" ] || continue
110123
case "$(basename "$f")" in
111124
test_integration*) continue ;;
125+
test_windows_*) continue ;;
112126
esac
113127
case "$f" in
114128
Sqlite/tests/test_sqlite.py) continue ;;
@@ -153,6 +167,8 @@ jobs:
153167
python -c "import gramps, gi; print('deps OK')"
154168
155169
- name: Run per-addon unit tests
170+
# See filename-convention note in unit-test-linux. The Windows
171+
# job runs test_*.py except test_linux_* and test_integration_*.
156172
env:
157173
PYTHONPATH: .
158174
run: |
@@ -161,6 +177,7 @@ jobs:
161177
[ -f "$f" ] || continue
162178
case "$(basename "$f")" in
163179
test_integration*) continue ;;
180+
test_linux_*) continue ;;
164181
esac
165182
case "$f" in
166183
Sqlite/tests/test_sqlite.py) continue ;;
@@ -190,11 +207,19 @@ jobs:
190207
- uses: actions/checkout@v4
191208

192209
- name: Run plugin registration tests
210+
# shell: bash for consistency with the surrounding steps; the
211+
# current command uses no bashisms, but keeps this block safe
212+
# against future edits. Container default is /bin/sh → dash.
213+
shell: bash
193214
env:
194215
PYTHONPATH: .
195216
run: python3 -m unittest discover -s tests -p "test_*.py" -t . -v
196217

197218
- name: Run per-addon integration tests
219+
# shell: bash — see unit-test-linux for rationale; the
220+
# ${var//pattern/repl} and ${var%.py} expansions below are
221+
# bash-only.
222+
shell: bash
198223
env:
199224
PYTHONPATH: .
200225
run: |

0 commit comments

Comments
 (0)