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