Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions tests/micro-tests/test_declarations_match_library.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

library = pytest.importorskip("trellis_analytics.declaration")

from pyegeria.view.analytic_registry import ROW_SHAPES, get_analytic_registry # noqa: E402
from pyegeria.view.analytic_registry import _BUILTINS, ROW_SHAPES # noqa: E402

#: Keys pyegeria declares that a library release may not know yet, by where they sit. Each is
#: dropped before validation only when the installed library's model has no such field, so a newer
Expand All @@ -39,7 +39,8 @@ def _fields(fields) -> list:
return [f.model_dump(exclude_defaults=True) for f in fields]


DECLARED = sorted((name, spec.declaration) for name, spec in get_analytic_registry().items()
#: pyegeria's own routines; entry points from the library declare in the library's own models.
DECLARED = sorted((name, spec.declaration) for name, spec in _BUILTINS.items()
if spec.declaration is not None)


Expand Down
4 changes: 2 additions & 2 deletions tests/micro-tests/test_issue_170_analytic_declaration.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
from pydantic import ValidationError

from pyegeria.view.analytic_registry import (
_BUILTINS,
AnalyticDeclaration,
AnalyticFunctionSpec,
analytic_registry_payload,
clear_runtime_analytic_functions,
get_analytic_registry,
register_analytic_functions,
)

Expand All @@ -32,7 +32,7 @@
def test_every_builtin_declares_its_results():
"""RS-W2-1a: every built-in now declares (asset_composition was the first, RS-W1-4); the field
itself stays optional for specs registered by others."""
assert all(spec.declaration is not None for spec in get_analytic_registry().values())
assert all(spec.declaration is not None for spec in _BUILTINS.values())
assert AnalyticFunctionSpec(name="x", function="pyegeria.view.overview_metrics.growth_series").declaration is None


Expand Down
14 changes: 12 additions & 2 deletions tests/micro-tests/test_rs_w2_1a_routine_declarations.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,18 +136,28 @@ def test_stale_and_term_routines_failure_is_unmeasured():
ABSENCE_STATES,
LEGACY_NOTHING_FOUND,
ROW_SHAPES,
_BUILTINS,
get_analytic_registry,
)

BUILTINS = get_analytic_registry()
#: pyegeria's own routines. The registry also holds entry points from installed packages
#: (egeria-trellis-analytics, for one), whose declarations are the library's models, so the
#: checks below that read pyegeria's declaration model run over the built-ins only.
BUILTINS = _BUILTINS
AS_OF = "2026-10-01T00:00:00+00:00"


def test_every_registry_entry_is_declared():
def test_every_builtin_is_declared():
undeclared = sorted(name for name, spec in BUILTINS.items() if spec.declaration is None)
assert undeclared == []


def test_every_registry_entry_is_declared():
"""The census over the whole registry, entry points included: each has a declaration."""
undeclared = sorted(name for name, spec in get_analytic_registry().items() if spec.declaration is None)
assert undeclared == []


def test_the_three_overview_routines_are_registered():
"""D6: the Overview depends on these, so they are routines, registered and declared."""
for name in ("count_relationships", "drl_readiness_gates", "solution_component_realisation"):
Expand Down
Loading