diff --git a/tests/startup_run_ps1_check.py b/tests/startup_run_ps1_check.py index 69e2533996..e433579fd7 100644 --- a/tests/startup_run_ps1_check.py +++ b/tests/startup_run_ps1_check.py @@ -165,7 +165,13 @@ def run_case(shell, script, code, work, translate=False, switches=(), passed=(), startup.mkdir(parents=True) (startup / "run.ps1").write_bytes(script.encode("utf-8")) if real_log_error: - for name in ("debug_launch.py", "launch.py", "host_cpu.py", "hook_window.py", "window_capture.py"): + # Copy the real debugger and every local module it imports. A hard-coded list turns each new + # import into a ModuleNotFoundError here, which is how #3674 broke this control: the summary + # then reports the missing module instead of the error the case is about. + source = (RUN_PS1.parent / "debug_launch.py").read_text(encoding="utf-8") + local = {f"{name}.py" for name in re.findall(r"^(?:from|import)\s+([A-Za-z_]\w*)", source, re.M) + if (RUN_PS1.parent / f"{name}.py").is_file()} + for name in sorted(local | {"debug_launch.py"}): shutil.copyfile(RUN_PS1.parent / name, startup / name) else: (startup / "debug_launch.py").write_text(STUB.format(code=code, early_exit=early_exit, emit_stderr=emit_stderr), encoding="utf-8")