| import ast |
| from pathlib import Path |
|
|
|
|
| def test_app_exposes_only_product_gpu_callback(): |
| source = Path("app.py").read_text(encoding="utf-8") |
| tree = ast.parse(source) |
| functions = {node.name for node in ast.walk(tree) if isinstance(node, ast.FunctionDef)} |
| assert "gpu_separate" in functions |
| assert "gpu_probe" not in functions |
| assert "SESA_DEBUG" not in source |
| assert "ACTIVE_PROBES" not in source |
| assert source.count("gr.Progress(track_tqdm=True)") == 1 |
| assert "status_update_rate=0.5" in source |
|
|
|
|
| def test_public_ui_has_no_probe_or_redundant_single_tab(): |
| source = Path("src/ui.py").read_text(encoding="utf-8") |
| assert "Probe & diagnostics" not in source |
| assert "active_probe_specs" not in source |
| assert "gr.Tabs(" not in source |
| assert "gr.Tab(" not in source |
| assert "1. Prepare / refresh plan" in source |
| assert "2. Separate prepared job" in source |
| assert "Retry incomplete Batch items" in source |
| assert "Stop after current Batch item" in source |
| assert "Prepared job plan (JSON)" in source |
| assert "Reproducibility record (JSON)" in source |
| assert 'label="Or use a public sample"' in source |
| assert 'value=""' in source |
|
|
|
|
| def test_public_source_has_no_diagnostic_modules(): |
| for name in ("probe.py", "probe_sources.py", "product_probe.py", "examples.py"): |
| assert not (Path("src") / name).exists() |
|
|
|
|
| def test_public_product_path_has_no_diagnostic_injection_hooks(): |
| preparation = Path("src/preparation.py").read_text(encoding="utf-8") |
| service = Path("src/service.py").read_text(encoding="utf-8") |
| assert "debug_probe" not in preparation |
| assert "debug_probe" not in service |
| assert "fail_once_input_index" not in service |
| assert "auto_cancel_after_completed_items" not in service |
| assert "Intentional v21" not in service |
| assert "def run_job(" not in service |
|
|
|
|
| def test_public_ui_constructs_with_expected_release_surface(): |
| from src.ui import build_demo |
|
|
| demo = build_demo(lambda *_args, **_kwargs: None) |
| config = demo.get_config_file() |
| components = config.get("components", []) |
| labels = [item.get("props", {}).get("label") for item in components] |
| types = [item.get("type") for item in components] |
| assert "tabs" not in types |
| assert "tabitem" not in types |
| assert "Audio or video files" in labels |
| assert "Curated models" in labels |
| assert "Time request mode" in labels |
| assert "Advanced Semi-auto calibration" in labels |
| assert "Or use a public sample" in labels |
| assert "Prepared job plan (JSON)" in labels |
| assert "Result ZIP" in labels |
| assert "Reproducibility record (JSON)" in labels |
| sample = next(item for item in components if item.get("props", {}).get("label") == "Or use a public sample") |
| assert sample.get("props", {}).get("value") == "" |
|
|