-
Notifications
You must be signed in to change notification settings - Fork 29
Expand file tree
/
Copy pathconftest.py
More file actions
52 lines (39 loc) · 1.57 KB
/
Copy pathconftest.py
File metadata and controls
52 lines (39 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
"""
Pytest configuration for remarkable-mcp tests.
Adds --run-integration flag for live SSH tests against a connected tablet.
"""
import tempfile
import pytest
@pytest.fixture(autouse=True)
def isolate_blob_cache(monkeypatch):
"""Point the cloud blob cache at a fresh temp dir for every test.
The cloud client caches content-addressed blobs on disk. Without isolation,
tests that mock HTTP would write blobs into the developer's real
~/.remarkable cache and then read them back on reruns, bypassing the mock
and making call-count assertions nondeterministic. A per-test temp dir keeps
each test hermetic and avoids polluting the real cache.
"""
with tempfile.TemporaryDirectory() as cache_dir:
monkeypatch.setenv("REMARKABLE_CACHE_DIR", cache_dir)
try:
from remarkable_mcp import api
api.reset_client_cache()
except Exception:
pass
yield
def pytest_addoption(parser):
parser.addoption(
"--run-integration",
action="store_true",
default=False,
help="Run integration tests against a connected reMarkable tablet via SSH",
)
def pytest_configure(config):
config.addinivalue_line("markers", "integration: tests requiring a connected reMarkable tablet")
def pytest_collection_modifyitems(config, items):
if config.getoption("--run-integration"):
return
skip_integration = pytest.mark.skip(reason="need --run-integration to run")
for item in items:
if "integration" in item.keywords:
item.add_marker(skip_integration)