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"(?