##// END OF EJS Templates
Fix #14230 (missing param for autoreload)...
Matthias Bussonnier -
Show More
@@ -82,7 +82,11 b' class EventManager(object):'
82 func(*args, **kwargs)
82 func(*args, **kwargs)
83 except (Exception, KeyboardInterrupt):
83 except (Exception, KeyboardInterrupt):
84 if self.print_on_error:
84 if self.print_on_error:
85 print("Error in callback {} (for {}):".format(func, event))
85 print(
86 "Error in callback {} (for {}), with arguments args {},kwargs {}:".format(
87 func, event, args, kwargs
88 )
89 )
86 self.shell.showtraceback()
90 self.shell.showtraceback()
87
91
88 # event_name -> prototype mapping
92 # event_name -> prototype mapping
@@ -701,7 +701,7 b' class AutoreloadMagics(Magics):'
701 # Inject module to user namespace
701 # Inject module to user namespace
702 self.shell.push({top_name: top_module})
702 self.shell.push({top_name: top_module})
703
703
704 def pre_run_cell(self):
704 def pre_run_cell(self, info):
705 if self._reloader.enabled:
705 if self._reloader.enabled:
706 try:
706 try:
707 self._reloader.check()
707 self._reloader.check()
@@ -21,6 +21,7 b' import textwrap'
21 import shutil
21 import shutil
22 import random
22 import random
23 import time
23 import time
24 import traceback
24 from io import StringIO
25 from io import StringIO
25 from dataclasses import dataclass
26 from dataclasses import dataclass
26
27
@@ -31,6 +32,7 b' from unittest import TestCase'
31 from IPython.extensions.autoreload import AutoreloadMagics
32 from IPython.extensions.autoreload import AutoreloadMagics
32 from IPython.core.events import EventManager, pre_run_cell
33 from IPython.core.events import EventManager, pre_run_cell
33 from IPython.testing.decorators import skipif_not_numpy
34 from IPython.testing.decorators import skipif_not_numpy
35 from IPython.core.interactiveshell import ExecutionInfo
34
36
35 if platform.python_implementation() == "PyPy":
37 if platform.python_implementation() == "PyPy":
36 pytest.skip(
38 pytest.skip(
@@ -56,8 +58,27 b' class FakeShell:'
56
58
57 register_magics = set_hook = noop
59 register_magics = set_hook = noop
58
60
61 def showtraceback(
62 self,
63 exc_tuple=None,
64 filename=None,
65 tb_offset=None,
66 exception_only=False,
67 running_compiled_code=False,
68 ):
69 traceback.print_exc()
70
59 def run_code(self, code):
71 def run_code(self, code):
60 self.events.trigger("pre_run_cell")
72 self.events.trigger(
73 "pre_run_cell",
74 ExecutionInfo(
75 raw_cell="",
76 store_history=False,
77 silent=False,
78 shell_futures=False,
79 cell_id=None,
80 ),
81 )
61 exec(code, self.user_ns)
82 exec(code, self.user_ns)
62 self.auto_magics.post_execute_hook()
83 self.auto_magics.post_execute_hook()
63
84
@@ -279,6 +300,7 b' class TestAutoreload(Fixture):'
279 @skipif_not_numpy
300 @skipif_not_numpy
280 def test_comparing_numpy_structures(self):
301 def test_comparing_numpy_structures(self):
281 self.shell.magic_autoreload("2")
302 self.shell.magic_autoreload("2")
303 self.shell.run_code("1+1")
282 mod_name, mod_fn = self.new_module(
304 mod_name, mod_fn = self.new_module(
283 textwrap.dedent(
305 textwrap.dedent(
284 """
306 """
General Comments 0
You need to be logged in to leave comments. Login now