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
c091a576
Kaydet (Commit)
c091a576
authored
Ara 13, 2013
tarafından
Brett Cannon
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #19704: Port test.test_threaded_import to PEP 451
üst
706a7296
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
test_threaded_import.py
Lib/test/test_threaded_import.py
+6
-6
No files found.
Lib/test/test_threaded_import.py
Dosyayı görüntüle @
c091a576
...
...
@@ -57,7 +57,7 @@ circular_imports_modules = {
}
class
Finder
:
"""A dummy finder to detect concurrent access to its find_
module
()
"""A dummy finder to detect concurrent access to its find_
spec
()
method."""
def
__init__
(
self
):
...
...
@@ -65,8 +65,8 @@ class Finder:
self
.
x
=
0
self
.
lock
=
threading
.
Lock
()
def
find_
module
(
self
,
name
,
path
=
None
):
# Simulate some thread-unsafe behaviour. If calls to find_
module
()
def
find_
spec
(
self
,
name
,
path
=
None
,
target
=
None
):
# Simulate some thread-unsafe behaviour. If calls to find_
spec
()
# are properly serialized, `x` will end up the same as `numcalls`.
# Otherwise not.
assert
imp
.
lock_held
()
...
...
@@ -80,7 +80,7 @@ class FlushingFinder:
"""A dummy finder which flushes sys.path_importer_cache when it gets
called."""
def
find_
module
(
self
,
name
,
path
=
None
):
def
find_
spec
(
self
,
name
,
path
=
None
,
target
=
None
):
sys
.
path_importer_cache
.
clear
()
...
...
@@ -145,13 +145,13 @@ class ThreadedImportTests(unittest.TestCase):
# dedicated meta_path entry.
flushing_finder
=
FlushingFinder
()
def
path_hook
(
path
):
finder
.
find_
module
(
''
)
finder
.
find_
spec
(
''
)
raise
ImportError
sys
.
path_hooks
.
insert
(
0
,
path_hook
)
sys
.
meta_path
.
append
(
flushing_finder
)
try
:
# Flush the cache a first time
flushing_finder
.
find_
module
(
''
)
flushing_finder
.
find_
spec
(
''
)
numtests
=
self
.
check_parallel_module_init
()
self
.
assertGreater
(
finder
.
numcalls
,
0
)
self
.
assertEqual
(
finder
.
x
,
finder
.
numcalls
)
...
...
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