mirror of
https://github.com/elder-plinius/OBLITERATUS.git
synced 2026-08-18 00:47:23 +02:00
Cover legacy console fallbacks, platform temp paths, local UI disk probing, and lazy analysis exports. Bind the new local UI test to the executable source-to-test risk map.
71 lines
2.0 KiB
Python
71 lines
2.0 KiB
Python
"""Contracts for every documented lazy package export."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import subprocess
|
|
import sys
|
|
|
|
import pytest
|
|
|
|
import obliteratus
|
|
import obliteratus.analysis as analysis
|
|
|
|
|
|
@pytest.mark.parametrize(
|
|
"name",
|
|
[
|
|
"AbliterationPipeline",
|
|
"InformedAbliterationPipeline",
|
|
"save_contribution",
|
|
"load_contributions",
|
|
"aggregate_results",
|
|
"TourneyRunner",
|
|
"TourneyResult",
|
|
"get_adaptive_recommendation",
|
|
"AdaptiveRecommendation",
|
|
"RemoteRunner",
|
|
"RemoteConfig",
|
|
"Watchtower",
|
|
"get_watchtower",
|
|
"AutoObliterator",
|
|
],
|
|
)
|
|
def test_documented_lazy_export_resolves(name):
|
|
assert getattr(obliteratus, name) is not None
|
|
|
|
|
|
def test_unknown_lazy_export_raises_attribute_error():
|
|
with pytest.raises(AttributeError, match="has no attribute 'not_an_export'"):
|
|
getattr(obliteratus, "not_an_export")
|
|
|
|
|
|
def test_analysis_export_map_covers_the_documented_surface():
|
|
assert set(analysis._LAZY_IMPORTS) == set(analysis.__all__)
|
|
assert analysis.CrossLayerAlignmentAnalyzer.__name__ == "CrossLayerAlignmentAnalyzer"
|
|
assert "CrossLayerAlignmentAnalyzer" in dir(analysis)
|
|
|
|
|
|
def test_unknown_analysis_export_raises_attribute_error():
|
|
with pytest.raises(AttributeError, match="has no attribute 'not_an_export'"):
|
|
getattr(analysis, "not_an_export")
|
|
|
|
|
|
def test_importing_analysis_package_does_not_eagerly_import_torch():
|
|
probe = subprocess.run(
|
|
[
|
|
sys.executable,
|
|
"-c",
|
|
(
|
|
"import sys; import obliteratus.analysis as analysis; "
|
|
"assert 'torch' not in sys.modules; "
|
|
"assert not any(name.startswith('obliteratus.analysis.') "
|
|
"for name in sys.modules); "
|
|
"assert analysis.__all__"
|
|
),
|
|
],
|
|
check=False,
|
|
capture_output=True,
|
|
text=True,
|
|
)
|
|
assert probe.returncode == 0, probe.stderr
|