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