Skip to content

Commit 5d4e091

Browse files
committed
Debug
1 parent 25b2fc3 commit 5d4e091

File tree

5 files changed

+16
-27
lines changed

5 files changed

+16
-27
lines changed

ipywidgets/widgets/tests/test_interaction.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
# Utility stuff
2626
#-----------------------------------------------------------------------------
2727

28-
from .utils import setup, teardown
28+
from .utils import setup
2929

3030
def f(**kwargs):
3131
pass

ipywidgets/widgets/tests/test_link.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import pytest
55

66
from .. import jslink, jsdlink, ToggleButton
7-
from .utils import setup, teardown
7+
from .utils import setup
88

99
def test_jslink_args():
1010
with pytest.raises(TypeError):

ipywidgets/widgets/tests/test_send_state.py

+6-15
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
from traitlets import Bool, Tuple, List
55

6-
from .utils import setup, teardown, DummyComm
6+
from .utils import setup
77

88
from ..widget import Widget
99

@@ -12,29 +12,20 @@
1212
# A widget with simple traits
1313
class SimpleWidget(Widget):
1414
a = Bool().tag(sync=True)
15-
b = Tuple(Bool(), Bool(), Bool(), default_value=(False, False, False)).tag(sync=True)
15+
b = Tuple(Bool(), Bool(), Bool(), default_value=(False, False, False)).tag(
16+
sync=True
17+
)
1618
c = List(Bool()).tag(sync=True)
1719

20+
1821
def test_empty_send_state():
1922
w = SimpleWidget()
2023
w.send_state([])
2124
assert w.comm.messages == []
2225

26+
2327
def test_empty_hold_sync():
2428
w = SimpleWidget()
2529
with w.hold_sync():
2630
pass
2731
assert w.comm.messages == []
28-
29-
30-
def test_control():
31-
comm = DummyComm()
32-
Widget.close_all()
33-
w = SimpleWidget()
34-
Widget.handle_control_comm_opened(
35-
comm, dict(metadata={'version': __control_protocol_version__})
36-
)
37-
Widget._handle_control_comm_msg(dict(content=dict(
38-
data={'method': 'request_states'}
39-
)))
40-
assert comm.messages

ipywidgets/widgets/tests/test_set_state.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
from traitlets import Bool, Tuple, List, Instance, CFloat, CInt, Float, Int, TraitError, observe
1111

12-
from .utils import setup, teardown
12+
from .utils import setup
1313

1414
import ipywidgets
1515
from ipywidgets import Widget

ipywidgets/widgets/tests/utils.py

+7-9
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
NEW_COMM_PACKAGE = False
1313

1414
import ipykernel.comm
15-
15+
import pytest
1616

1717
class DummyComm():
1818
comm_id = 'a-b-c-d'
@@ -34,18 +34,13 @@ def send(self, *args, **kwargs):
3434
def close(self, *args, **kwargs):
3535
pass
3636

37-
class DummyCommManager():
38-
39-
def unregister_comm(self, comm):
40-
pass
41-
4237

4338
def dummy_create_comm(**kwargs):
4439
return DummyComm()
4540

4641

4742
def dummy_get_comm_manager(**kwargs):
48-
return DummyCommManager()
43+
return {}
4944

5045

5146
_widget_attrs = {}
@@ -92,8 +87,11 @@ def teardown_test_comm():
9287
setattr(Widget, attr, value)
9388
_widget_attrs.clear()
9489

90+
@pytest.fixture(autouse=True)
9591
def setup():
9692
setup_test_comm()
97-
98-
def teardown():
93+
yield
9994
teardown_test_comm()
95+
96+
def call_method(method, *args, **kwargs):
97+
method(*args, **kwargs)

0 commit comments

Comments
 (0)