From e83294a8f155f725649014699d5050e17a48cc4a Mon Sep 17 00:00:00 2001 From: Dan Wolfson Date: Sat, 7 Nov 2026 21:39:32 +0000 Subject: [PATCH] test(analytic-registry): skip the registry-wide census under trellis-analytics < 0.4.0 egeria-trellis-analytics 0.3.1 registers entry points that predate declarations, so the registry-wide census failed whenever it was installed. test_every_registry_entry_is_declared now skips, naming the installed version, when egeria-trellis-analytics is older than 0.4.0. It still fails for any undeclared entry under 0.4.0 or later, or with no library installed, and test_every_builtin_is_declared still fails for any undeclared pyegeria built-in in every case. Micro-tests, Python 3.13: no library 1990 passed / 2 skipped; 0.3.1 2049 / 2; 0.4.0 2050 / 1. Signed-off-by: Dan Wolfson --- .../test_rs_w2_1a_routine_declarations.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/tests/micro-tests/test_rs_w2_1a_routine_declarations.py b/tests/micro-tests/test_rs_w2_1a_routine_declarations.py index af1c26ef..86f3855d 100644 --- a/tests/micro-tests/test_rs_w2_1a_routine_declarations.py +++ b/tests/micro-tests/test_rs_w2_1a_routine_declarations.py @@ -3,6 +3,7 @@ """RS-W2-1a: every registered routine declares its results -- measures with unit and as-of, the four nothing_found-vocabulary absence sentences and an `out` field list -- and the model mirrors the trellis-analytics ยง5 vocabulary (population, completeness, fields).""" +import re import warnings import pytest @@ -152,8 +153,24 @@ def test_every_builtin_is_declared(): assert undeclared == [] +def _trellis_analytics_version(): + """The installed egeria-trellis-analytics version as a tuple, or None when it is not installed.""" + from importlib.metadata import PackageNotFoundError, version + try: + raw = version("egeria-trellis-analytics") + except PackageNotFoundError: + return None + return raw, tuple(int(p) for p in re.findall(r"\d+", raw)[:3]) + + def test_every_registry_entry_is_declared(): - """The census over the whole registry, entry points included: each has a declaration.""" + """The census over the whole registry, entry points included: each has a declaration. + egeria-trellis-analytics before 0.4.0 registers entry points that predate declarations, so + the census is skipped there; the built-ins are still checked by test_every_builtin_is_declared.""" + installed = _trellis_analytics_version() + if installed is not None and installed[1] < (0, 4, 0): + pytest.skip(f"egeria-trellis-analytics {installed[0]} is installed; its entry points predate " + "declarations (0.4.0 adds them)") undeclared = sorted(name for name, spec in get_analytic_registry().items() if spec.declaration is None) assert undeclared == []