Show More
@@ -170,6 +170,25 b' class TestMagicRunSimple(tt.TempFileMixin):' | |||||
170 | "a = A()\n") |
|
170 | "a = A()\n") | |
171 | self.mktmp(src) |
|
171 | self.mktmp(src) | |
172 | tt.ipexec_validate(self.fname, 'object A deleted') |
|
172 | tt.ipexec_validate(self.fname, 'object A deleted') | |
|
173 | ||||
|
174 | def test_aggressive_namespace_cleanup(self): | |||
|
175 | """Test that namespace cleanup is not too aggressive GH-238 | |||
|
176 | ||||
|
177 | returning from another run magic deletes the namespace""" | |||
|
178 | # see ticket https://github.com/ipython/ipython/issues/238 | |||
|
179 | class secondtmp(tt.TempFileMixin): pass | |||
|
180 | empty = secondtmp() | |||
|
181 | empty.mktmp('') | |||
|
182 | src = ("ip = get_ipython()\n" | |||
|
183 | "for i in range(5):\n" | |||
|
184 | " try:\n" | |||
|
185 | " ip.magic('run %s')\n" | |||
|
186 | " except NameError, e:\n" | |||
|
187 | " print i;break\n" % empty.fname) | |||
|
188 | self.mktmp(src) | |||
|
189 | _ip.magic('run %s' % self.fname) | |||
|
190 | _ip.runlines('ip == get_ipython()') | |||
|
191 | tt.assert_equals(_ip.user_ns['i'], 5) | |||
173 |
|
192 | |||
174 | @dec.skip_win32 |
|
193 | @dec.skip_win32 | |
175 | def test_tclass(self): |
|
194 | def test_tclass(self): |
General Comments 0
You need to be logged in to leave comments.
Login now