-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtest_coverage_overall.py
More file actions
66 lines (55 loc) · 2.24 KB
/
test_coverage_overall.py
File metadata and controls
66 lines (55 loc) · 2.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/usr/bin/env python3
"""
Pre-flight coverage checks
Ensures public APIs across src/ can be imported and minimally exercised
without relying on prior pipeline steps.
"""
import importlib
import inspect
class TestCoverageOverall:
"""Importability and minimal invocation checks per module."""
def _smoke_functions(self, module_name: str, selectors: list[str]):
mod = importlib.import_module(module_name)
for sel in selectors:
if not hasattr(mod, sel):
continue
obj = getattr(mod, sel)
if callable(obj):
try:
sig = inspect.signature(obj)
except Exception: # nosec B112 -- intentional continue to skip uninspectable callables in test coverage
continue
# Call zero-arg functions only to avoid side effects
positional_required = [
p for p in sig.parameters.values()
if p.default is inspect._empty and p.kind in (p.POSITIONAL_ONLY, p.POSITIONAL_OR_KEYWORD)
]
if len(positional_required) == 0:
try:
obj()
except Exception:
# Tolerate failures for non-critical helpers
pass
def test_gnn_core_imports(self):
import gnn
assert hasattr(gnn, '__all__')
from gnn.core_processor import process_gnn_directory_lightweight
assert callable(process_gnn_directory_lightweight)
def test_audio_imports(self):
import audio
assert hasattr(audio, '__all__')
self._smoke_functions('audio', ['get_module_info'])
def test_export_imports(self):
import export
assert hasattr(export, '__all__')
self._smoke_functions('export', ['get_module_info'])
def test_visualization_imports(self):
import visualization
assert hasattr(visualization, '__all__')
self._smoke_functions('visualization', ['get_module_info'])
def test_llm_imports(self):
import llm
assert hasattr(llm, '__version__')
from llm import LLMAnalyzer, LLMProcessor
assert callable(LLMProcessor)
assert callable(LLMAnalyzer)