Show More
@@ -521,9 +521,9 b' class AutoreloadMagics(Magics):' | |||||
521 | class AutoreloadPlugin(Plugin): |
|
521 | class AutoreloadPlugin(Plugin): | |
522 | def __init__(self, shell=None, config=None): |
|
522 | def __init__(self, shell=None, config=None): | |
523 | super(AutoreloadPlugin, self).__init__(shell=shell, config=config) |
|
523 | super(AutoreloadPlugin, self).__init__(shell=shell, config=config) | |
524 | auto = AutoreloadMagics(shell) |
|
524 | self.auto_magics = AutoreloadMagics(shell) | |
525 |
|
|
525 | shell.register_magics(self.auto_magics) | |
526 |
|
|
526 | shell.set_hook('pre_run_code_hook', self.auto_magics.pre_run_code_hook) | |
527 |
|
527 | |||
528 |
|
528 | |||
529 | _loaded = False |
|
529 | _loaded = False |
@@ -9,7 +9,7 b' from StringIO import StringIO' | |||||
9 | import nose.tools as nt |
|
9 | import nose.tools as nt | |
10 | import IPython.testing.tools as tt |
|
10 | import IPython.testing.tools as tt | |
11 |
|
11 | |||
12 |
from IPython.extensions.autoreload import Autoreload |
|
12 | from IPython.extensions.autoreload import AutoreloadPlugin | |
13 | from IPython.core.hooks import TryNext |
|
13 | from IPython.core.hooks import TryNext | |
14 |
|
14 | |||
15 | #----------------------------------------------------------------------------- |
|
15 | #----------------------------------------------------------------------------- | |
@@ -19,11 +19,11 b' from IPython.core.hooks import TryNext' | |||||
19 | class FakeShell(object): |
|
19 | class FakeShell(object): | |
20 | def __init__(self): |
|
20 | def __init__(self): | |
21 | self.ns = {} |
|
21 | self.ns = {} | |
22 |
self.reloader = Autoreload |
|
22 | self.reloader = AutoreloadPlugin(shell=get_ipython()) | |
23 |
|
23 | |||
24 | def run_code(self, code): |
|
24 | def run_code(self, code): | |
25 | try: |
|
25 | try: | |
26 | self.reloader.pre_run_code_hook(self) |
|
26 | self.reloader.auto_magics.pre_run_code_hook(self) | |
27 | except TryNext: |
|
27 | except TryNext: | |
28 | pass |
|
28 | pass | |
29 | exec code in self.ns |
|
29 | exec code in self.ns | |
@@ -32,10 +32,10 b' class FakeShell(object):' | |||||
32 | self.ns.update(items) |
|
32 | self.ns.update(items) | |
33 |
|
33 | |||
34 | def magic_autoreload(self, parameter): |
|
34 | def magic_autoreload(self, parameter): | |
35 |
self.reloader. |
|
35 | self.reloader.auto_magics.autoreload(parameter) | |
36 |
|
36 | |||
37 | def magic_aimport(self, parameter, stream=None): |
|
37 | def magic_aimport(self, parameter, stream=None): | |
38 |
self.reloader. |
|
38 | self.reloader.auto_magics.aimport(parameter, stream=stream) | |
39 |
|
39 | |||
40 |
|
40 | |||
41 | class Fixture(object): |
|
41 | class Fixture(object): | |
@@ -160,7 +160,7 b" class Bar: # old-style class: weakref doesn't work for it on Python < 2.7" | |||||
160 | self.shell.magic_aimport("", stream=stream) |
|
160 | self.shell.magic_aimport("", stream=stream) | |
161 | nt.assert_true("Modules to reload:\nall-except-skipped" in |
|
161 | nt.assert_true("Modules to reload:\nall-except-skipped" in | |
162 | stream.getvalue()) |
|
162 | stream.getvalue()) | |
163 |
nt.assert_ |
|
163 | nt.assert_in(mod_name, self.shell.ns) | |
164 |
|
164 | |||
165 | mod = sys.modules[mod_name] |
|
165 | mod = sys.modules[mod_name] | |
166 |
|
166 |
General Comments 0
You need to be logged in to leave comments.
Login now