from __future__ import annotations import importlib.util from pathlib import Path SCRIPT = Path(__file__).parents[2] / "scripts" / "run_belgium_building_training_loop.py" SPEC = importlib.util.spec_from_file_location("training_loop", SCRIPT) assert SPEC and SPEC.loader MODULE = importlib.util.module_from_spec(SPEC) SPEC.loader.exec_module(MODULE) def test_training_command_is_cuda_deterministic_and_bound_to_frozen_inputs(tmp_path: Path) -> None: command = MODULE.training_command( "yolo", model=tmp_path / "base.pt", data=tmp_path / "dataset.yaml", project=tmp_path / "runs", name="iteration-001", epochs=160, seed=42, batch=2, workers=4, ) assert command[:2] == ["yolo", "train"] assert "device=0" in command assert "deterministic=True" in command assert "seed=42" in command assert "epochs=160" in command assert f"data={tmp_path / 'dataset.yaml'}" in command