Skip to content

🐛 FIX: Windows pytest fails on backslash in TOML basic string#2

Merged
ubmarco merged 1 commit into
mainfrom
fix/windows-toml-basic-string
May 21, 2026
Merged

🐛 FIX: Windows pytest fails on backslash in TOML basic string#2
ubmarco merged 1 commit into
mainfrom
fix/windows-toml-basic-string

Conversation

@ubmarco
Copy link
Copy Markdown
Member

@ubmarco ubmarco commented May 21, 2026

Summary

  • tests/test_config.py::TestLoadMountsFromToml::test_absolute_paths_pass_through_unchanged interpolated a Windows tmp_path (C:\Users\runneradmin\AppData\Local\…) into a TOML basic string. The TOML parser sees \U and tries to read 8 hex digits for a \Uxxxxxxxx escape, finds sers…, and raises Invalid hex value (at line 2, column 12) before load_mounts_from_toml returns.
  • Fix: switch the two interpolated values to TOML literal strings (single quotes), where backslashes are taken verbatim. The round-trip assertion still holds — literal strings preserve their content byte-for-byte, so the absolute path the test wrote equals what the loader gives back.
  • Unblocks the Windows pytest cell of ci.yml, currently red on main and on build(deps): bump astral-sh/setup-uv from 6 to 7 #1 (dependabot setup-uv 6→7). build(deps): bump astral-sh/setup-uv from 6 to 7 #1 only surfaces this pre-existing test bug; it did not cause it.

Failure on main (run 26251744910)

src = '[[mounts]]\ndir = "C:\\Users\\runneradmin\\AppData\\Local\\Temp\\…\\abs"\nmount_at = "_g/abs"\n'
pos = 22, hex_len = 8
E   tomllib.TOMLDecodeError: Invalid hex value (at line 2, column 12)

Test plan

  • uv run pytest tests/test_config.py -q (Linux) — 58 passed
  • uv run --frozen prek run --all-files — all hooks pass
  • CI Windows pytest cell goes green on this PR
  • Rebase / re-run of build(deps): bump astral-sh/setup-uv from 6 to 7 #1 against new main after merge → all green

``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.
@ubmarco ubmarco merged commit df25007 into main May 21, 2026
11 checks passed
@ubmarco ubmarco deleted the fix/windows-toml-basic-string branch May 21, 2026 20:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant