mirror of
https://github.com/elder-plinius/OBLITERATUS.git
synced 2026-12-06 11:04:06 +01:00
22 lines
925 B
Python
22 lines
925 B
Python
"""Static UI contracts for actionable GPU admission failures."""
|
|
|
|
from pathlib import Path
|
|
|
|
|
|
def test_obliterate_catches_admission_before_cuda_cleanup():
|
|
source = Path("app.py").read_text(encoding="utf-8")
|
|
obliterate = source.index("def obliterate(")
|
|
loading = source.index("_gpu_lifecycle.loading(model_id)", obliterate)
|
|
handler = source.index("except AdmissionError as exc:", loading)
|
|
cleanup = source.index("_clear_gpu(release_lifecycle=False)", handler)
|
|
|
|
assert obliterate < loading < handler < cleanup
|
|
block = source[loading:cleanup]
|
|
assert "exc.user_message()" in block
|
|
assert "exc.diagnostic_message()" in block
|
|
# The failed attempt releases its exclusive model slot (status leaves
|
|
# "obliterating") before the error is yielded.
|
|
rollback = block.index("_rollback_model_load(claim, exc)")
|
|
assert rollback < block.index("yield", rollback)
|
|
assert "return" in block
|