##// END OF EJS Templates
Fix #14230 (missing param for autoreload) (#14231)...
Matthias Bussonnier -
r28503:f1926b3e merge
parent child Browse files
Show More
@@ -82,7 +82,11 b' class EventManager(object):'
82 82 func(*args, **kwargs)
83 83 except (Exception, KeyboardInterrupt):
84 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 90 self.shell.showtraceback()
87 91
88 92 # event_name -> prototype mapping
@@ -701,7 +701,7 b' class AutoreloadMagics(Magics):'
701 701 # Inject module to user namespace
702 702 self.shell.push({top_name: top_module})
703 703
704 def pre_run_cell(self):
704 def pre_run_cell(self, info):
705 705 if self._reloader.enabled:
706 706 try:
707 707 self._reloader.check()
@@ -21,6 +21,7 b' import textwrap'
21 21 import shutil
22 22 import random
23 23 import time
24 import traceback
24 25 from io import StringIO
25 26 from dataclasses import dataclass
26 27
@@ -31,6 +32,7 b' from unittest import TestCase'
31 32 from IPython.extensions.autoreload import AutoreloadMagics
32 33 from IPython.core.events import EventManager, pre_run_cell
33 34 from IPython.testing.decorators import skipif_not_numpy
35 from IPython.core.interactiveshell import ExecutionInfo
34 36
35 37 if platform.python_implementation() == "PyPy":
36 38 pytest.skip(
@@ -56,8 +58,27 b' class FakeShell:'
56 58
57 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 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 82 exec(code, self.user_ns)
62 83 self.auto_magics.post_execute_hook()
63 84
@@ -279,6 +300,7 b' class TestAutoreload(Fixture):'
279 300 @skipif_not_numpy
280 301 def test_comparing_numpy_structures(self):
281 302 self.shell.magic_autoreload("2")
303 self.shell.run_code("1+1")
282 304 mod_name, mod_fn = self.new_module(
283 305 textwrap.dedent(
284 306 """
@@ -73,7 +73,7 b' qtconsole ='
73 73 terminal =
74 74 test =
75 75 pytest<7.1
76 pytest-asyncio
76 pytest-asyncio<0.22
77 77 testpath
78 78 pickleshare
79 79 test_extra =
General Comments 0
You need to be logged in to leave comments. Login now