diff options
| author | Christophe Besson <cbesson@gmail.com> | 2026-09-27 22:21:26 +0200 |
|---|---|---|
| committer | Christophe Besson <cbesson@gmail.com> | 2026-09-27 22:21:26 +0200 |
| commit | a45e77df1b0024707914a446aa89d33baa223787 (patch) | |
| tree | 969a4976c91d7aaa27b11ba212f99d69e2ccce0f /packages/meshbay-node/tests/test_node_status.py | |
| parent | c7899e2218af26f3bab6a157c70acf5eb7871da6 (diff) | |
| download | meshbay-a45e77df1b0024707914a446aa89d33baa223787.tar.gz | |
test: make both suites pass on Windows
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 <noreply@anthropic.com>
Diffstat (limited to 'packages/meshbay-node/tests/test_node_status.py')
| -rw-r--r-- | packages/meshbay-node/tests/test_node_status.py | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/packages/meshbay-node/tests/test_node_status.py b/packages/meshbay-node/tests/test_node_status.py index 8bb2f39..bd63f8e 100644 --- a/packages/meshbay-node/tests/test_node_status.py +++ b/packages/meshbay-node/tests/test_node_status.py @@ -266,7 +266,7 @@ async def test_add_root_creates_directory_and_returns_info(tmp_path): conf = tmp_path / "node.toml" conf.write_text(f'[[groups]]\nid = "{GROUP}"\nname = "test"\n\n' - f' [[groups.roots]]\n path = "{shared}"\n') + f' [[groups.roots]]\n path = "{shared}"\n', encoding="utf-8") node_cfg = NodeConfig.__new__(NodeConfig) node_cfg.groups = [cfg] @@ -308,7 +308,7 @@ async def test_remove_root_requires_at_least_one_remaining(tmp_path): conf = tmp_path / "node.toml" conf.write_text(f'[[groups]]\nid = "{GROUP}"\nname = "test"\n\n' - f' [[groups.roots]]\n path = "{shared}"\n') + f' [[groups.roots]]\n path = "{shared}"\n', encoding="utf-8") index = GroupIndex(group_id=GROUP, sk_node=Ed25519PrivateKey.generate()) roots = one_root(shared) state = { @@ -344,7 +344,7 @@ async def test_removing_a_writable_root_is_allowed(tmp_path): conf.write_text( f'[[groups]]\nid = "{GROUP}"\nname = "test"\n\n' f' [[groups.roots]]\n path = "{d1}"\n name = "incoming"\n writable = true\n\n' - f' [[groups.roots]]\n path = "{d2}"\n name = "shared"\n') + f' [[groups.roots]]\n path = "{d2}"\n name = "shared"\n', encoding="utf-8") roots = RootSet.build([asdict(r) for r in cfg.roots]) index = GroupIndex(group_id=GROUP, sk_node=Ed25519PrivateKey.generate()) state = { @@ -355,7 +355,7 @@ async def test_removing_a_writable_root_is_allowed(tmp_path): result = await ops.remove_root(state, GROUP, "incoming") assert result["status"] == "removed" assert [r["name"] for r in result["roots"]] == ["shared"] - assert conf.read_text().count("[[groups.roots]]") == 1 + assert conf.read_text(encoding="utf-8").count("[[groups.roots]]") == 1 async def test_update_root_rewrites_the_flags_in_node_toml(tmp_path): @@ -380,7 +380,7 @@ async def test_update_root_rewrites_the_flags_in_node_toml(tmp_path): f'[[groups]]\nid = "{GROUP}"\nname = "test"\n\n' f' [[groups.roots]]\n' f' # the operator explained this one to themselves\n' - f' path = "{d1}"\n name = "media"\n') + f' path = "{d1}"\n name = "media"\n', encoding="utf-8") roots = RootSet.build([asdict(r) for r in cfg.roots]) index = GroupIndex(group_id=GROUP, sk_node=Ed25519PrivateKey.generate()) state = { @@ -392,7 +392,7 @@ async def test_update_root_rewrites_the_flags_in_node_toml(tmp_path): result = await ops.update_root(state, GROUP, "media", writable=True, removable=True) assert result["status"] == "updated" - text = conf.read_text() + text = conf.read_text(encoding="utf-8") assert "writable = true" in text assert "removable = true" in text assert "the operator explained this one to themselves" in text, ( @@ -406,7 +406,7 @@ async def test_update_root_rewrites_the_flags_in_node_toml(tmp_path): # A second call that changes nothing must not append a duplicate line. await ops.update_root(state, GROUP, "media", writable=True, removable=True) - assert conf.read_text().count("writable =") == 1 + assert conf.read_text(encoding="utf-8").count("writable =") == 1 async def test_update_root_replaces_a_legacy_upload_line(tmp_path): @@ -430,7 +430,7 @@ async def test_update_root_replaces_a_legacy_upload_line(tmp_path): conf.write_text( f'[[groups]]\nid = "{GROUP}"\nname = "test"\n\n' f' [[groups.roots]]\n path = "{d1}"\n name = "media"\n' - f' upload = true\n') + f' upload = true\n', encoding="utf-8") roots = RootSet.build([asdict(r) for r in cfg.roots]) index = GroupIndex(group_id=GROUP, sk_node=Ed25519PrivateKey.generate()) state = { @@ -440,7 +440,7 @@ async def test_update_root_replaces_a_legacy_upload_line(tmp_path): } await ops.update_root(state, GROUP, "media", writable=False) - text = conf.read_text() + text = conf.read_text(encoding="utf-8") assert "upload = true" not in text assert "writable = false" in text @@ -463,7 +463,7 @@ async def test_remove_root_succeeds_with_two_roots(tmp_path): conf.write_text( f'[[groups]]\nid = "{GROUP}"\nname = "test"\n\n' f' [[groups.roots]]\n path = "{d1}"\n name = "dir1"\n\n' - f' [[groups.roots]]\n path = "{d2}"\n name = "dir2"\n') + f' [[groups.roots]]\n path = "{d2}"\n name = "dir2"\n', encoding="utf-8") roots = RootSet.build([asdict(r) for r in cfg.roots]) index = GroupIndex(group_id=GROUP, sk_node=Ed25519PrivateKey.generate()) state = { |