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
d8b16ab2
Kaydet (Commit)
d8b16ab2
authored
Kas 01, 2009
tarafından
Antoine Pitrou
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fix and improve some assertions in test_site
üst
9c48da74
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
8 deletions
+9
-8
test_site.py
Lib/test/test_site.py
+9
-8
No files found.
Lib/test/test_site.py
Dosyayı görüntüle @
d8b16ab2
...
@@ -70,9 +70,9 @@ class HelperFunctionsTests(unittest.TestCase):
...
@@ -70,9 +70,9 @@ class HelperFunctionsTests(unittest.TestCase):
def
pth_file_tests
(
self
,
pth_file
):
def
pth_file_tests
(
self
,
pth_file
):
"""Contain common code for testing results of reading a .pth file"""
"""Contain common code for testing results of reading a .pth file"""
self
.
assertTrue
(
pth_file
.
imported
in
sys
.
modules
,
self
.
assertTrue
(
pth_file
.
imported
in
sys
.
modules
,
"
%
s not in sys.
path
"
%
pth_file
.
imported
)
"
%
s not in sys.
modules
"
%
pth_file
.
imported
)
self
.
assert
True
(
site
.
makepath
(
pth_file
.
good_dir_path
)[
0
]
in
sys
.
path
)
self
.
assert
In
(
site
.
makepath
(
pth_file
.
good_dir_path
)[
0
],
sys
.
path
)
self
.
assert
True
(
not
os
.
path
.
exists
(
pth_file
.
bad_dir_path
))
self
.
assert
False
(
os
.
path
.
exists
(
pth_file
.
bad_dir_path
))
def
test_addpackage
(
self
):
def
test_addpackage
(
self
):
# Make sure addpackage() imports if the line starts with 'import',
# Make sure addpackage() imports if the line starts with 'import',
...
@@ -104,7 +104,7 @@ class HelperFunctionsTests(unittest.TestCase):
...
@@ -104,7 +104,7 @@ class HelperFunctionsTests(unittest.TestCase):
def
test_s_option
(
self
):
def
test_s_option
(
self
):
usersite
=
site
.
USER_SITE
usersite
=
site
.
USER_SITE
self
.
assert
True
(
usersite
in
sys
.
path
)
self
.
assert
In
(
usersite
,
sys
.
path
)
rc
=
subprocess
.
call
([
sys
.
executable
,
'-c'
,
rc
=
subprocess
.
call
([
sys
.
executable
,
'-c'
,
'import sys; sys.exit(
%
r in sys.path)'
%
usersite
])
'import sys; sys.exit(
%
r in sys.path)'
%
usersite
])
...
@@ -140,7 +140,8 @@ class HelperFunctionsTests(unittest.TestCase):
...
@@ -140,7 +140,8 @@ class HelperFunctionsTests(unittest.TestCase):
site
.
USER_BASE
=
None
site
.
USER_BASE
=
None
with
EnvironmentVarGuard
()
as
environ
:
with
EnvironmentVarGuard
()
as
environ
:
environ
[
'PYTHONUSERBASE'
]
=
'xoxo'
environ
[
'PYTHONUSERBASE'
]
=
'xoxo'
self
.
assertTrue
(
site
.
getuserbase
()
.
startswith
(
'xoxo'
))
self
.
assertTrue
(
site
.
getuserbase
()
.
startswith
(
'xoxo'
),
site
.
getuserbase
())
def
test_getusersitepackages
(
self
):
def
test_getusersitepackages
(
self
):
site
.
USER_SITE
=
None
site
.
USER_SITE
=
None
...
@@ -149,14 +150,14 @@ class HelperFunctionsTests(unittest.TestCase):
...
@@ -149,14 +150,14 @@ class HelperFunctionsTests(unittest.TestCase):
# the call sets USER_BASE *and* USER_SITE
# the call sets USER_BASE *and* USER_SITE
self
.
assertEquals
(
site
.
USER_SITE
,
user_site
)
self
.
assertEquals
(
site
.
USER_SITE
,
user_site
)
self
.
assertTrue
(
user_site
.
startswith
(
site
.
USER_BASE
))
self
.
assertTrue
(
user_site
.
startswith
(
site
.
USER_BASE
)
,
user_site
)
def
test_getsitepackages
(
self
):
def
test_getsitepackages
(
self
):
site
.
PREFIXES
=
[
'xoxo'
]
site
.
PREFIXES
=
[
'xoxo'
]
dirs
=
site
.
getsitepackages
()
dirs
=
site
.
getsitepackages
()
if
sys
.
platform
in
(
'os2emx'
,
'riscos'
):
if
sys
.
platform
in
(
'os2emx'
,
'riscos'
):
self
.
assert
True
(
len
(
dirs
),
1
)
self
.
assert
Equal
(
len
(
dirs
),
1
)
wanted
=
os
.
path
.
join
(
'xoxo'
,
'Lib'
,
'site-packages'
)
wanted
=
os
.
path
.
join
(
'xoxo'
,
'Lib'
,
'site-packages'
)
self
.
assertEquals
(
dirs
[
0
],
wanted
)
self
.
assertEquals
(
dirs
[
0
],
wanted
)
elif
os
.
sep
==
'/'
:
elif
os
.
sep
==
'/'
:
...
@@ -176,7 +177,7 @@ class HelperFunctionsTests(unittest.TestCase):
...
@@ -176,7 +177,7 @@ class HelperFunctionsTests(unittest.TestCase):
if
sys
.
platform
==
"darwin"
:
if
sys
.
platform
==
"darwin"
:
site
.
PREFIXES
=
[
'Python.framework'
]
site
.
PREFIXES
=
[
'Python.framework'
]
dirs
=
site
.
getsitepackages
()
dirs
=
site
.
getsitepackages
()
self
.
assert
True
(
len
(
dirs
),
4
)
self
.
assert
Equal
(
len
(
dirs
),
4
)
wanted
=
os
.
path
.
join
(
'~'
,
'Library'
,
'Python'
,
wanted
=
os
.
path
.
join
(
'~'
,
'Library'
,
'Python'
,
sys
.
version
[:
3
],
'site-packages'
)
sys
.
version
[:
3
],
'site-packages'
)
self
.
assertEquals
(
dirs
[
2
],
os
.
path
.
expanduser
(
wanted
))
self
.
assertEquals
(
dirs
[
2
],
os
.
path
.
expanduser
(
wanted
))
...
...
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