diff --git a/IPython/core/hooks.py b/IPython/core/hooks.py index 29028d7..81340d2 100644 --- a/IPython/core/hooks.py +++ b/IPython/core/hooks.py @@ -128,9 +128,9 @@ class CommandChainDispatcher: def __call__(self,*args, **kw): """ Command chain is called just like normal func. - This will call all funcs in chain with the same args as were given to this - function, and return the result of first func that didn't raise - TryNext """ + This will call all funcs in chain with the same args as were given to + this function, and return the result of first func that didn't raise + TryNext""" for prio,cmd in self.chain: #print "prio",prio,"cmd",cmd #dbg diff --git a/IPython/extensions/autoreload.py b/IPython/extensions/autoreload.py index b4df8a2..75b71c6 100644 --- a/IPython/extensions/autoreload.py +++ b/IPython/extensions/autoreload.py @@ -484,9 +484,7 @@ class AutoreloadMagics(Magics): %aimport -foo Mark module 'foo' to not be autoreloaded for %autoreload 1 - """ - modname = parameter_s if not modname: to_reload = self._reloader.modules.keys() @@ -509,7 +507,7 @@ class AutoreloadMagics(Magics): # Inject module to user namespace self.shell.push({top_name: top_module}) - def pre_run_code_hook(self, ipself): + def pre_run_code_hook(self, ip): if not self._reloader.enabled: raise TryNext try: diff --git a/IPython/extensions/tests/test_autoreload.py b/IPython/extensions/tests/test_autoreload.py index 7b78dab..1ac1204 100644 --- a/IPython/extensions/tests/test_autoreload.py +++ b/IPython/extensions/tests/test_autoreload.py @@ -1,3 +1,17 @@ +"""Tests for autoreload extension. +""" +#----------------------------------------------------------------------------- +# Copyright (c) 2012 IPython Development Team. +# +# Distributed under the terms of the Modified BSD License. +# +# The full license is in the file COPYING.txt, distributed with this software. +#----------------------------------------------------------------------------- + +#----------------------------------------------------------------------------- +# Imports +#----------------------------------------------------------------------------- + import os import sys import tempfile @@ -16,10 +30,14 @@ from IPython.core.hooks import TryNext # Test fixture #----------------------------------------------------------------------------- +noop = lambda *a, **kw: None + class FakeShell(object): def __init__(self): self.ns = {} - self.reloader = AutoreloadPlugin(shell=get_ipython()) + self.reloader = AutoreloadPlugin(shell=self) + + register_magics = set_hook = noop def run_code(self, code): try: @@ -81,7 +99,6 @@ class Fixture(object): future, and without changing the timestamp of the .pyc file (because that is stored in the file). The only reliable way to achieve this seems to be to sleep. - """ # Sleep one second + eps