Skip to content

Commit 715e71d

Browse files
committed
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 28febdc commit 715e71d

3 files changed

Lines changed: 1231 additions & 1191 deletions

File tree

.github/workflows/ci.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,14 @@ jobs:
139139
fi
140140
141141
- name: Run per-addon unit tests
142+
# Filename convention (all OSes):
143+
# test_*.py — general (any OS)
144+
# test_linux_*.py — Linux-only
145+
# test_windows_*.py — Windows-only
146+
# test_integration_*.py — Linux-only, full-pipeline/DB-backed
147+
# The Linux job runs test_*.py except the Windows-only and
148+
# integration buckets. Integration tests run in their own job.
149+
#
142150
# shell: bash — the container's default shell is /bin/sh
143151
# (dash on python:3.12-slim), which does not support the
144152
# ${var//pattern/repl} and ${var%.py} parameter expansions
@@ -152,6 +160,7 @@ jobs:
152160
[ -f "$f" ] || continue
153161
case "$(basename "$f")" in
154162
test_integration*) continue ;;
163+
test_windows_*) continue ;;
155164
esac
156165
case "$f" in
157166
Sqlite/tests/test_sqlite.py) continue ;;
@@ -226,6 +235,8 @@ jobs:
226235
fi
227236
228237
- name: Run per-addon unit tests
238+
# See filename-convention note in unit-test-linux. The Windows
239+
# job runs test_*.py except test_linux_* and test_integration_*.
229240
env:
230241
PYTHONPATH: .
231242
run: |
@@ -234,6 +245,7 @@ jobs:
234245
[ -f "$f" ] || continue
235246
case "$(basename "$f")" in
236247
test_integration*) continue ;;
248+
test_linux_*) continue ;;
237249
esac
238250
case "$f" in
239251
Sqlite/tests/test_sqlite.py) continue ;;

0 commit comments

Comments
 (0)