Skip to content

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

Merged
Andretuta merged 1 commit into
ProjectLeonida:mainfrom
fiestorra:carry/test-run-game-wine-windows-import
Nov 27, 2026
Merged

Andretuta merged 1 commit into
ProjectLeonida:mainfrom
fiestorra:carry/test-run-game-wine-windows-import

Conversation

@fiestorra

@fiestorra fiestorra commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

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

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 (Fix two repository checks that fail on main #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.

@DeadlyChirp

Copy link
Copy Markdown

Tested on Windows 11, Python 3.12.10. I merged 850db6f 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.)

@MoonEyes MoonEyes left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@fiestorra
fiestorra force-pushed the carry/test-run-game-wine-windows-import branch from 850db6f to 7489dbe Compare November 26, 2026 11:33
@fiestorra

Copy link
Copy Markdown
Contributor Author

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

Copy link
Copy Markdown
Contributor Author

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.

@Andretuta

Copy link
Copy Markdown
Collaborator

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.

@fiestorra

Copy link
Copy Markdown
Contributor Author

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
fiestorra force-pushed the carry/test-run-game-wine-windows-import branch from 7489dbe to 2bc5682 Compare November 27, 2026 07:52
@fiestorra

Copy link
Copy Markdown
Contributor Author

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

Copy link
Copy Markdown
Contributor Author

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.

@Andretuta
Andretuta merged commit 6601462 into ProjectLeonida:main Nov 27, 2026
6 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants