tests: two Windows reds on main's check job (CI-MAIN-WINDOWS-TESTS)

test_gen_gdk_runtime_classes imported the POSIX-only resource module at the top, so the whole file failed to import on Windows. Import it guarded and skip the two failed-write tests that need RLIMIT_FSIZE.

test_make_game_plain_logs compared the child's getcwd() with the temp folder as strings; on the Windows runner the temp folder is an 8.3 short name (RUNNER~1) and getcwd() returns the long one. Compare with os.path.samefile.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
MoonEyes
2026-11-29 20:17:28 +01:00
parent dd87aa405a
commit 4ab5fdc5de
2 changed files with 12 additions and 2 deletions

View File

@ -2,7 +2,10 @@
import json
import os
from pathlib import Path
import resource
try:
import resource # POSIX only: the failed-write tests cap the child's file size with it
except ImportError:
resource = None
import signal
import subprocess
import sys
@ -32,7 +35,11 @@ def fail_after_bytes(limit: int):
return set_file_limit
NEEDS_RLIMIT = unittest.skipIf(resource is None, "needs POSIX resource limits (RLIMIT_FSIZE)")
class GenGdkRuntimeClassesTests(unittest.TestCase):
@NEEDS_RLIMIT
def test_failed_write_preserves_existing_file(self) -> None:
with tempfile.TemporaryDirectory() as tmp:
root = Path(tmp)
@ -52,6 +59,7 @@ class GenGdkRuntimeClassesTests(unittest.TestCase):
self.assertNotEqual(failed.returncode, 0, failed.stdout.decode(errors="replace"))
self.assertEqual(output.read_bytes(), original)
@NEEDS_RLIMIT
def test_failed_write_leaves_no_temporary_file(self) -> None:
with tempfile.TemporaryDirectory() as tmp:
root = Path(tmp)

View File

@ -151,7 +151,9 @@ class PlainStageLogsTest(unittest.TestCase):
make_game.run(child("import os; print(os.getcwd()); print(os.environ['LEONIDA_PLAIN_LOG_TEST'])"),
cwd=self.dir.name, env=env, text=True)
lines = self.read("pipelines")
self.assertEqual(os.path.normcase(lines[1]), os.path.normcase(os.path.realpath(self.dir.name)))
# samefile, not a string compare: on Windows the temp folder can be an 8.3 short name (RUNNER~1)
# while the child's getcwd() returns the long one.
self.assertTrue(os.path.samefile(lines[1], self.dir.name), (lines[1], self.dir.name))
self.assertEqual(lines[2], "from the caller")
def test_inactive_after_the_build_and_appends_like_the_board(self):