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.
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.