Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
1f9bcd38
Kaydet (Commit)
1f9bcd38
authored
Şub 05, 2009
tarafından
Brett Cannon
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Add tests for using sys.path_hooks by importlib.machinery.PathFinder.
üst
5874ef16
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
3 deletions
+11
-3
_bootstrap.py
Lib/importlib/_bootstrap.py
+1
-1
test_path.py
Lib/importlib/test/import_/test_path.py
+10
-2
No files found.
Lib/importlib/_bootstrap.py
Dosyayı görüntüle @
1f9bcd38
...
@@ -601,7 +601,7 @@ class PathFinder:
...
@@ -601,7 +601,7 @@ class PathFinder:
@classmethod
@classmethod
def
_implicit_hooks
(
cls
):
def
_implicit_hooks
(
cls
):
"""Return a list of the implicit path hooks."""
"""Return a list of the implicit path hooks."""
return
[
self
.
_default_hook
,
imp
.
NullImporter
]
return
[
cls
.
_default_hook
,
imp
.
NullImporter
]
@classmethod
@classmethod
def
_path_hooks
(
cls
,
path
):
def
_path_hooks
(
cls
,
path
):
...
...
Lib/importlib/test/import_/test_path.py
Dosyayı görüntüle @
1f9bcd38
...
@@ -208,8 +208,16 @@ class FinderTests(unittest.TestCase):
...
@@ -208,8 +208,16 @@ class FinderTests(unittest.TestCase):
def
test_path_hooks
(
self
):
def
test_path_hooks
(
self
):
# Test that sys.path_hooks is used.
# Test that sys.path_hooks is used.
# TODO(brett.cannon) implement
# Test that sys.path_importer_cache is set.
pass
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
):
def
test_implicit_hooks
(
self
):
# Test that the implicit path hooks are used.
# 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