Skip to content

Commit d2c2f86

Browse files
committed
Remove randomness for test
1 parent a64b8d8 commit d2c2f86

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

holoviews/tests/ui/bokeh/test_callback.py

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313

1414
skip_popup = pytest.mark.skipif(not bokeh34, reason="Pop ups needs Bokeh 3.4")
1515

16+
@pytest.fixture
17+
def points():
18+
rng = np.random.default_rng(10)
19+
return hv.Points(rng.normal(size=(1000, 2)))
1620

1721
@pytest.mark.usefixtures("bokeh_backend")
1822
@pytest.mark.parametrize(
@@ -215,11 +219,10 @@ def popup_form(name):
215219

216220
@skip_popup
217221
@pytest.mark.usefixtures("bokeh_backend")
218-
def test_stream_popup_none(serve_hv):
222+
def test_stream_popup_none(serve_hv, points):
219223
def popup_form(name):
220224
return
221225

222-
points = hv.Points(np.random.randn(10, 2))
223226
hv.streams.Tap(source=points, popup=popup_form("Tap"))
224227

225228
page = serve_hv(points)
@@ -258,7 +261,7 @@ def popup_form(x, y):
258261

259262
@skip_popup
260263
@pytest.mark.usefixtures("bokeh_backend")
261-
def test_stream_popup_visible(serve_hv):
264+
def test_stream_popup_visible(serve_hv, points):
262265
def popup_form(x, y):
263266
def hide(_):
264267
col.visible = False
@@ -270,7 +273,7 @@ def hide(_):
270273
col = pn.Column(button)
271274
return col
272275

273-
points = hv.Points(np.random.randn(10, 2)).opts(tools=["tap"])
276+
points = points.opts(tools=["tap"])
274277
hv.streams.Tap(source=points, popup=popup_form)
275278

276279
page = serve_hv(points)
@@ -292,11 +295,11 @@ def hide(_):
292295

293296
@skip_popup
294297
@pytest.mark.usefixtures("bokeh_backend")
295-
def test_stream_popup_close_button(serve_hv):
298+
def test_stream_popup_close_button(serve_hv, points):
296299
def popup_form(x, y):
297300
return "Hello"
298301

299-
points = hv.Points(np.random.randn(10, 2)).opts(tools=["tap", "box_select"])
302+
points = points.opts(tools=["tap", "box_select"])
300303
hv.streams.Tap(source=points, popup=popup_form)
301304
hv.streams.BoundsXY(source=points, popup=popup_form)
302305

@@ -314,8 +317,7 @@ def popup_form(x, y):
314317

315318
@skip_popup
316319
@pytest.mark.usefixtures("bokeh_backend")
317-
def test_stream_popup_selection1d_undefined(serve_hv):
318-
points = hv.Points(np.random.randn(10, 2))
320+
def test_stream_popup_selection1d_undefined(serve_hv, points):
319321
hv.streams.Selection1D(source=points)
320322

321323
page = serve_hv(points)
@@ -326,11 +328,11 @@ def test_stream_popup_selection1d_undefined(serve_hv):
326328

327329
@skip_popup
328330
@pytest.mark.usefixtures("bokeh_backend")
329-
def test_stream_popup_selection1d_tap(serve_hv):
331+
def test_stream_popup_selection1d_tap(serve_hv, points):
330332
def popup_form(index):
331333
return "# Tap"
332334

333-
points = hv.Points(np.random.randn(1000, 2)).opts(hit_dilation=5)
335+
points = points.opts(hit_dilation=5)
334336
hv.streams.Selection1D(source=points, popup=popup_form)
335337
points.opts(tools=["tap"], active_tools=["tap"])
336338

@@ -345,12 +347,11 @@ def popup_form(index):
345347

346348
@skip_popup
347349
@pytest.mark.usefixtures("bokeh_backend")
348-
def test_stream_popup_selection1d_lasso_select(serve_hv):
350+
def test_stream_popup_selection1d_lasso_select(serve_hv, points):
349351
def popup_form(index):
350352
if index:
351353
return f"# lasso\n{len(index)}"
352354

353-
points = hv.Points(np.random.randn(1000, 2))
354355
hv.streams.Selection1D(source=points, popup=popup_form)
355356
points.opts(tools=["tap", "lasso_select"], active_tools=["lasso_select"])
356357

0 commit comments

Comments
 (0)