##// END OF EJS Templates
avoid copious warnings in interact tests...
MinRK -
Show More
@@ -1,15 +1,7 b''
1 """Test interact and interactive."""
1 """Test interact and interactive."""
2
2
3 #-----------------------------------------------------------------------------
3 # Copyright (c) IPython Development Team.
4 # Copyright (C) 2014 The IPython Development Team
4 # Distributed under the terms of the Modified BSD License.
5 #
6 # Distributed under the terms of the BSD License. The full license is in
7 # the file COPYING, distributed as part of this software.
8 #-----------------------------------------------------------------------------
9
10 #-----------------------------------------------------------------------------
11 # Imports
12 #-----------------------------------------------------------------------------
13
5
14 from __future__ import print_function
6 from __future__ import print_function
15
7
@@ -18,7 +10,7 b' from collections import OrderedDict'
18 import nose.tools as nt
10 import nose.tools as nt
19 import IPython.testing.tools as tt
11 import IPython.testing.tools as tt
20
12
21 # from IPython.core.getipython import get_ipython
13 from IPython.kernel.comm import Comm
22 from IPython.html import widgets
14 from IPython.html import widgets
23 from IPython.html.widgets import interact, interactive, Widget, interaction
15 from IPython.html.widgets import interact, interactive, Widget, interaction
24 from IPython.utils.py3compat import annotate
16 from IPython.utils.py3compat import annotate
@@ -27,8 +19,9 b' from IPython.utils.py3compat import annotate'
27 # Utility stuff
19 # Utility stuff
28 #-----------------------------------------------------------------------------
20 #-----------------------------------------------------------------------------
29
21
30 class DummyComm(object):
22 class DummyComm(Comm):
31 comm_id = 'a-b-c-d'
23 comm_id = 'a-b-c-d'
24
32 def send(self, *args, **kwargs):
25 def send(self, *args, **kwargs):
33 pass
26 pass
34
27
@@ -37,10 +30,11 b' class DummyComm(object):'
37
30
38 _widget_attrs = {}
31 _widget_attrs = {}
39 displayed = []
32 displayed = []
33 undefined = object()
40
34
41 def setup():
35 def setup():
42 _widget_attrs['comm'] = Widget.comm
36 _widget_attrs['_comm_default'] = getattr(Widget, '_comm_default', undefined)
43 Widget.comm = DummyComm()
37 Widget._comm_default = lambda self: DummyComm()
44 _widget_attrs['_ipython_display_'] = Widget._ipython_display_
38 _widget_attrs['_ipython_display_'] = Widget._ipython_display_
45 def raise_not_implemented(*args, **kwargs):
39 def raise_not_implemented(*args, **kwargs):
46 raise NotImplementedError()
40 raise NotImplementedError()
@@ -48,7 +42,10 b' def setup():'
48
42
49 def teardown():
43 def teardown():
50 for attr, value in _widget_attrs.items():
44 for attr, value in _widget_attrs.items():
51 setattr(Widget, attr, value)
45 if value is undefined:
46 delattr(Widget, attr)
47 else:
48 setattr(Widget, attr, value)
52
49
53 def f(**kwargs):
50 def f(**kwargs):
54 pass
51 pass
General Comments 0
You need to be logged in to leave comments. Login now