From 076005a66f375e076fb28ea143a843fde28e0a6c 2009-04-14 06:42:29 From: Fernando Perez Date: 2009-04-14 06:42:29 Subject: [PATCH] Small formatting fixes to address Jorgen's last code review. --- diff --git a/IPython/Magic.py b/IPython/Magic.py index 3cf390d..32bdb6d 100644 --- a/IPython/Magic.py +++ b/IPython/Magic.py @@ -1584,10 +1584,7 @@ Currently the magic system has the following functions:\n""" prog_ns = self.shell.user_ns __name__save = self.shell.user_ns['__name__'] prog_ns['__name__'] = '__main__' - - ##main_mod = FakeModule(prog_ns) main_mod = self.shell.new_main_mod(prog_ns) - else: # Run in a fresh, empty namespace if opts.has_key('n'): @@ -1596,10 +1593,8 @@ Currently the magic system has the following functions:\n""" name = '__main__' main_mod = self.shell.new_main_mod() - prog_ns = main_mod.__dict__ prog_ns['__name__'] = name - # Since '%run foo' emulates 'python foo.py' at the cmd line, we must # set the __file__ global in the script's namespace diff --git a/IPython/tests/obj_del.py b/IPython/tests/obj_del.py index fa84bf9..8ea9d18 100644 --- a/IPython/tests/obj_del.py +++ b/IPython/tests/obj_del.py @@ -26,7 +26,7 @@ import sys class A(object): def __del__(self): - print 'obj_del.py: object A deleted' + print 'obj_del.py: object A deleted' a = A() diff --git a/IPython/tests/refbug.py b/IPython/tests/refbug.py index 66bc907..99aca19 100644 --- a/IPython/tests/refbug.py +++ b/IPython/tests/refbug.py @@ -2,12 +2,15 @@ The problem is related to https://bugs.launchpad.net/ipython/+bug/269966 -The original fix for that appeared to work, but JD Hunter found a matplotlib -example which, when run twice in a row, would break. The problem were -references held by open figures to internals of Tkinter. +The original fix for that appeared to work, but John D. Hunter found a +matplotlib example which, when run twice in a row, would break. The problem +were references held by open figures to internals of Tkinter. -This code reproduces the problem that John saw, without matplotlib. We can -thus use it for our test suite. +This code reproduces the problem that John saw, without matplotlib. + +This script is meant to be called by other parts of the test suite that call it +via %run as if it were executed interactively by the user. As of 2009-04-13, +test_magic.py calls it. """ #----------------------------------------------------------------------------- diff --git a/IPython/tests/test_iplib.py b/IPython/tests/test_iplib.py index f0d45e5..0924e1b 100644 --- a/IPython/tests/test_iplib.py +++ b/IPython/tests/test_iplib.py @@ -51,18 +51,18 @@ def test_reset(): def test_user_setup(): # use a lambda to pass kwargs to the generator user_setup = lambda a,k: iplib.user_setup(*a,**k) - kw = dict(mode='install',interactive=False) + kw = dict(mode='install', interactive=False) # Call the user setup and verify that the directory exists - yield user_setup, (ip.options.ipythondir,''),kw - yield os.path.isdir,ip.options.ipythondir + yield user_setup, (ip.options.ipythondir,''), kw + yield os.path.isdir, ip.options.ipythondir # Now repeat the operation with a non-existent directory. Check both that # the call succeeds and that the directory is created. tmpdir = tempfile.mktemp(prefix='ipython-test-') try: - yield user_setup, (tmpdir,''),kw - yield os.path.isdir,tmpdir + yield user_setup, (tmpdir,''), kw + yield os.path.isdir, tmpdir finally: # In this case, clean up the temp dir once done shutil.rmtree(tmpdir)