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.
This commit is contained in:
Chase Florell
2026-05-07 14:01:47 -07:00
parent 7bf8516529
commit 1448f42b5f
@@ -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: