fix: repair broken imports in OntoRAG query module (#950)

Replace hallucinated relative imports with correct absolute imports
across the ontology query package, and fix OntologyMatcher reference
to match the actual class name OntologyMatcherForQueries. Simplify
test to use standard imports instead of importlib hack.

Cosmetic, but simpler imports provides undeterministic imports in a dev
environment, and also means we're properly testing linkage
This commit is contained in:
cybermaggedon 2026-05-26 13:12:03 +01:00 committed by GitHub
parent c10f2694a0
commit 6d07310d2b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 16 additions and 33 deletions

View file

@ -2,27 +2,10 @@
Tests for ontology monitoring metrics.
"""
import importlib.util
import sys
from pathlib import Path
MODULE_PATH = (
Path(__file__).resolve().parents[3]
/ "trustgraph-flow"
/ "trustgraph"
/ "query"
/ "ontology"
/ "monitoring.py"
from trustgraph.query.ontology.monitoring import (
PerformanceMonitor,
_extract_metric_label,
)
spec = importlib.util.spec_from_file_location("ontology_monitoring", MODULE_PATH)
assert spec is not None and spec.loader is not None
monitoring = importlib.util.module_from_spec(spec)
sys.modules[spec.name] = monitoring
spec.loader.exec_module(monitoring)
PerformanceMonitor = monitoring.PerformanceMonitor
_extract_metric_label = monitoring._extract_metric_label
def test_extract_metric_label_reads_unquoted_label_value():