Simam3D-GPU / tests /test_app_gpu_boundary.py
junaid-simamdigital's picture
Decouple deterministic smoke from GPU quota
8a9129c verified
Raw History Blame Contribute Delete
825 Bytes
import ast
from pathlib import Path
def test_deterministic_export_bypasses_gpu_wrapper(tmp_path):
source = (Path(tmp_path) / "app.py").read_text(encoding="utf-8") if (Path(tmp_path) / "app.py").exists() else Path("app.py").read_text(encoding="utf-8")
tree = ast.parse(source)
functions = {node.name: node for node in tree.body if isinstance(node, (ast.FunctionDef, ast.AsyncFunctionDef))}
assert "_generate_impl" in functions
assert "_generate_gpu" in functions
assert "generate" in functions
gpu = functions["_generate_gpu"]
assert any(isinstance(dec, ast.Name) and dec.id == "GPU_FUNCTION" for dec in gpu.decorator_list)
public = functions["generate"]
assert any(isinstance(node, ast.If) and isinstance(node.test, ast.Name) and node.test.id == "demo_mode" for node in public.body)