From f4d2cc5ca3f76f5e958400ec9379f4442b885856 Mon Sep 17 00:00:00 2001 From: Leo Borcherding Date: Mon, 27 Jul 2026 12:39:35 -0500 Subject: [PATCH] Studio UI font-scale test: normalise paths so the allowlists work on Windows (#7434) test_inline_font_size_styles_reference_the_scale compares source-relative paths against FONTSIZE_PROP_ALLOWED_DIRS and FONTSIZE_STYLE_ALLOWLIST, both written with forward slashes. It built those paths with str(path.relative_to(SRC)), which is backslash-separated on Windows, so startswith() never matched and the allowlists silently did nothing. The suite is green on Linux CI and fails locally on Windows with 22 phantom offenders, all of them the chart cards the allowlist already covers. Route the paths through a _rel() helper that returns .as_posix(), and use it for the other two offender messages too so failures read the same on every OS. --- tests/studio/test_ui_font_scale_contract.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/tests/studio/test_ui_font_scale_contract.py b/tests/studio/test_ui_font_scale_contract.py index 65d3215374..bd9ad9acdd 100644 --- a/tests/studio/test_ui_font_scale_contract.py +++ b/tests/studio/test_ui_font_scale_contract.py @@ -39,6 +39,17 @@ def _frontend_sources(): yield path +def _rel(path): + """Source-relative path with forward slashes on every OS. + + The allowlists above are written with "/", so a plain str(relative_to(SRC)) + silently stops matching on Windows and every allowlisted file reports as an + offender. Keeping the separator normalised here also keeps failure messages + identical across platforms. + """ + return path.relative_to(SRC).as_posix() + + def test_preference_writes_a_scale_not_the_root_font_size(): assert 'setVar("--ui-font-scale"' in STORE assert 'el.setAttribute("data-ui-font-size"' in STORE @@ -136,7 +147,7 @@ def test_no_raw_pixel_text_utilities(): for path in _frontend_sources(): text = path.read_text(encoding = "utf-8") for m in re.finditer(r"(?