Show More
@@ -1584,10 +1584,7 b' Currently the magic system has the following functions:\\n"""' | |||||
1584 | prog_ns = self.shell.user_ns |
|
1584 | prog_ns = self.shell.user_ns | |
1585 | __name__save = self.shell.user_ns['__name__'] |
|
1585 | __name__save = self.shell.user_ns['__name__'] | |
1586 | prog_ns['__name__'] = '__main__' |
|
1586 | prog_ns['__name__'] = '__main__' | |
1587 |
|
||||
1588 | ##main_mod = FakeModule(prog_ns) |
|
|||
1589 | main_mod = self.shell.new_main_mod(prog_ns) |
|
1587 | main_mod = self.shell.new_main_mod(prog_ns) | |
1590 |
|
||||
1591 | else: |
|
1588 | else: | |
1592 | # Run in a fresh, empty namespace |
|
1589 | # Run in a fresh, empty namespace | |
1593 | if opts.has_key('n'): |
|
1590 | if opts.has_key('n'): | |
@@ -1596,10 +1593,8 b' Currently the magic system has the following functions:\\n"""' | |||||
1596 | name = '__main__' |
|
1593 | name = '__main__' | |
1597 |
|
1594 | |||
1598 | main_mod = self.shell.new_main_mod() |
|
1595 | main_mod = self.shell.new_main_mod() | |
1599 |
|
||||
1600 | prog_ns = main_mod.__dict__ |
|
1596 | prog_ns = main_mod.__dict__ | |
1601 | prog_ns['__name__'] = name |
|
1597 | prog_ns['__name__'] = name | |
1602 |
|
||||
1603 |
|
1598 | |||
1604 | # Since '%run foo' emulates 'python foo.py' at the cmd line, we must |
|
1599 | # Since '%run foo' emulates 'python foo.py' at the cmd line, we must | |
1605 | # set the __file__ global in the script's namespace |
|
1600 | # set the __file__ global in the script's namespace |
@@ -26,7 +26,7 b' import sys' | |||||
26 |
|
26 | |||
27 | class A(object): |
|
27 | class A(object): | |
28 | def __del__(self): |
|
28 | def __del__(self): | |
29 | print 'obj_del.py: object A deleted' |
|
29 | print 'obj_del.py: object A deleted' | |
30 |
|
30 | |||
31 | a = A() |
|
31 | a = A() | |
32 |
|
32 |
@@ -2,12 +2,15 b'' | |||||
2 |
|
2 | |||
3 | The problem is related to https://bugs.launchpad.net/ipython/+bug/269966 |
|
3 | The problem is related to https://bugs.launchpad.net/ipython/+bug/269966 | |
4 |
|
4 | |||
5 |
The original fix for that appeared to work, but JD Hunter found a |
|
5 | The original fix for that appeared to work, but John D. Hunter found a | |
6 |
example which, when run twice in a row, would break. The problem |
|
6 | matplotlib example which, when run twice in a row, would break. The problem | |
7 | references held by open figures to internals of Tkinter. |
|
7 | were references held by open figures to internals of Tkinter. | |
8 |
|
8 | |||
9 |
This code reproduces the problem that John saw, without matplotlib. |
|
9 | This code reproduces the problem that John saw, without matplotlib. | |
10 | thus use it for our test suite. |
|
10 | ||
|
11 | This script is meant to be called by other parts of the test suite that call it | |||
|
12 | via %run as if it were executed interactively by the user. As of 2009-04-13, | |||
|
13 | test_magic.py calls it. | |||
11 | """ |
|
14 | """ | |
12 |
|
15 | |||
13 | #----------------------------------------------------------------------------- |
|
16 | #----------------------------------------------------------------------------- |
@@ -51,18 +51,18 b' def test_reset():' | |||||
51 | def test_user_setup(): |
|
51 | def test_user_setup(): | |
52 | # use a lambda to pass kwargs to the generator |
|
52 | # use a lambda to pass kwargs to the generator | |
53 | user_setup = lambda a,k: iplib.user_setup(*a,**k) |
|
53 | user_setup = lambda a,k: iplib.user_setup(*a,**k) | |
54 | kw = dict(mode='install',interactive=False) |
|
54 | kw = dict(mode='install', interactive=False) | |
55 |
|
55 | |||
56 | # Call the user setup and verify that the directory exists |
|
56 | # Call the user setup and verify that the directory exists | |
57 | yield user_setup, (ip.options.ipythondir,''),kw |
|
57 | yield user_setup, (ip.options.ipythondir,''), kw | |
58 | yield os.path.isdir,ip.options.ipythondir |
|
58 | yield os.path.isdir, ip.options.ipythondir | |
59 |
|
59 | |||
60 | # Now repeat the operation with a non-existent directory. Check both that |
|
60 | # Now repeat the operation with a non-existent directory. Check both that | |
61 | # the call succeeds and that the directory is created. |
|
61 | # the call succeeds and that the directory is created. | |
62 | tmpdir = tempfile.mktemp(prefix='ipython-test-') |
|
62 | tmpdir = tempfile.mktemp(prefix='ipython-test-') | |
63 | try: |
|
63 | try: | |
64 | yield user_setup, (tmpdir,''),kw |
|
64 | yield user_setup, (tmpdir,''), kw | |
65 | yield os.path.isdir,tmpdir |
|
65 | yield os.path.isdir, tmpdir | |
66 | finally: |
|
66 | finally: | |
67 | # In this case, clean up the temp dir once done |
|
67 | # In this case, clean up the temp dir once done | |
68 | shutil.rmtree(tmpdir) |
|
68 | shutil.rmtree(tmpdir) |
General Comments 0
You need to be logged in to leave comments.
Login now