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
705a1db2
Commit
705a1db2
authored
9 years ago
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rewrite hackish test to make it work in Py3.5
parent
708875fa
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
73 additions
and
34 deletions
+73
-34
tests/run/relativeimport_T542.pyx
tests/run/relativeimport_T542.pyx
+0
-34
tests/run/relativeimport_T542.srctree
tests/run/relativeimport_T542.srctree
+73
-0
No files found.
tests/run/relativeimport_T542.pyx
deleted
100644 → 0
View file @
708875fa
# cython: language_level=3
import
sys
# fool Python we are in distutils
if
sys
.
version_info
>=
(
3
,):
__name__
=
'distutils.cytest_relativeimport_T542'
else
:
__name__
=
b'distutils.cytest_relativeimport_T542'
from
distutils
import
cmd
,
core
,
version
from
.core
import
*
def
test_relative
():
"""
>>> test_relative() == (cmd, core, 'distutils.version')
True
"""
from
.
import
cmd
,
core
from
.
import
(
version
,
core
)
from
.
import
(
version
,
core
,)
from
.version
import
__name__
return
cmd
,
core
,
__name__
def
test_absolute
():
"""
>>> test_absolute() # doctest: +ELLIPSIS
Traceback (most recent call last):
ImportError: No module named ...debug...
"""
import
debug
return
__doc__
=
"""
>>> setup == core.setup
True
"""
This diff is collapsed.
Click to expand it.
tests/run/relativeimport_T542.srctree
0 → 100644
View file @
705a1db2
# mode: run
# tag: import
"""
PYTHON setup.py build_ext -i
PYTHON test_relative_import.py
"""
######## setup.py ########
from Cython.Build.Dependencies import cythonize
from distutils.core import setup
setup(
ext_modules = cythonize("*/*.pyx"),
)
######## test_relative_import.py ########
from relimport.testmod import test_relative, test_absolute
a, bmod, afunc, bfunc = test_relative()
try:
test_absolute()
except ImportError:
pass
else:
assert False, "absolute import succeeded"
import relimport.a
import relimport.bmod
import relimport.testmod
assert relimport.a == a
assert relimport.bmod == bmod
assert afunc() == 'a', afunc
assert bfunc() == 'b', bfunc
######## relimport/__init__.py ########
######## relimport/a.pyx ########
def afunc(): return 'a'
######## relimport/bmod.pyx ########
def bfunc(): return 'b'
######## relimport/testmod.pyx ########
# cython: language_level=3
from relimport import a, bmod
from . import *
def test_relative():
from . import a, bmod
from . import (a, bmod)
from . import (a, bmod,)
from .a import afunc
from .bmod import bfunc
assert afunc() == 'a', afunc()
assert bfunc() == 'b', bfunc()
return a, bmod, afunc, bfunc
def test_absolute():
import bmod
This diff is collapsed.
Click to expand it.
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