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
f2163e0f
Commit
f2163e0f
authored
Feb 05, 2009
by
Brett Cannon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add tests for using sys.path_hooks by importlib.machinery.PathFinder.
parent
1d53b4ad
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
3 deletions
+11
-3
Lib/importlib/_bootstrap.py
Lib/importlib/_bootstrap.py
+1
-1
Lib/importlib/test/import_/test_path.py
Lib/importlib/test/import_/test_path.py
+10
-2
No files found.
Lib/importlib/_bootstrap.py
View file @
f2163e0f
...
...
@@ -601,7 +601,7 @@ class PathFinder:
@
classmethod
def
_implicit_hooks
(
cls
):
"""Return a list of the implicit path hooks."""
return
[
self
.
_default_hook
,
imp
.
NullImporter
]
return
[
cls
.
_default_hook
,
imp
.
NullImporter
]
@
classmethod
def
_path_hooks
(
cls
,
path
):
...
...
Lib/importlib/test/import_/test_path.py
View file @
f2163e0f
...
...
@@ -208,8 +208,16 @@ class FinderTests(unittest.TestCase):
def
test_path_hooks
(
self
):
# Test that sys.path_hooks is used.
# TODO(brett.cannon) implement
pass
# Test that sys.path_importer_cache is set.
module
=
'<test module>'
path
=
'<test path>'
importer
=
util
.
mock_modules
(
module
)
hook
=
import_util
.
mock_path_hook
(
path
,
importer
=
importer
)
with
util
.
import_state
(
path_hooks
=
[
hook
]):
loader
=
machinery
.
PathFinder
.
find_module
(
module
,
[
path
])
self
.
assert_
(
loader
is
importer
)
self
.
assert_
(
path
in
sys
.
path_importer_cache
)
self
.
assert_
(
sys
.
path_importer_cache
[
path
]
is
importer
)
def
test_implicit_hooks
(
self
):
# Test that the implicit path hooks are 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