tests: import fcntl where it is used so test_run_game_wine loads on Windows (TEST-RUN-GAME-WINE-WINDOWS-IMPORT) #1876

Open
github-bot wants to merge 1 commit from github-bot/gh-1876 into main AGit
Owner

@⁠fiestorra on GitHub · 2026-11-25 13:52 UTC · original
fiestorra:carry/test-run-game-wine-windows-import → main · +4 −1 · 1 files · 1 commits · open

Claimed in the coordination issue as: TEST-RUN-GAME-WINE-WINDOWS-IMPORT (#1608)

What and why

tests/test_run_game_wine.py could not be imported on Windows: import fcntl sat at module level (line 14), and the file is one of the eight that the check job's python -I loop on windows-latest runs. The class already carries @unittest.skipIf(os.name == "nt" or not shutil.which("bash"), "a POSIX bash launcher"), but the skip cannot take effect when the import fails first, so the loop stopped on this file with ModuleNotFoundError: No module named 'fcntl'.

The change moves the import into the single test that uses it (test_a_held_lock_stops_a_second_run, which locks self.lock with fcntl.flock). That test is already gated by the class-level POSIX skip, so behaviour on Linux and macOS is unchanged. No test is disabled and no assertion is loosened.

This does not turn the whole Windows job green on its own: the other seven files the loop fails are covered by #1792 (three tools' repr'd paths), #1561 (the dead test_feature_scan test and compute_heap_layout_census), #1837 and #1789 (stdout guards), and the standing claims TEST-WINE-JOBS-TIMING-WINDOWS and CI-RUNTIME-PATHS-CONFORMANCE.

Tested

Windows 11, Windows Python 3.13.14, main a73a57e1, native (no Wine, no GPU):

  • Before: python -I tests/test_run_game_wine.py -> exit 1, Traceback ... line 14, in <module> / import fcntl / ModuleNotFoundError: No module named 'fcntl'.
  • After: python -I tests/test_run_game_wine.py -> Ran 9 tests in 0.000s / OK (skipped=9), exit 0; -v lists the nine skips with the class's reason, so the file is discovered and skipped rather than silently absent.
  • python -m compileall -q tests/test_run_game_wine.py -> exit 0.
  • Linux (WSL Ubuntu, Python 3.12.3): python3 -I tests/test_run_game_wine.py -> Ran 9 tests in 0.340s / OK, no skips, so the POSIX path this change moves the import into still runs all nine tests.
  • tests/test_runner_calls_all_tests.py still reports only the pre-existing test_feature_scan.py entry (#1561), nothing about this file.
  • check-no-game-data -> the tree is clean.

Not covered: macOS. The two gate jobs (change-scope, no-game-data) are queued, as the repository's queue has been for hours; no check has started.

GPUs tested: n/a

AI-assisted: yes (DeepSeek Harness).

Checklist

  • Based on current main (a73a57e1) and merges cleanly.
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (n/a: no translator change)

Written with an AI assistant.

**@⁠fiestorra** on GitHub · 2026-11-25 13:52 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1876) `fiestorra:carry/test-run-game-wine-windows-import` → `main` · +4 −1 · 1 files · 1 commits · open Claimed in the coordination issue as: TEST-RUN-GAME-WINE-WINDOWS-IMPORT (https://git.gtahub.st/github/ubiquitarianism--leonida/issues/1608) ### What and why `tests/test_run_game_wine.py` could not be imported on Windows: `import fcntl` sat at module level (line 14), and the file is one of the eight that the `check` job's `python -I` loop on `windows-latest` runs. The class already carries `@unittest.skipIf(os.name == "nt" or not shutil.which("bash"), "a POSIX bash launcher")`, but the skip cannot take effect when the import fails first, so the loop stopped on this file with `ModuleNotFoundError: No module named 'fcntl'`. The change moves the import into the single test that uses it (`test_a_held_lock_stops_a_second_run`, which locks `self.lock` with `fcntl.flock`). That test is already gated by the class-level POSIX skip, so behaviour on Linux and macOS is unchanged. No test is disabled and no assertion is loosened. This does not turn the whole Windows job green on its own: the other seven files the loop fails are covered by #1792 (three tools' repr'd paths), #1561 (the dead `test_feature_scan` test and `compute_heap_layout_census`), #1837 and #1789 (stdout guards), and the standing claims TEST-WINE-JOBS-TIMING-WINDOWS and CI-RUNTIME-PATHS-CONFORMANCE. ### Tested Windows 11, Windows Python 3.13.14, `main` `a73a57e1`, native (no Wine, no GPU): - **Before:** `python -I tests/test_run_game_wine.py` -> exit 1, `Traceback ... line 14, in <module> / import fcntl / ModuleNotFoundError: No module named 'fcntl'`. - **After:** `python -I tests/test_run_game_wine.py` -> `Ran 9 tests in 0.000s / OK (skipped=9)`, exit 0; `-v` lists the nine skips with the class's reason, so the file is discovered and skipped rather than silently absent. - `python -m compileall -q tests/test_run_game_wine.py` -> exit 0. - Linux (WSL Ubuntu, Python 3.12.3): `python3 -I tests/test_run_game_wine.py` -> `Ran 9 tests in 0.340s / OK`, no skips, so the POSIX path this change moves the import into still runs all nine tests. - `tests/test_runner_calls_all_tests.py` still reports only the pre-existing `test_feature_scan.py` entry (#1561), nothing about this file. - `check-no-game-data` -> the tree is clean. Not covered: macOS. The two gate jobs (`change-scope`, `no-game-data`) are queued, as the repository's queue has been for hours; no `check` has started. GPUs tested: n/a AI-assisted: yes (DeepSeek Harness). ### Checklist - [x] Based on current `main` (`a73a57e1`) and merges cleanly. - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [x] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (n/a: no translator change) Written with an AI assistant.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 10:09:34 +00:00
Author
Owner

@⁠DeadlyChirp on GitHub · 2026-11-25 15:16 UTC · original

Tested on Windows 11, Python 3.12.10. I merged 850db6f3e onto upstream main (merge commit f5e7e7e90).

  • With this PR, python -I tests/test_run_game_wine.py gives Ran 9 tests ... OK (skipped=9). The class-level skipIf(os.name == "nt" ...) now takes effect.
  • On main the module fails at import: ModuleNotFoundError: No module named 'fcntl' (line 14).

Works as intended on Windows.

(AI-assisted test run; output checked by hand.)

**@⁠DeadlyChirp** on GitHub · 2026-11-25 15:16 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1876#issuecomment-7166571904) Tested on Windows 11, Python 3.12.10. I merged 850db6f3e onto upstream main (merge commit f5e7e7e90). - With this PR, `python -I tests/test_run_game_wine.py` gives `Ran 9 tests ... OK (skipped=9)`. The class-level `skipIf(os.name == "nt" ...)` now takes effect. - On main the module fails at import: `ModuleNotFoundError: No module named 'fcntl'` (line 14). Works as intended on Windows. (AI-assisted test run; output checked by hand.)
Author
Owner

@⁠MoonEyes on GitHub · 2026-11-25 17:11 UTC · original · reviewed

Independent test report (Windows 11, Python 3.14, origin/main + PR head).

Verdict: LGTM
Ran tests/test_run_game_wine.py on Windows. origin/main: collection error (ModuleNotFoundError: No module named 'fcntl' at line 14), so the class-level POSIX skip never gets a chance to run. PR head: 9 skipped, no error.
The import is now local to test_a_held_lock_stops_a_second_run, which is already behind the class skip, so POSIX behaviour is unchanged. The comment explains why. I could not run the POSIX path here (no Wine/Linux), so that part is read-only.
AI-assisted: yes (Claude Code ran the tests; I read them).

**@⁠MoonEyes** on GitHub · 2026-11-25 17:11 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1876#pullrequestreview-6061829463) · **reviewed** Independent test report (Windows 11, Python 3.14, origin/main + PR head). Verdict: LGTM Ran tests/test_run_game_wine.py on Windows. origin/main: collection error (`ModuleNotFoundError: No module named 'fcntl'` at line 14), so the class-level POSIX skip never gets a chance to run. PR head: 9 skipped, no error. The import is now local to test_a_held_lock_stops_a_second_run, which is already behind the class skip, so POSIX behaviour is unchanged. The comment explains why. I could not run the POSIX path here (no Wine/Linux), so that part is read-only. AI-assisted: yes (Claude Code ran the tests; I read them).
github-bot force-pushed github-bot/gh-1876 from 850db6f3ee to 7489dbec01 2026-11-26 11:36:37 +00:00 Compare
Author
Owner

@⁠fiestorra on GitHub · 2026-11-26 12:09 UTC · original

Two independent Windows runs now agree on the same thing, on two Python versions, and both looked at the right failure mode.

  • DeadlyChirp, Windows 11 + Python 3.12.10, PR head merged onto main: python -I tests/test_run_game_wine.py gives Ran 9 tests ... OK (skipped=9), and main fails earlier, at import, with ModuleNotFoundError: No module named 'fcntl'.
  • MoonEyes, Windows 11 + Python 3.14, origin/main + PR head: main is a collection error at line 14, the PR head gives 9 skipped and no error; the review notes the import is now local to test_a_held_lock_stops_a_second_run, which is already behind the class-level skipIf(os.name == "nt"), so the POSIX path is untouched.

That is the whole claim of the change, and both of you checked the part that matters: the skip now takes effect instead of the module dying before it can.

What neither run covers, and nothing in this PR changes: the POSIX path itself (it needs Linux or Wine, as MoonEyes says). The change moves an import and records why; it does not touch a test that runs there.

Nothing to adjust on my side. Thank you both for taking the time - a single-file test fix is exactly the kind of change that is easy to get wrong for the platform nobody is sitting on.

Written with an AI assistant.

**@⁠fiestorra** on GitHub · 2026-11-26 12:09 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1876#issuecomment-7191642742) Two independent Windows runs now agree on the same thing, on two Python versions, and both looked at the right failure mode. - DeadlyChirp, Windows 11 + Python 3.12.10, PR head merged onto main: `python -I tests/test_run_game_wine.py` gives `Ran 9 tests ... OK (skipped=9)`, and main fails earlier, at import, with `ModuleNotFoundError: No module named 'fcntl'`. - MoonEyes, Windows 11 + Python 3.14, origin/main + PR head: main is a collection error at line 14, the PR head gives 9 skipped and no error; the review notes the import is now local to `test_a_held_lock_stops_a_second_run`, which is already behind the class-level `skipIf(os.name == "nt")`, so the POSIX path is untouched. That is the whole claim of the change, and both of you checked the part that matters: the skip now takes effect instead of the module dying before it can. What neither run covers, and nothing in this PR changes: the POSIX path itself (it needs Linux or Wine, as MoonEyes says). The change moves an import and records why; it does not touch a test that runs there. Nothing to adjust on my side. Thank you both for taking the time - a single-file test fix is exactly the kind of change that is easy to get wrong for the platform nobody is sitting on. Written with an AI assistant.
Author
Owner

@⁠fiestorra on GitHub · 2026-11-26 12:55 UTC · original

Third independent run, Windows and POSIX, and the body now matches

Windows 11 Pro 10.0.26300, Python 3.11.0, the head alone in a clean worktree: python -I tests/test_run_game_wine.py gives Ran 9 tests in 0.000s / OK (skipped=9), exit 0, and -v names all nine with the class reason. The same file as it stands on main still stops at line 14 with ModuleNotFoundError: No module named 'fcntl'.

The POSIX half is not read-only in this run: WSL Ubuntu 24.04.4, Python 3.12.3, the head runs all nine, OK, no skips, 0.353 s — so the moved import still reaches the lock test rather than leaving it dead code.

Scope: the file has exactly one fcntl use, flock at line 155, inside the test that now imports it, and the class-level POSIX skip covers it. The other fcntl sites in the tree are already local or guarded (tools/world_build.py with try/except ImportError, scripts/translate_pipeline_compute.py under os.name == "nt"), so this was the last unguarded module-level one.

Body refreshed: the base SHA is a73a57e1 (was 77baf9062) and the "no CI run yet" line now says what is true — the two gate jobs are queued, no check has started.

No open pull request touches this file. Nothing to change from my side.

Written with an AI assistant.

**@⁠fiestorra** on GitHub · 2026-11-26 12:55 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1876#issuecomment-7192645220) **Third independent run, Windows and POSIX, and the body now matches** Windows 11 Pro 10.0.26300, Python 3.11.0, the head alone in a clean worktree: `python -I tests/test_run_game_wine.py` gives `Ran 9 tests in 0.000s` / `OK (skipped=9)`, exit 0, and `-v` names all nine with the class reason. The same file as it stands on `main` still stops at line 14 with `ModuleNotFoundError: No module named 'fcntl'`. The POSIX half is not read-only in this run: WSL Ubuntu 24.04.4, Python 3.12.3, the head runs all nine, `OK`, no skips, 0.353 s — so the moved import still reaches the lock test rather than leaving it dead code. Scope: the file has exactly one `fcntl` use, `flock` at line 155, inside the test that now imports it, and the class-level POSIX skip covers it. The other `fcntl` sites in the tree are already local or guarded (`tools/world_build.py` with `try/except ImportError`, `scripts/translate_pipeline_compute.py` under `os.name == "nt"`), so this was the last unguarded module-level one. Body refreshed: the base SHA is `a73a57e1` (was `77baf9062`) and the "no CI run yet" line now says what is true — the two gate jobs are queued, no `check` has started. No open pull request touches this file. Nothing to change from my side. Written with an AI assistant.
Author
Owner

@⁠Andretuta on GitHub · 2026-11-27 06:24 UTC · original

I reproduced ModuleNotFoundError: No module named 'fcntl' on native Windows at main d1dff7949. With 7489dbec0 in the local CI integration, the test file loaded successfully and all nine POSIX-only cases skipped as intended under #2193's runner. This was a Windows-only check.

AI-assisted testing.

**@⁠Andretuta** on GitHub · 2026-11-27 06:24 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1876#issuecomment-7211502456) I reproduced `ModuleNotFoundError: No module named 'fcntl'` on native Windows at `main` `d1dff7949`. With `7489dbec0` in the local CI integration, the test file loaded successfully and all nine POSIX-only cases skipped as intended under #2193's runner. This was a Windows-only check. AI-assisted testing.
Author
Owner

@⁠fiestorra on GitHub · 2026-11-27 07:49 UTC · original

Thanks — that is the second independent Windows reproduction, and it matches

Your ModuleNotFoundError: No module named 'fcntl' on native Windows at main d1dff794 is the same failure the branch removes, and the file loading with all tests discovered at 7489dbec is the behaviour this PR is for. Nothing to change on my side.

For the record, the POSIX half was checked too (WSL Ubuntu 24.04, Python 3.12): the nine tests run and pass with no skips, so the import that moved is still reached by the test that uses it rather than being dead weight behind the class skip.

Written with an AI assistant.

**@⁠fiestorra** on GitHub · 2026-11-27 07:49 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1876#issuecomment-7212859940) **Thanks — that is the second independent Windows reproduction, and it matches** Your `ModuleNotFoundError: No module named 'fcntl'` on native Windows at `main` `d1dff794` is the same failure the branch removes, and the file loading with all tests discovered at `7489dbec` is the behaviour this PR is for. Nothing to change on my side. For the record, the POSIX half was checked too (WSL Ubuntu 24.04, Python 3.12): the nine tests run and pass with no skips, so the import that moved is still reached by the test that uses it rather than being dead weight behind the class skip. Written with an AI assistant.
github-bot force-pushed github-bot/gh-1876 from 7489dbec01 to 2bc5682a72 2026-11-27 07:56:07 +00:00 Compare
Author
Owner

@⁠fiestorra on GitHub · 2026-11-27 07:53 UTC · original

Rebased onto current main (d1dff7949), and here is why: the shared red jobs were not this diff, and the reason is now measured rather than assumed.

What the overnight CI drained to, on this branch and on the other three we have open: check cancelled, macos-python failed, translator-tests failed, stdlib-tests-linux failed.

  • macos-python fails on main too. Main's CI run 45905816073 has macos-python failure with the same shape (test_anim_skeleton_match.py: error: --out must not overwrite an input archive), so that job is red before any PR. Not ours and not fixable from here.
  • translator-tests passed on main and failed on these branches, which is the interesting one: the job asserts and llvm-mc answers dpp variant of this instruction is not supported. That support arrived in main after these branches' base - c5f180751 rdna2spirv: translate v_cmpx in DPP form (SHADER-VOPCX-DPP) and its review commit - so a branch based on a73a57e13 carries fixtures that its own translator cannot handle. Rebased onto d1dff7949, tests/semantic/test_dpp_compare.py and test_dpp_bound_ctrl_modifiers.py both run OK on the new head.

New head after the rebase: 2bc5682a7, MERGEABLE.

So: one red job is the repository's (macos-python), one was a stale base (translator-tests, now fixed), and the rest (linux-gpu-tools with the glslangValidator-less configure, windows with vk_xdxr_postbuild_readback, macos with the two fixtures other PRs own) are analysed in the thread above.

Written with an AI assistant.

**@⁠fiestorra** on GitHub · 2026-11-27 07:53 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1876#issuecomment-7212922046) Rebased onto current `main` (`d1dff7949`), and here is why: the shared red jobs were not this diff, and the reason is now measured rather than assumed. What the overnight CI drained to, on this branch and on the other three we have open: `check` cancelled, `macos-python` failed, `translator-tests` failed, `stdlib-tests-linux` failed. - **`macos-python` fails on `main` too.** Main's CI run `45905816073` has `macos-python failure` with the same shape (`test_anim_skeleton_match.py: error: --out must not overwrite an input archive`), so that job is red before any PR. Not ours and not fixable from here. - **`translator-tests` passed on `main` and failed on these branches**, which is the interesting one: the job asserts and `llvm-mc` answers `dpp variant of this instruction is not supported`. That support arrived in `main` after these branches' base - `c5f180751 rdna2spirv: translate v_cmpx in DPP form (SHADER-VOPCX-DPP)` and its review commit - so a branch based on `a73a57e13` carries fixtures that its own translator cannot handle. Rebased onto `d1dff7949`, `tests/semantic/test_dpp_compare.py` and `test_dpp_bound_ctrl_modifiers.py` both run **OK** on the new head. New head after the rebase: `2bc5682a7`, `MERGEABLE`. So: one red job is the repository's (`macos-python`), one was a stale base (`translator-tests`, now fixed), and the rest (`linux-gpu-tools` with the `glslangValidator`-less configure, `windows` with `vk_xdxr_postbuild_readback`, `macos` with the two fixtures other PRs own) are analysed in the thread above. Written with an AI assistant.
Author
Owner

@⁠fiestorra on GitHub · 2026-11-27 08:37 UTC · original

Third independent reproduction, and the one that names the base: main d1dff7949 (the current one) fails at import with ModuleNotFoundError: No module named 'fcntl', and with the change in place the file loads and the nine POSIX-only cases skip under #2193's runner. That is the same result DeadlyChirp and MoonEyes reported on 3.12.10 and 3.14, now on the newest main.

One detail worth having in the record: you tested 7489dbec0, which was this branch before today's rebase onto d1dff7949; the head is now 2bc5682a7 and the content of the change is identical - one import moved into the test that uses it, with a comment saying why. So your result applies to the current head too, but if you re-run and want a hash, that is the one.

What none of the three runs covers, and this change does not touch: the POSIX path itself. It moves an import and records the reason; it does not alter a test that runs on Linux or under Wine.

Written with an AI assistant.

**@⁠fiestorra** on GitHub · 2026-11-27 08:37 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1876#issuecomment-7213736515) Third independent reproduction, and the one that names the base: `main` `d1dff7949` (the current one) fails at import with `ModuleNotFoundError: No module named 'fcntl'`, and with the change in place the file loads and the nine POSIX-only cases skip under #2193's runner. That is the same result DeadlyChirp and MoonEyes reported on 3.12.10 and 3.14, now on the newest main. One detail worth having in the record: you tested `7489dbec0`, which was this branch before today's rebase onto `d1dff7949`; the head is now `2bc5682a7` and the content of the change is identical - one import moved into the test that uses it, with a comment saying why. So your result applies to the current head too, but if you re-run and want a hash, that is the one. What none of the three runs covers, and this change does not touch: the POSIX path itself. It moves an import and records the reason; it does not alter a test that runs on Linux or under Wine. Written with an AI assistant.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1876/head:github-bot/gh-1876'
git switch 'github-bot/gh-1876'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1876'
git switch 'github-bot/gh-1876'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1876'
git switch 'github-bot/gh-1876'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1876'
git switch 'main'
git merge --squash 'github-bot/gh-1876'
git switch 'main'
git merge --ff-only 'github-bot/gh-1876'
git switch 'main'
git merge 'github-bot/gh-1876'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.