Skip to content

TMGimporter: skip real-DB import tests on Windows#930

Merged
GaryGriffin merged 1 commit into
gramps-project:maintenance/gramps61from
eduralph:fix/tmgimporter-windows-db-skip
Jun 3, 2026
Merged

TMGimporter: skip real-DB import tests on Windows#930
GaryGriffin merged 1 commit into
gramps-project:maintenance/gramps61from
eduralph:fix/tmgimporter-windows-db-skip

Conversation

@eduralph

Copy link
Copy Markdown
Contributor

Root cause

The import tests in TMGimporter/tests/test_libtmg.py drive a real in-memory
Gramps database (make_database + db.load) through the shared _make_db()
helper. On Windows the only Gramps available to CI comes from conda-forge, which
has no 6.1 yet and where Gramps 6.1 does not build (its Windows build targets
MSYS2 UCRT64, not conda); run against that mismatched Gramps the real-DB import
path hangs. The Windows CI lane that surfaces this is the one introduced by
#820.

Fix

Raise unittest.SkipTest from _make_db() when sys.platform == "win32". Every
real-DB test obtains its database through this single helper (all 43 db
creations route through it), so the 13 DB-backed classes skip in one place. The
pure-function tests (code stripping, date conversion, name parsing) do not call
_make_db() and continue to run on Windows.

Verified against

  • TMGimporter/tests/test_libtmg.py_make_db() is the sole make_database
    call site; confirmed every DB-backed class reaches the database only through
    it, so one guard covers them all.
  • Linux: the full suite runs unchanged — 157 tests pass.
  • Windows path (with sys.platform forced to win32): 95 tests skip, 62 run
    and pass, and the module is not all-skipped (the pure-function classes keep
    running), so a skip-detecting runner does not mistake it for an empty module.

Test

This change is itself in the test suite. Pre-change, the Windows lane added by
#820 hangs in import_* against the mismatched Gramps; post-change it skips the
real-DB tests cleanly. Validated on that lane (gramps61): the module reports
157 tests, 95 skipped, 0 broke in ~5 min (previously an indefinite hang), with
the Linux run unaffected. The skip self-heals once Gramps 6.1 reaches conda-forge
and the Windows lane runs the matching Gramps.

The import tests drive a real in-memory Gramps database (make_database +
db.load) through the shared _make_db() helper. On the Windows CI lane the
only available Gramps is from conda-forge, which has no 6.1 yet, and Gramps
6.1 does not build in the conda env (its Windows build targets MSYS2
UCRT64, not conda). Run against that mismatched Gramps the real-DB import
path hangs.

Raise unittest.SkipTest from _make_db() on win32 so all 13 DB-backed test
classes skip in one place; the pure-function tests (code stripping, date
conversion, name parsing) do not call _make_db() and continue to run on
Windows. On Linux every test runs unchanged (157 pass). Verified the
Windows path with sys.platform forced to win32: 95 tests skip, 62 run and
pass, the module is not all-skipped.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@eduralph

Copy link
Copy Markdown
Contributor Author

I will have to see how to address this issue once the CI process has landed.

@eduralph eduralph marked this pull request as ready for review May 29, 2026 22:53
@GaryGriffin

Copy link
Copy Markdown
Member

Is there a MacOS lane for CI?

@eduralph

Copy link
Copy Markdown
Contributor Author

@GaryGriffin - I looked into that and didn't bother so far because we can't build a ui test and there's a heavy overlap with linux on the unit test level. I can add if you like - gramps does have one for mac specfic tests

@jralls

jralls commented May 30, 2026

Copy link
Copy Markdown
Member

I think I'd need to build an installation tarball of the dependencies. It would take forever to build everything from scratch and I don't know if Homebrew has everything we need.

@GaryGriffin GaryGriffin merged commit 2e0fc61 into gramps-project:maintenance/gramps61 Jun 3, 2026
@eduralph eduralph deleted the fix/tmgimporter-windows-db-skip branch June 7, 2026 16:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants