Commit 6fda5a45 authored by Stefan Behnel's avatar Stefan Behnel

avoid test dependency on IPython's "nose" test helpers

parent 2657e9b3
...@@ -4,10 +4,10 @@ ...@@ -4,10 +4,10 @@
"""Tests for the Cython magics extension.""" """Tests for the Cython magics extension."""
import os import os
import sys
try: try:
from IPython.testing.globalipapp import get_ipython from IPython.testing.globalipapp import get_ipython
from IPython.testing import decorators as dec
from IPython.utils import py3compat from IPython.utils import py3compat
except: except:
__test__ = False __test__ = False
...@@ -20,6 +20,19 @@ code = py3compat.str_to_unicode("""def f(x): ...@@ -20,6 +20,19 @@ code = py3compat.str_to_unicode("""def f(x):
""") """)
if sys.platform == 'win32':
# not using IPython's decorators here because they depend on "nose"
try:
from unittest import skip as skip_win32
except ImportError:
# poor dev's silent @unittest.skip()
def skip_win32(f):
return lambda self: None
else:
def skip_win32(f):
return f
class TestIPythonMagic(CythonTest): class TestIPythonMagic(CythonTest):
def setUp(self): def setUp(self):
...@@ -31,7 +44,7 @@ class TestIPythonMagic(CythonTest): ...@@ -31,7 +44,7 @@ class TestIPythonMagic(CythonTest):
result = ip.run_cell_magic('cython_inline', '', 'return a+b') result = ip.run_cell_magic('cython_inline', '', 'return a+b')
self.assertEqual(result, 30) self.assertEqual(result, 30)
@dec.skip_win32 @skip_win32
def test_cython_pyximport(self): def test_cython_pyximport(self):
module_name = '_test_cython_pyximport' module_name = '_test_cython_pyximport'
ip.run_cell_magic('cython_pyximport', module_name, code) ip.run_cell_magic('cython_pyximport', module_name, code)
...@@ -57,7 +70,7 @@ class TestIPythonMagic(CythonTest): ...@@ -57,7 +70,7 @@ class TestIPythonMagic(CythonTest):
ip.ex('import mymodule; g = mymodule.f(10)') ip.ex('import mymodule; g = mymodule.f(10)')
self.assertEqual(ip.user_ns['g'], 20.0) self.assertEqual(ip.user_ns['g'], 20.0)
@dec.skip_win32 @skip_win32
def test_extlibs(self): def test_extlibs(self):
code = py3compat.str_to_unicode(""" code = py3compat.str_to_unicode("""
from libc.math cimport sin from libc.math cimport sin
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment