-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathconftest.py
More file actions
123 lines (107 loc) · 4.27 KB
/
conftest.py
File metadata and controls
123 lines (107 loc) · 4.27 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# RootInteractive/conftest.py (REPO ROOT)
"""
Root-level pytest configuration for RootInteractive.
Fixes:
1. Registers custom markers globally
2. Replaces bokeh.io.show() with save() - creates HTML without opening browser
3. Keeps output_file() working normally
Phase: 0.1.A
Date: 2026-02-03
"""
import pytest
import os
import warnings
# =============================================================================
# REPLACE BOKEH SHOW() WITH SAVE() — Create HTML without opening browser
# =============================================================================
def pytest_configure(config):
"""
Register ALL custom markers and configure bokeh for testing.
"""
# -------------------------------------------------------------------------
# Set environment variable to disable browser opening (backup)
# -------------------------------------------------------------------------
os.environ['BOKEH_BROWSER'] = 'none'
# -------------------------------------------------------------------------
# Replace show() with save() so HTML files are created but browser doesn't open
# P0-4 FIX: Use warnings.warn() instead of silent pass
# -------------------------------------------------------------------------
try:
import bokeh.io
from bokeh.io import save as bokeh_save
def show_as_save(obj=None, browser=None, new=None, notebook_handle=False, notebook_url="localhost:8888", **kwargs):
"""Replace show() with save() - creates HTML file without opening browser."""
if obj is not None:
try:
bokeh_save(obj)
except Exception as e:
# P0-4 FIX: Do NOT silently swallow - warn so errors are visible
warnings.warn(f"Bokeh save() failed: {e}", RuntimeWarning)
bokeh.io.show = show_as_save
# Also patch bokeh.plotting.show
try:
import bokeh.plotting
bokeh.plotting.show = show_as_save
except ImportError:
pass
except ImportError:
pass # bokeh not installed
# -------------------------------------------------------------------------
# Feature tracking markers (CAPABILITY_MATRIX)
# -------------------------------------------------------------------------
config.addinivalue_line(
"markers",
"feature(name): Feature ID from FEATURE_TAXONOMY (e.g., 'DSL.arithmetic_expr')"
)
# -------------------------------------------------------------------------
# Backend markers
# -------------------------------------------------------------------------
config.addinivalue_line(
"markers",
"backend(name): Backend required (python, node, browser)"
)
# -------------------------------------------------------------------------
# Layer markers
# -------------------------------------------------------------------------
config.addinivalue_line(
"markers",
"layer(name): Test layer (unit, integration, invariance, vector)"
)
# -------------------------------------------------------------------------
# Priority markers
# -------------------------------------------------------------------------
config.addinivalue_line(
"markers",
"p0: Priority 0 - critical/blocking"
)
config.addinivalue_line(
"markers",
"p1: Priority 1 - important/required"
)
config.addinivalue_line(
"markers",
"p2: Priority 2 - nice to have"
)
# -------------------------------------------------------------------------
# Execution markers
# -------------------------------------------------------------------------
config.addinivalue_line(
"markers",
"cross_backend: Test requires both Python and JavaScript execution"
)
config.addinivalue_line(
"markers",
"slow: Mark test as slow-running"
)
config.addinivalue_line(
"markers",
"regression(pr): Regression test for a specific PR"
)
config.addinivalue_line(
"markers",
"gui: Test creates GUI/visualization (may be slow)"
)
config.addinivalue_line(
"markers",
"unittest: Unit test marker (legacy)"
)