##// END OF EJS Templates
Using better approach for skipping test if Cython no pres.
Brian Granger -
Show More
@@ -12,34 +12,34 b' code = """def f(x):'
12 12 try:
13 13 import Cython
14 14 except:
15 pass
16 else:
17 def setup():
18 ip = get_ipython()
19 ip.extension_manager.load_extension('cythonmagic')
20
21 def test_cython_inline():
22 ip = get_ipython()
23 ip.ex('a=10; b=20')
24 result = ip.run_cell_magic('cython_inline','','return a+b')
25 nt.assert_equals(result, 30)
26
27 def test_cython_pyximport():
28 module_name = '_test_cython_pyximport'
29 ip = get_ipython()
30 ip.run_cell_magic('cython_pyximport', module_name, code)
31 ip.ex('g = f(10)')
32 nt.assert_equals(ip.user_ns['g'], 20.0)
33 try:
34 os.remove(module_name+'.pyx')
35 except OSError:
36 pass
37
38 def test_cython():
39 ip = get_ipython()
40 ip.run_cell_magic('cython', '', code)
41 ip.ex('g = f(10)')
42 nt.assert_equals(ip.user_ns['g'], 20.0)
15 __test__ = False
16
17 def setup():
18 ip = get_ipython()
19 ip.extension_manager.load_extension('cythonmagic')
20
21 def test_cython_inline():
22 ip = get_ipython()
23 ip.ex('a=10; b=20')
24 result = ip.run_cell_magic('cython_inline','','return a+b')
25 nt.assert_equals(result, 30)
26
27 def test_cython_pyximport():
28 module_name = '_test_cython_pyximport'
29 ip = get_ipython()
30 ip.run_cell_magic('cython_pyximport', module_name, code)
31 ip.ex('g = f(10)')
32 nt.assert_equals(ip.user_ns['g'], 20.0)
33 try:
34 os.remove(module_name+'.pyx')
35 except OSError:
36 pass
37
38 def test_cython():
39 ip = get_ipython()
40 ip.run_cell_magic('cython', '', code)
41 ip.ex('g = f(10)')
42 nt.assert_equals(ip.user_ns['g'], 20.0)
43 43
44 44
45 45
General Comments 0
You need to be logged in to leave comments. Login now