From a45e77df1b0024707914a446aa89d33baa223787 Mon Sep 17 00:00:00 2001 From: Christophe Besson Date: Sun, 27 Sep 2026 22:21:26 +0200 Subject: test: make both suites pass on Windows MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Most of these failed on Windows for reasons that had nothing to do with the code under test, which is how real Windows defects hid among them: - Read and write files as UTF-8, and talk to Node in UTF-8. read_text(), write_text() and subprocess text=True use the locale codepage, cp1252 on Windows: "é", "—" and "→" arrived as "?" or crashed, some sixty tests. Calls to PowerShell and schtasks are left alone -- they answer in the console codepage. - Import ESM harness modules by file URL (as_uri): a raw "C:\..." path is not a module specifier. - test_cli_golden: mask the tmp path in its JSON-escaped form, spell it the POSIX way, record on Linux, mask the protocol version (the recording had failed everywhere since the MNP 4.0 bump) and argparse's version-dependent quoting; point USERPROFILE at the tmp home, or `member invite` and `operator pair` wrote their codes into the developer's profile. - test_disk_io_off_loop: expect what a free loop can reach on the platform's timer, 15.6 ms on Windows, not an assumed 5 ms. - test_root_paths_are_operator_only: expect the OS's spelling of the path. - test_audio_meta_cache: find ffprobe with shutil.which. Node suite on Windows: 1489 passed, none failed. Hub suite: 3 failures left, all older than this change (two SQLite concurrency tests, one transfer resume). Co-Authored-By: Claude Opus 5.5 --- packages/meshbay-hub/tests/test_spa_ordering.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'packages/meshbay-hub/tests/test_spa_ordering.py') diff --git a/packages/meshbay-hub/tests/test_spa_ordering.py b/packages/meshbay-hub/tests/test_spa_ordering.py index 087298f..fdedaf8 100644 --- a/packages/meshbay-hub/tests/test_spa_ordering.py +++ b/packages/meshbay-hub/tests/test_spa_ordering.py @@ -132,7 +132,7 @@ COMPONENT_FILES = { def _component(name: str) -> str: """The source of one top-level `function Name(...)`, up to the next one.""" - source = COMPONENT_FILES.get(name, APP).read_text() + source = COMPONENT_FILES.get(name, APP).read_text(encoding="utf-8") start = source.find(f"\nfunction {name}(") if start == -1: start = source.find(f"\nexport function {name}(") @@ -225,7 +225,7 @@ def test_the_uploader_keeps_several_chunks_in_flight(): def test_no_caller_waits_for_one_chunk_at_a_time(): - app = APP.read_text() + app = APP.read_text(encoding="utf-8") assert "uploadChunk(" not in app, ( "a per-chunk await is back in the SPA; use transport.uploadFile()") @@ -248,7 +248,7 @@ def test_leaving_a_group_hands_the_transport_over_rather_than_closing_it(): def test_signing_out_stops_them(): - app = APP.read_text() + app = APP.read_text(encoding="utf-8") logout = app[app.index(" logout: () => {"):] logout = logout[:logout.index("navigate('/login')")] assert "transfers.reset()" in logout, ( @@ -257,7 +257,7 @@ def test_signing_out_stops_them(): def test_the_files_panel_no_longer_carries_its_own_progress_bars(): """They moved next to the bell, where they stay visible across the app.""" - app = APP.read_text() + app = APP.read_text(encoding="utf-8") for gone in ("setUlState", "setDlState", "dl-bar"): assert gone not in app, f"{gone} survived the move to the transfer widget" @@ -270,7 +270,7 @@ def test_a_multi_file_download_waits_for_each_picker(): meant the first opened a dialog and the rest were rejected — two files selected, one file downloaded. """ - app = STATIC.joinpath("files-app.js").read_text() + app = STATIC.joinpath("files-app.js").read_text(encoding="utf-8") # Anchored on the loop rather than on the markup around it: the toolbar # moved from a dropdown to icon buttons and took the old wrapper with it, # while the property under test — one picker at a time — did not change. @@ -289,7 +289,7 @@ def test_links_in_chat_are_built_as_elements_not_markup(): never HTML, and only for http(s) — otherwise javascript: would be one message away from running here. """ - app = STATIC.joinpath("chat-app.js").read_text() + app = STATIC.joinpath("chat-app.js").read_text(encoding="utf-8") fn = app[app.index("function linkify("):] fn = fn[:fn.index("\nfunction ", 1)] assert "innerHTML" not in fn and "dangerouslySetInnerHTML" not in fn -- cgit v1.2.3