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
32538fc1
Commit
32538fc1
authored
Oct 01, 2017
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Avoid calling undefined names if IPython import fails.
parent
13349652
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
4 deletions
+12
-4
Cython/Build/Tests/TestIpythonMagic.py
Cython/Build/Tests/TestIpythonMagic.py
+12
-4
No files found.
Cython/Build/Tests/TestIpythonMagic.py
View file @
32538fc1
...
@@ -3,19 +3,26 @@
...
@@ -3,19 +3,26 @@
"""Tests for the Cython magics extension."""
"""Tests for the Cython magics extension."""
from
__future__
import
absolute_import
import
os
import
os
import
sys
import
sys
from
contextlib
import
contextmanager
from
contextlib
import
contextmanager
from
Cython.Build
import
IpythonMagic
from
Cython.Build
import
IpythonMagic
from
Cython.TestUtils
import
CythonTest
try
:
try
:
from
IPython.testing.globalipapp
import
get_ipython
from
IPython.testing.globalipapp
import
get_ipython
from
IPython.utils
import
py3compat
from
IPython.utils
import
py3compat
except
:
except
:
# Disable tests and fake helpers for initialisation below.
class
_py3compat
(
object
):
def
str_to_unicode
(
self
,
s
):
return
s
__test__
=
False
__test__
=
False
ip
=
None
get_ipython
=
lambda
:
None
else
:
py3compat
=
_py3compat
()
ip
=
get_ipython
()
try
:
try
:
# disable IPython history thread to avoid having to clean it up
# disable IPython history thread to avoid having to clean it up
...
@@ -24,7 +31,8 @@ try:
...
@@ -24,7 +31,8 @@ try:
except
ImportError
:
except
ImportError
:
pass
pass
from
Cython.TestUtils
import
CythonTest
# Initialise IPython after disabling history thread.
ip
=
get_ipython
()
code
=
py3compat
.
str_to_unicode
(
"""
\
code
=
py3compat
.
str_to_unicode
(
"""
\
def f(x):
def f(x):
...
...
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