From c0bad44d7e305a76ddda2f3bb271dbad489db4ee Mon Sep 17 00:00:00 2001 From: Marco Heinemann Date: Thu, 21 May 2026 22:45:37 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20FIX:=20use=20TOML=20literal=20st?= =?UTF-8?q?ring=20in=20Windows-path=20test?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ``test_absolute_paths_pass_through_unchanged`` interpolated a ``tmp_path``-derived absolute path into a TOML **basic** string. On Windows that path looks like ``C:\Users\runneradmin\AppData\Local\ ...``; the TOML parser reads ``\U`` as the start of a ``\Uxxxxxxxx`` Unicode escape, expects 8 hex digits, finds ``sers...`` instead, and fails with ``Invalid hex value (at line 2, column 12)`` before ``load_mounts_from_toml`` even returns. Every other CI cell passed. Switch the two interpolated values to TOML **literal** strings (single quotes), where backslashes are taken verbatim and no escape processing happens. The round-trip assertion still holds — literal strings preserve their content byte-for-byte, so the absolute path the test wrote is exactly what the TOML loader gives back. Unblocks the Windows pytest cell of the ci.yml workflow, which is currently red on ``main`` and on PR #1 (dependabot setup-uv 6→7); PR #1 only surfaced this pre-existing test bug, it did not cause it. --- tests/test_config.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/test_config.py b/tests/test_config.py index 2655175..82bff0f 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -344,8 +344,12 @@ def test_paths_anchor_to_toml_directory_not_cwd(self, tmp_path: Path) -> None: def test_absolute_paths_pass_through_unchanged(self, tmp_path: Path) -> None: abs_dir = tmp_path / "abs" toml = tmp_path / "ubproject.toml" + # Use a TOML *literal* string (single quotes) so that a Windows + # absolute path like ``C:\Users\...`` is not interpreted as TOML + # escape sequences (``\U`` would otherwise be parsed as a + # \Uxxxxxxxx Unicode escape and fail to parse). toml.write_text( - f'[[mounts]]\ndir = "{abs_dir}"\nmount_at = "_g/abs"\n', + f"[[mounts]]\ndir = '{abs_dir}'\nmount_at = '_g/abs'\n", encoding="utf-8", ) raw = load_mounts_from_toml(toml)