From 1448f42b5ffb0f3e55680796cfec94529c7aa69f Mon Sep 17 00:00:00 2001 From: Chase Florell Date: Thu, 7 May 2026 14:01:47 -0700 Subject: [PATCH] test: align csp test with pathlib rooting pattern from existing suite Use Path(__file__).resolve().parents[1] so the test survives being run from a non-repo-root cwd, matching test_issue1112_csp_google_fonts.py. --- tests/test_issue1850_csp_connect_src_jsdelivr.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/test_issue1850_csp_connect_src_jsdelivr.py b/tests/test_issue1850_csp_connect_src_jsdelivr.py index 7cd50ce4..d620f387 100644 --- a/tests/test_issue1850_csp_connect_src_jsdelivr.py +++ b/tests/test_issue1850_csp_connect_src_jsdelivr.py @@ -6,11 +6,13 @@ jsDelivr and are fetched via connect (not script load), so connect-src must include cdn.jsdelivr.net or browsers block the fetch and emit CSP violations. """ import re +from pathlib import Path + +_HELPERS_PY = Path(__file__).resolve().parents[1] / "api/helpers.py" def _helpers_src() -> str: - with open("api/helpers.py") as f: - return f.read() + return _HELPERS_PY.read_text() class TestCSPConnectSrcJsdelivr: