Make Python unittest suite pass on Windows #3

Merged
Batushn merged 1 commit from upstream-pr/3 into main 2026-11-23 20:20:59 +00:00
Batushn commented 2026-11-23 20:06:00 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by Batushn on 2026-11-23T20:06:00Z.


Summary

Make python -m unittest discover -s tests pass cleanly on Windows hosts (from 2 failures + 7 errors down to 0 failures / 0 errors), matching the existing @unittest.skipUnless(sys.platform == "linux", ...) convention already used in tests/test_shader_prep.py and tests/test_pipeline_prep.py:

  • tests/test_runtime_shader_links.py: Gate RuntimeShaderLinks with @unittest.skipUnless(sys.platform == "linux", ...) ? project_tuxbox.runtime_shaders uses Linux-only os.O_NONBLOCK, os.O_NOFOLLOW, ctypes.CDLL(None) (inotify_init1), and select.poll(), and the tests use os.mkfifo, #!/bin/sh, and 199-char .link request directory names that exceed Windows MAX_PATH.
  • tests/test_backend_log.py: Gate only test_proton_raw_log_arrives_live_and_drains_final_bytes with @unittest.skipUnless(sys.platform == "linux", ...) because it relies on POSIX unlink-while-open semantics (path.unlink() while _follow() holds an open handle on the prior steam-default.log). The remaining 5 tests in BackendDiagnostics continue to run on Windows.
  • tests/test_host.py:
    • Gate only test_linux_title_drive_uses_prefix_and_preserves_existing_assignment with @unittest.skipUnless(sys.platform == "linux", ...) because it checks POSIX 0o700 mode bits and creates a dosdevices/t: symlink (: is invalid in Windows filenames).
    • Use a POSIX mocked layer path ("/tuxbox/build/frosty-cbv-layer") in test_direct_stock_launch_preserves_user_settings_and_host_environment, where console_cbv_layer is already mocked and the surrounding env vars already use POSIX paths ("/user/layers", "/user/mount"). Previously self.layer carried a Windows drive letter (C:\...), whose : collided with console_cbv.prepend() splitting VK_LAYER_PATH on : during the idempotence check. With this change, all 4 tests in ConsoleConstantBuffers continue to run and pass on both Linux and Windows.

Verification

  • python -m unittest discover -s tests -v on Windows (Python 3.12.10):
    • Before: Ran 87 tests ? FAILED (failures=2, errors=7, skipped=14)
    • After: Ran 87 tests ? OK (skipped=22)

(Disclosure: assisted by an AI coding agent; all changes were reviewed and verified locally.)

<!-- greyfinch-sync:brcly/TuxBox:issue:6567785543 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/3). Originally posted by [Batushn](https://github.com/Batushn) on 2026-11-23T20:06:00Z. --- ## Summary Make `python -m unittest discover -s tests` pass cleanly on Windows hosts (from 2 failures + 7 errors down to 0 failures / 0 errors), matching the existing `@unittest.skipUnless(sys.platform == "linux", ...)` convention already used in `tests/test_shader_prep.py` and `tests/test_pipeline_prep.py`: - **`tests/test_runtime_shader_links.py`**: Gate `RuntimeShaderLinks` with `@unittest.skipUnless(sys.platform == "linux", ...)` ? `project_tuxbox.runtime_shaders` uses Linux-only `os.O_NONBLOCK`, `os.O_NOFOLLOW`, `ctypes.CDLL(None)` (`inotify_init1`), and `select.poll()`, and the tests use `os.mkfifo`, `#!/bin/sh`, and 199-char `.link` request directory names that exceed Windows `MAX_PATH`. - **`tests/test_backend_log.py`**: Gate only `test_proton_raw_log_arrives_live_and_drains_final_bytes` with `@unittest.skipUnless(sys.platform == "linux", ...)` because it relies on POSIX unlink-while-open semantics (`path.unlink()` while `_follow()` holds an open handle on the prior `steam-default.log`). The remaining 5 tests in `BackendDiagnostics` continue to run on Windows. - **`tests/test_host.py`**: - Gate only `test_linux_title_drive_uses_prefix_and_preserves_existing_assignment` with `@unittest.skipUnless(sys.platform == "linux", ...)` because it checks POSIX `0o700` mode bits and creates a `dosdevices/t:` symlink (`:` is invalid in Windows filenames). - Use a POSIX mocked layer path (`"/tuxbox/build/frosty-cbv-layer"`) in `test_direct_stock_launch_preserves_user_settings_and_host_environment`, where `console_cbv_layer` is already mocked and the surrounding env vars already use POSIX paths (`"/user/layers"`, `"/user/mount"`). Previously `self.layer` carried a Windows drive letter (`C:\...`), whose `:` collided with `console_cbv.prepend()` splitting `VK_LAYER_PATH` on `:` during the idempotence check. With this change, all 4 tests in `ConsoleConstantBuffers` continue to run and pass on both Linux and Windows. ## Verification - `python -m unittest discover -s tests -v` on Windows (Python 3.12.10): - Before: `Ran 87 tests ? FAILED (failures=2, errors=7, skipped=14)` - After: `Ran 87 tests ? OK (skipped=22)` *(Disclosure: assisted by an AI coding agent; all changes were reviewed and verified locally.)*
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
brcly/TuxBox!3
No description provided.