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
c1bf677e
Kaydet (Commit)
c1bf677e
authored
Nis 06, 2010
tarafından
Michael Foord
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fix module directory finding logic for dotted paths in unittest test discovery.
üst
ccd8bc8a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
1 deletion
+13
-1
loader.py
Lib/unittest/loader.py
+13
-1
No files found.
Lib/unittest/loader.py
Dosyayı görüntüle @
c1bf677e
...
...
@@ -192,7 +192,7 @@ class TestLoader(object):
top_part
=
start_dir
.
split
(
'.'
)[
0
]
start_dir
=
os
.
path
.
abspath
(
os
.
path
.
dirname
((
the_module
.
__file__
)))
if
set_implicit_top
:
self
.
_top_level_dir
=
os
.
path
.
abspath
(
os
.
path
.
dirname
(
os
.
path
.
dirname
(
sys
.
modules
[
top_part
]
.
__file__
))
)
self
.
_top_level_dir
=
self
.
_get_directory_containing_module
(
top_part
)
sys
.
path
.
remove
(
top_level_dir
)
if
is_not_importable
:
...
...
@@ -201,6 +201,18 @@ class TestLoader(object):
tests
=
list
(
self
.
_find_tests
(
start_dir
,
pattern
))
return
self
.
suiteClass
(
tests
)
def
_get_directory_containing_module
(
self
,
module_name
):
module
=
sys
.
modules
[
module_name
]
full_path
=
os
.
path
.
abspath
(
module
.
__file__
)
if
os
.
path
.
basename
(
full_path
)
.
lower
()
.
startswith
(
'__init__.py'
):
return
os
.
path
.
dirname
(
os
.
path
.
dirname
(
full_path
))
else
:
# here we have been given a module rather than a package - so
# all we can do is search the *same* directory the module is in
# should an exception be raised instead
return
os
.
path
.
dirname
(
full_path
)
def
_get_name_from_path
(
self
,
path
):
path
=
os
.
path
.
splitext
(
os
.
path
.
normpath
(
path
))[
0
]
...
...
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