Skip to content

Commit bc7f6c3

Browse files
committed
add tests
1 parent ec1a3d7 commit bc7f6c3

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

holoviews/tests/test_streams.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
from __future__ import annotations
66

7+
import logging
78
import weakref
89
from collections import defaultdict
910

@@ -160,6 +161,28 @@ def test_explicit_parameter(self):
160161
assert self.ExplicitTest.param["test"].default == 42
161162
assert self.ExplicitTest.param["test"].doc == "Test docstring"
162163

164+
def test_subscriber_error_logging_isolation(self, caplog):
165+
xy = self.XY()
166+
calls = []
167+
168+
def bad_subscriber(**kw):
169+
calls.append("bad")
170+
raise RuntimeError("simulated upstream bug")
171+
172+
def good_subscriber(**kw):
173+
calls.append("good")
174+
175+
xy.add_subscriber(bad_subscriber)
176+
xy.add_subscriber(good_subscriber)
177+
178+
with caplog.at_level(logging.ERROR, logger="holoviews.streams"):
179+
Stream.trigger([xy])
180+
181+
assert "simulated upstream bug" in caplog.text
182+
assert "bad_subscriber" in caplog.text
183+
assert len(calls) == 2
184+
assert calls == ["bad", "good"]
185+
163186

164187
class _Subscriber:
165188
def __init__(self, cb=None):

0 commit comments

Comments
 (0)