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
48f5c4ee
Commit
48f5c4ee
authored
Feb 05, 2009
by
Brett Cannon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement test for sys.path_importer_cache having None for
importlib.machinery.PathFinder.
parent
014bf28e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
2 deletions
+14
-2
Lib/importlib/test/import_/test_path.py
Lib/importlib/test/import_/test_path.py
+14
-2
No files found.
Lib/importlib/test/import_/test_path.py
View file @
48f5c4ee
...
...
@@ -3,6 +3,7 @@ from .. import util
from
.
import
util
as
import_util
from
contextlib
import
nested
from
imp
import
new_module
import
os
import
sys
from
types
import
MethodType
import
unittest
...
...
@@ -191,8 +192,19 @@ class FinderTests(unittest.TestCase):
def
test_path_importer_cache_has_None
(
self
):
# Test that the default hook is used when sys.path_importer_cache
# contains None for a path.
# TODO(brett.cannon) implement
pass
module
=
'<test module>'
importer
=
util
.
mock_modules
(
module
)
path
=
'<test path>'
# XXX Not blackbox.
original_hook
=
machinery
.
PathFinder
.
_default_hook
mock_hook
=
import_util
.
mock_path_hook
(
path
,
importer
=
importer
)
machinery
.
PathFinder
.
_default_hook
=
staticmethod
(
mock_hook
)
try
:
with
util
.
import_state
(
path_importer_cache
=
{
path
:
None
}):
loader
=
machinery
.
PathFinder
.
find_module
(
module
,
path
=
[
path
])
self
.
assert_
(
loader
is
importer
)
finally
:
machinery
.
PathFinder
.
_default_hook
=
original_hook
def
test_path_hooks
(
self
):
# Test that sys.path_hooks is used.
...
...
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