Skip to content

Commit fe9a87d

Browse files
eduralphclaude
andcommitted
tests: derive expected addon target version from Gramps install
`test_target_version_is_6_0` hardcoded "6.0" in the assertion and its name, so the same harness copied to maintenance/gramps61 (via the bootstrap commit 458ebd0) flagged every 6.1-targeted addon as mistargeted. Switch the prefix to ``f"{VERSION_TUPLE[0]}.{VERSION_TUPLE[1]}"``, read from the loaded ``gramps.version``, so the same test works on every maintenance branch — the CI image's Gramps install is always the series that branch's addons should target, which is exactly what we want to assert. Rename the method to ``test_target_version_matches_gramps_install`` to match the new semantics, and update the failure message to include the expected prefix instead of a fixed "6.0". Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 458ebd0 commit fe9a87d

1 file changed

Lines changed: 15 additions & 4 deletions

File tree

tests/test_plugin_registration.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
# Gramps modules
4646
# ------------------------
4747
from gramps.gen.plug._pluginreg import EXPORT, GRAMPLET, IMPORT, REPORT, TOOL
48+
from gramps.version import VERSION_TUPLE
4849

4950
# ------------------------
5051
# Gramps specific
@@ -127,14 +128,24 @@ def test_all_plugins_have_valid_metadata(self) -> None:
127128
self.assertTrue(pdata.name, f"Plugin {pdata.id} missing name")
128129
self.assertTrue(pdata.version, f"Plugin {pdata.id} missing version")
129130

130-
def test_target_version_is_6_0(self) -> None:
131-
"""All listed addons on this branch should target Gramps 6.0."""
131+
def test_target_version_matches_gramps_install(self) -> None:
132+
"""All listed addons must target the Gramps series they're running against.
133+
134+
The expected prefix is derived from the installed Gramps' version
135+
(``gramps.version.VERSION_TUPLE``), so the same assertion works on
136+
every maintenance branch — gramps60 expects "6.0", gramps61 expects
137+
"6.1", etc.
138+
"""
139+
expected_prefix = f"{VERSION_TUPLE[0]}.{VERSION_TUPLE[1]}"
132140
issues: list[str] = []
133141
for pdata in _get_addon_plugins(self.plugin_registry):
134-
if not pdata.gramps_target_version.startswith("6.0"):
142+
if not pdata.gramps_target_version.startswith(expected_prefix):
135143
issues.append(f"{pdata.id}: targets {pdata.gramps_target_version}")
136144
if issues:
137-
self.fail("Addons not targeting Gramps 6.0:\n" + "\n".join(issues))
145+
self.fail(
146+
f"Addons not targeting Gramps {expected_prefix}:\n"
147+
+ "\n".join(issues)
148+
)
138149

139150

140151
# ------------------------------------------------------------

0 commit comments

Comments
 (0)