Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Gwenaël Samain
cython
Commits
6fda5a45
Commit
6fda5a45
authored
Jun 27, 2014
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avoid test dependency on IPython's "nose" test helpers
parent
2657e9b3
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
3 deletions
+16
-3
Cython/Build/Tests/TestIpythonMagic.py
Cython/Build/Tests/TestIpythonMagic.py
+16
-3
No files found.
Cython/Build/Tests/TestIpythonMagic.py
View file @
6fda5a45
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment