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
7440ba4b
Commit
7440ba4b
authored
Aug 25, 2018
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extend module reimport test to also try reimports without knowing the package.
parent
4bcb6d1c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
0 deletions
+14
-0
tests/run/reimport_from_package.srctree
tests/run/reimport_from_package.srctree
+14
-0
No files found.
tests/run/reimport_from_package.srctree
View file @
7440ba4b
# mode: run
# tag: pep489
PYTHON setup.py build_ext --inplace
PYTHON setup.py build_ext --inplace
PYTHON -c "import a"
PYTHON -c "import a"
...
@@ -35,6 +38,7 @@ assert sys.modules['atest.package.module'] is module, list(sys.modules)
...
@@ -35,6 +38,7 @@ assert sys.modules['atest.package.module'] is module, list(sys.modules)
if sys.version_info >= (3, 5):
if sys.version_info >= (3, 5):
from . import pymodule
from . import pymodule
assert module is pymodule.import_without_package()
######## atest/package/pymodule.py ########
######## atest/package/pymodule.py ########
...
@@ -43,3 +47,13 @@ from ..package import module
...
@@ -43,3 +47,13 @@ from ..package import module
import atest.package.module
import atest.package.module
import a
import a
def import_without_package():
import os.path
import sys
sys.path.insert(0, os.path.dirname(__file__))
sys.path.insert(0, os.path.dirname(os.path.dirname(__file__)))
import module
import package.module
assert package.module is module
return module
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