Show More
@@ -138,7 +138,7 b' class TestMagicRunSimple(tt.TempFileMixin):' | |||
|
138 | 138 | src = ("class foo: pass\n" |
|
139 | 139 | "def f(): return foo()") |
|
140 | 140 | self.mktmp(src) |
|
141 |
_ip.magic('run |
|
|
141 | _ip.magic('run %s' % self.fname) | |
|
142 | 142 | _ip.runlines('t = isinstance(f(), foo)') |
|
143 | 143 | nt.assert_true(_ip.user_ns['t']) |
|
144 | 144 |
@@ -14,6 +14,7 b' Tests for testing.tools' | |||
|
14 | 14 | #----------------------------------------------------------------------------- |
|
15 | 15 | # Imports |
|
16 | 16 | #----------------------------------------------------------------------------- |
|
17 | from __future__ import with_statement | |
|
17 | 18 | |
|
18 | 19 | import os |
|
19 | 20 | import sys |
@@ -21,7 +22,7 b' import sys' | |||
|
21 | 22 | import nose.tools as nt |
|
22 | 23 | |
|
23 | 24 | from IPython.testing import decorators as dec |
|
24 |
from IPython.testing |
|
|
25 | from IPython.testing import tools as tt | |
|
25 | 26 | |
|
26 | 27 | #----------------------------------------------------------------------------- |
|
27 | 28 | # Tests |
@@ -30,32 +31,44 b' from IPython.testing.tools import full_path, parse_test_output' | |||
|
30 | 31 | @dec.skip_win32 |
|
31 | 32 | def test_full_path_posix(): |
|
32 | 33 | spath = '/foo/bar.py' |
|
33 | result = full_path(spath,['a.txt','b.txt']) | |
|
34 | result = tt.full_path(spath,['a.txt','b.txt']) | |
|
34 | 35 | nt.assert_equal(result, ['/foo/a.txt', '/foo/b.txt']) |
|
35 | 36 | spath = '/foo' |
|
36 | result = full_path(spath,['a.txt','b.txt']) | |
|
37 | result = tt.full_path(spath,['a.txt','b.txt']) | |
|
37 | 38 | nt.assert_equal(result, ['/a.txt', '/b.txt']) |
|
38 | result = full_path(spath,'a.txt') | |
|
39 | result = tt.full_path(spath,'a.txt') | |
|
39 | 40 | nt.assert_equal(result, ['/a.txt']) |
|
40 | 41 | |
|
41 | 42 | |
|
42 | 43 | @dec.skip_if_not_win32 |
|
43 | 44 | def test_full_path_win32(): |
|
44 | 45 | spath = 'c:\\foo\\bar.py' |
|
45 | result = full_path(spath,['a.txt','b.txt']) | |
|
46 | result = tt.full_path(spath,['a.txt','b.txt']) | |
|
46 | 47 | nt.assert_equal(result, ['c:\\foo\\a.txt', 'c:\\foo\\b.txt']) |
|
47 | 48 | spath = 'c:\\foo' |
|
48 | result = full_path(spath,['a.txt','b.txt']) | |
|
49 | result = tt.full_path(spath,['a.txt','b.txt']) | |
|
49 | 50 | nt.assert_equal(result, ['c:\\a.txt', 'c:\\b.txt']) |
|
50 | result = full_path(spath,'a.txt') | |
|
51 | result = tt.full_path(spath,'a.txt') | |
|
51 | 52 | nt.assert_equal(result, ['c:\\a.txt']) |
|
52 | 53 | |
|
53 | ||
|
54 | ||
|
55 | @dec.parametric | |
|
54 | 56 | def test_parser(): |
|
55 | 57 | err = ("FAILED (errors=1)", 1, 0) |
|
56 | 58 | fail = ("FAILED (failures=1)", 0, 1) |
|
57 | 59 | both = ("FAILED (errors=1, failures=1)", 1, 1) |
|
58 | 60 | for txt, nerr, nfail in [err, fail, both]: |
|
59 | nerr1, nfail1 = parse_test_output(txt) | |
|
60 |
yield |
|
|
61 |
yield |
|
|
61 | nerr1, nfail1 = tt.parse_test_output(txt) | |
|
62 | yield nt.assert_equal(nerr, nerr1) | |
|
63 | yield nt.assert_equal(nfail, nfail1) | |
|
64 | ||
|
65 | ||
|
66 | @dec.parametric | |
|
67 | def test_temp_pyfile(): | |
|
68 | src = 'pass\n' | |
|
69 | fname, fh = tt.temp_pyfile(src) | |
|
70 | yield nt.assert_true(os.path.isfile(fname)) | |
|
71 | fh.close() | |
|
72 | with open(fname) as fh2: | |
|
73 | src2 = fh2.read() | |
|
74 | yield nt.assert_equal(src2, src) |
General Comments 0
You need to be logged in to leave comments.
Login now