"""U11-6: documented launch lines must work without PYTHONPATH (align is not installed).""" import os import subprocess import sys import pytest REPO = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) SCRATCH = os.path.join(REPO, ".tmp", "audit_2026-10-14", "scratch_g6_eval_scripts") @pytest.mark.parametrize("script", ["pretrain", "supervise", "build_stageb_data"]) def test_script_help_runs_from_a_foreign_cwd_without_pythonpath(script): os.makedirs(SCRATCH, exist_ok=True) env = {k: v for k, v in os.environ.items() if k != "PYTHONPATH"} env["CUDA_VISIBLE_DEVICES"] = "" r = subprocess.run( [sys.executable, "-B", os.path.join(REPO, "scripts", f"{script}.py"), "--help"], cwd=SCRATCH, env=env, capture_output=True, text=True, timeout=120, ) assert "No module named 'align'" not in r.stderr, r.stderr assert r.returncode == 0, r.stderr