tests: copy every local import of the debug launcher into the run.ps1 control #3703

Manually merged
github merged 1 commit from github-bot/gh-3701 into main 2026-12-01 11:23:13 +00:00 AGit
Owner

@⁠KelboLive on GitHub · 2026-12-01 04:43 UTC · original
KelboLive:tests/run-ps1-local-imports → main · +7 −1 · 1 files · 1 commits · merged 2026-12-01 11:21 UTC

Change

The real_log_error control of startup_run_ps1 copies the real debug_launch.py into a scratch tree,
then makes log/events.txt a directory so the launcher raises PermissionError and the check looks for that
text in the captured summary. The modules it copied alongside were a hard-coded list:

for name in ("debug_launch.py", "launch.py", "host_cpu.py", "hook_window.py", "window_capture.py"):

#3676 (58352a682) added an import to the launcher:

tools/startup/debug_launch.py:37: from stall_watch import StallWatch  # noqa: E402

and did not update that list. The copied launcher therefore dies at import with ModuleNotFoundError, before
it reaches events.txt; the exit code is still 1, so the exit-code half of the control passes, and the
summary half fails:

FAIL powershell: real debugger log error was not captured in the summary
FAIL pwsh: real debugger log error was not captured in the summary

Fix

Copy every local module debug_launch.py imports, derived from the file itself, instead of a list that has to
be maintained by hand — so the next import addition cannot break this control the same way.

Verification

In-box dev preset, daddf6155:

before: startup_run_ps1  ***Failed  17.00 s
after:  startup_run_ps1   Passed   17.90 s, 17.09 s

startup_run_sh      ***Skipped (no bash)
startup_run_preset   Passed

The powershell and pwsh cases both pass, which is what distinguishes this from an environment problem:
the failure was Python import resolution inside the copied tree, identical on both shells.

Refs #3676.

**@⁠KelboLive** on GitHub · 2026-12-01 04:43 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3701) `KelboLive:tests/run-ps1-local-imports` → `main` · +7 −1 · 1 files · 1 commits · merged 2026-12-01 11:21 UTC ## Change The `real_log_error` control of `startup_run_ps1` copies the real `debug_launch.py` into a scratch tree, then makes `log/events.txt` a directory so the launcher raises `PermissionError` and the check looks for that text in the captured summary. The modules it copied alongside were a hard-coded list: ```python for name in ("debug_launch.py", "launch.py", "host_cpu.py", "hook_window.py", "window_capture.py"): ``` #3676 (`58352a682`) added an import to the launcher: ```python tools/startup/debug_launch.py:37: from stall_watch import StallWatch # noqa: E402 ``` and did not update that list. The copied launcher therefore dies at import with `ModuleNotFoundError`, before it reaches `events.txt`; the exit code is still 1, so the exit-code half of the control passes, and the summary half fails: ``` FAIL powershell: real debugger log error was not captured in the summary FAIL pwsh: real debugger log error was not captured in the summary ``` ## Fix Copy every local module `debug_launch.py` imports, derived from the file itself, instead of a list that has to be maintained by hand — so the next import addition cannot break this control the same way. ## Verification In-box dev preset, `daddf6155`: ``` before: startup_run_ps1 ***Failed 17.00 s after: startup_run_ps1 Passed 17.90 s, 17.09 s startup_run_sh ***Skipped (no bash) startup_run_preset Passed ``` The `powershell` and `pwsh` cases both pass, which is what distinguishes this from an environment problem: the failure was Python import resolution inside the copied tree, identical on both shells. Refs #3676.
The real_log_error control copies debug_launch.py plus a hard-coded list of local modules into a
scratch tree. #3674 (58352a682) added 'from stall_watch import StallWatch' to debug_launch.py and
did not update that list, so the copied launcher died with ModuleNotFoundError before reaching the
events.txt open. The control then reported that the debugger log error was not captured, because the
summary held the missing module instead of the PermissionError it looks for.

Derive the list from debug_launch.py's own imports so the next addition cannot break the control the
same way.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-01 04:44:56 +00:00
github manually merged commit a89bb52641 into main 2026-12-01 11:23:13 +00:00
Author
Owner

@⁠R0Y00 on GitHub · 2026-12-01 11:21 UTC · original · approved these changes

Reviewed the temporary launcher fixture dependency discovery. Local startup_run_ps1 passed outside the sandbox, including the expected real launcher log error path.

**@⁠R0Y00** on GitHub · 2026-12-01 11:21 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3701#pullrequestreview-6130206134) · **approved these changes** Reviewed the temporary launcher fixture dependency discovery. Local startup_run_ps1 passed outside the sandbox, including the expected real launcher log error path.
This discussion has been locked. Commenting is limited to contributors.
No description provided.