Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
e70485e7
Commit
e70485e7
authored
Feb 01, 2009
by
Brett Cannon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move extension module loader tests over to importlib.test.abc.LoaderTests.
parent
d98a6a01
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
4 deletions
+22
-4
Lib/importlib/NOTES
Lib/importlib/NOTES
+0
-1
Lib/importlib/test/extension/test_loader.py
Lib/importlib/test/extension/test_loader.py
+22
-3
No files found.
Lib/importlib/NOTES
View file @
e70485e7
...
...
@@ -4,7 +4,6 @@ to do
* Use test.abc.LoaderTests
+ frozen
+ extension
+ source
* Reorganize support code.
...
...
Lib/importlib/test/extension/test_loader.py
View file @
e70485e7
import
importlib
from
.
import
test_path_hook
from
..
import
abc
from
..
import
support
import
sys
import
unittest
class
LoaderTests
(
unittest
.
TestCase
):
class
LoaderTests
(
abc
.
LoaderTests
):
"""Test load_module() for extension modules."""
...
...
@@ -16,7 +17,7 @@ class LoaderTests(unittest.TestCase):
False
)
return
loader
.
load_module
(
fullname
)
def
test_
success
(
self
):
def
test_
module
(
self
):
with
support
.
uncache
(
test_path_hook
.
NAME
):
module
=
self
.
load_module
(
test_path_hook
.
NAME
)
for
attr
,
value
in
[(
'__name__'
,
test_path_hook
.
NAME
),
...
...
@@ -24,7 +25,25 @@ class LoaderTests(unittest.TestCase):
self
.
assertEqual
(
getattr
(
module
,
attr
),
value
)
self
.
assert_
(
test_path_hook
.
NAME
in
sys
.
modules
)
def
test_failure
(
self
):
def
test_package
(
self
):
# Extensions are not found in packages.
pass
def
test_lacking_parent
(
self
):
# Extensions are not found in packages.
pass
def
test_module_reuse
(
self
):
with
support
.
uncache
(
test_path_hook
.
NAME
):
module1
=
self
.
load_module
(
test_path_hook
.
NAME
)
module2
=
self
.
load_module
(
test_path_hook
.
NAME
)
self
.
assert_
(
module1
is
module2
)
def
test_state_after_failure
(
self
):
# No easy way to trigger a failure after a successful import.
pass
def
test_unloadable
(
self
):
self
.
assertRaises
(
ImportError
,
self
.
load_module
,
'asdfjkl;'
)
...
...
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