fix: repair broken imports in OntoRAG query module

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.
This commit is contained in:
cybermaggedon 2026-05-26 13:11:20 +01:00
parent c10f2694a0
commit b099d6dedb
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():