##// END OF EJS Templates
Fix tests in autoreload extension for new API.
Fernando Perez -
Show More
@@ -128,9 +128,9 b' class CommandChainDispatcher:'
128 128 def __call__(self,*args, **kw):
129 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
132 function, and return the result of first func that didn't raise
133 TryNext """
131 This will call all funcs in chain with the same args as were given to
132 this function, and return the result of first func that didn't raise
133 TryNext"""
134 134
135 135 for prio,cmd in self.chain:
136 136 #print "prio",prio,"cmd",cmd #dbg
@@ -484,9 +484,7 b' class AutoreloadMagics(Magics):'
484 484
485 485 %aimport -foo
486 486 Mark module 'foo' to not be autoreloaded for %autoreload 1
487
488 487 """
489
490 488 modname = parameter_s
491 489 if not modname:
492 490 to_reload = self._reloader.modules.keys()
@@ -509,7 +507,7 b' class AutoreloadMagics(Magics):'
509 507 # Inject module to user namespace
510 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 511 if not self._reloader.enabled:
514 512 raise TryNext
515 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 15 import os
2 16 import sys
3 17 import tempfile
@@ -16,10 +30,14 b' from IPython.core.hooks import TryNext'
16 30 # Test fixture
17 31 #-----------------------------------------------------------------------------
18 32
33 noop = lambda *a, **kw: None
34
19 35 class FakeShell(object):
20 36 def __init__(self):
21 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 42 def run_code(self, code):
25 43 try:
@@ -81,7 +99,6 b' class Fixture(object):'
81 99 future, and without changing the timestamp of the .pyc file
82 100 (because that is stored in the file). The only reliable way
83 101 to achieve this seems to be to sleep.
84
85 102 """
86 103
87 104 # Sleep one second + eps
General Comments 0
You need to be logged in to leave comments. Login now