##// END OF EJS Templates
Fix tests in autoreload extension for new API.
Fernando Perez -
Show More
@@ -128,9 +128,9 b' class CommandChainDispatcher:'
128 def __call__(self,*args, **kw):
128 def __call__(self,*args, **kw):
129 """ Command chain is called just like normal func.
129 """ Command chain is called just like normal func.
130
130
131 This will call all funcs in chain with the same args as were given to this
131 This will call all funcs in chain with the same args as were given to
132 function, and return the result of first func that didn't raise
132 this function, and return the result of first func that didn't raise
133 TryNext """
133 TryNext"""
134
134
135 for prio,cmd in self.chain:
135 for prio,cmd in self.chain:
136 #print "prio",prio,"cmd",cmd #dbg
136 #print "prio",prio,"cmd",cmd #dbg
@@ -484,9 +484,7 b' class AutoreloadMagics(Magics):'
484
484
485 %aimport -foo
485 %aimport -foo
486 Mark module 'foo' to not be autoreloaded for %autoreload 1
486 Mark module 'foo' to not be autoreloaded for %autoreload 1
487
488 """
487 """
489
490 modname = parameter_s
488 modname = parameter_s
491 if not modname:
489 if not modname:
492 to_reload = self._reloader.modules.keys()
490 to_reload = self._reloader.modules.keys()
@@ -509,7 +507,7 b' class AutoreloadMagics(Magics):'
509 # Inject module to user namespace
507 # Inject module to user namespace
510 self.shell.push({top_name: top_module})
508 self.shell.push({top_name: top_module})
511
509
512 def pre_run_code_hook(self, ipself):
510 def pre_run_code_hook(self, ip):
513 if not self._reloader.enabled:
511 if not self._reloader.enabled:
514 raise TryNext
512 raise TryNext
515 try:
513 try:
@@ -1,3 +1,17 b''
1 """Tests for autoreload extension.
2 """
3 #-----------------------------------------------------------------------------
4 # Copyright (c) 2012 IPython Development Team.
5 #
6 # Distributed under the terms of the Modified BSD License.
7 #
8 # The full license is in the file COPYING.txt, distributed with this software.
9 #-----------------------------------------------------------------------------
10
11 #-----------------------------------------------------------------------------
12 # Imports
13 #-----------------------------------------------------------------------------
14
1 import os
15 import os
2 import sys
16 import sys
3 import tempfile
17 import tempfile
@@ -16,10 +30,14 b' from IPython.core.hooks import TryNext'
16 # Test fixture
30 # Test fixture
17 #-----------------------------------------------------------------------------
31 #-----------------------------------------------------------------------------
18
32
33 noop = lambda *a, **kw: None
34
19 class FakeShell(object):
35 class FakeShell(object):
20 def __init__(self):
36 def __init__(self):
21 self.ns = {}
37 self.ns = {}
22 self.reloader = AutoreloadPlugin(shell=get_ipython())
38 self.reloader = AutoreloadPlugin(shell=self)
39
40 register_magics = set_hook = noop
23
41
24 def run_code(self, code):
42 def run_code(self, code):
25 try:
43 try:
@@ -81,7 +99,6 b' class Fixture(object):'
81 future, and without changing the timestamp of the .pyc file
99 future, and without changing the timestamp of the .pyc file
82 (because that is stored in the file). The only reliable way
100 (because that is stored in the file). The only reliable way
83 to achieve this seems to be to sleep.
101 to achieve this seems to be to sleep.
84
85 """
102 """
86
103
87 # Sleep one second + eps
104 # Sleep one second + eps
General Comments 0
You need to be logged in to leave comments. Login now