Files
CloakBrowser/tests/conftest.py
T
CloakHQ 69a168ae0a test: isolate Python/JS suites from the real ~/.cloakbrowser
A license.key or cached Pro marker in the developer's cache dir resolved the
box as Pro, flipping version-gated defaults (headless no_viewport, inline proxy
auth) and failing 9 Python + 4 JS tests locally. Both suites now run against a
temp cache dir.
2026-07-24 19:52:07 +02:00

20 lines
724 B
Python

"""Shared pytest fixtures."""
import pytest
@pytest.fixture(autouse=True)
def isolated_cache_dir(tmp_path_factory, monkeypatch):
"""Keep the suite away from the developer's real ``~/.cloakbrowser``.
A ``license.key`` (or a cached Pro version marker) in the real cache dir
resolves the machine as Pro, which flips version-gated defaults such as the
headless ``no_viewport`` shim and inline proxy auth — tests then assert
against whatever the developer happens to have installed. ``monkeypatch``
means a test setting its own ``CLOAKBROWSER_CACHE_DIR`` still wins.
"""
monkeypatch.setenv(
"CLOAKBROWSER_CACHE_DIR",
str(tmp_path_factory.mktemp("cloakbrowser-cache")),
)