Show More
@@ -6,6 +6,9 b' verify subtle object deletion and reference counting issues, the %run tests' | |||
|
6 | 6 | will be kept in this separate file. This makes it easier to aggregate in one |
|
7 | 7 | place the tricks needed to handle it; most other magics are much easier to test |
|
8 | 8 | and we do so in a common test_magic file. |
|
9 | ||
|
10 | Note that any test using `run -i` should make sure to do a `reset` afterwards, | |
|
11 | as otherwise it may influence later tests. | |
|
9 | 12 | """ |
|
10 | 13 | |
|
11 | 14 | # Copyright (c) IPython Development Team. |
@@ -317,12 +320,18 b' tclass.py: deleting object: C-third' | |||
|
317 | 320 | src = "yy = zz\n" |
|
318 | 321 | self.mktmp(src) |
|
319 | 322 | _ip.run_cell("zz = 23") |
|
323 | try: | |
|
320 | 324 | _ip.magic('run -i %s' % self.fname) |
|
321 | 325 | nt.assert_equal(_ip.user_ns['yy'], 23) |
|
326 | finally: | |
|
322 | 327 | _ip.magic('reset -f') |
|
328 | ||
|
323 | 329 | _ip.run_cell("zz = 23") |
|
330 | try: | |
|
324 | 331 | _ip.magic('run -i %s' % self.fname) |
|
325 | 332 | nt.assert_equal(_ip.user_ns['yy'], 23) |
|
333 | finally: | |
|
334 | _ip.magic('reset -f') | |
|
326 | 335 | |
|
327 | 336 | def test_unicode(self): |
|
328 | 337 | """Check that files in odd encodings are accepted.""" |
@@ -505,8 +514,11 b' def test_run__name__():' | |||
|
505 | 514 | _ip.magic('run -n {}'.format(path)) |
|
506 | 515 | nt.assert_equal(_ip.user_ns.pop('q'), 'foo') |
|
507 | 516 | |
|
517 | try: | |
|
508 | 518 | _ip.magic('run -i -n {}'.format(path)) |
|
509 | 519 | nt.assert_equal(_ip.user_ns.pop('q'), 'foo') |
|
520 | finally: | |
|
521 | _ip.magic('reset -f') | |
|
510 | 522 | |
|
511 | 523 | |
|
512 | 524 | def test_run_tb(): |
General Comments 0
You need to be logged in to leave comments.
Login now