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
Kirill Smelkov
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 @@
"""Tests for the Cython magics extension."""
from
__future__
import
absolute_import
import
os
import
sys
from
contextlib
import
contextmanager
from
Cython.Build
import
IpythonMagic
from
Cython.TestUtils
import
CythonTest
try
:
from
IPython.testing.globalipapp
import
get_ipython
from
IPython.utils
import
py3compat
except
:
# Disable tests and fake helpers for initialisation below.
class
_py3compat
(
object
):
def
str_to_unicode
(
self
,
s
):
return
s
__test__
=
False
ip
=
None
else
:
ip
=
get_ipython
()
get_ipython
=
lambda
:
None
py3compat
=
_py3compat
()
try
:
# disable IPython history thread to avoid having to clean it up
...
...
@@ -24,7 +31,8 @@ try:
except
ImportError
:
pass
from
Cython.TestUtils
import
CythonTest
# Initialise IPython after disabling history thread.
ip
=
get_ipython
()
code
=
py3compat
.
str_to_unicode
(
"""
\
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