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
1463a3f8
Kaydet (Commit)
1463a3f8
authored
Eki 14, 2010
tarafından
Georg Brandl
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
#9964: fix running test_compileall under -O and -OO.
üst
1c2a7b7a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
20 deletions
+23
-20
test_compileall.py
Lib/test/test_compileall.py
+23
-20
No files found.
Lib/test/test_compileall.py
Dosyayı görüntüle @
1463a3f8
...
...
@@ -131,22 +131,28 @@ class CommandLineTests(unittest.TestCase):
assert
sys
.
path
[
0
]
==
self
.
directory
,
'Missing path'
del
sys
.
path
[
0
]
def
test_pep3147_paths
(
self
):
# Ensure that the default behavior of compileall's CLI is to create
# PEP 3147 pyc/pyo files.
retcode
=
subprocess
.
call
(
(
sys
.
executable
,
'-m'
,
'compileall'
,
'-q'
,
self
.
pkgdir
))
self
.
assertEqual
(
retcode
,
0
)
# Verify the __pycache__ directory contents.
cachedir
=
os
.
path
.
join
(
self
.
pkgdir
,
'__pycache__'
)
self
.
assertTrue
(
os
.
path
.
exists
(
cachedir
))
ext
=
(
'pyc'
if
__debug__
else
'pyo'
)
expected
=
sorted
(
base
.
format
(
imp
.
get_tag
(),
ext
)
for
base
in
(
'__init__.{}.{}'
,
'bar.{}.{}'
))
self
.
assertEqual
(
sorted
(
os
.
listdir
(
cachedir
)),
expected
)
# Make sure there are no .pyc files in the source directory.
self
.
assertFalse
([
pyc_file
for
pyc_file
in
os
.
listdir
(
self
.
pkgdir
)
if
pyc_file
.
endswith
(
ext
)])
# Ensure that the default behavior of compileall's CLI is to create
# PEP 3147 pyc/pyo files.
for
name
,
ext
,
switch
in
[
(
'normal'
,
'pyc'
,
[]),
(
'optimize'
,
'pyo'
,
[
'-O'
]),
(
'doubleoptimize'
,
'pyo'
,
[
'-OO'
])
]:
def
f
(
self
,
ext
=
ext
,
switch
=
switch
):
retcode
=
subprocess
.
call
(
[
sys
.
executable
]
+
switch
+
[
'-m'
,
'compileall'
,
'-q'
,
self
.
pkgdir
])
self
.
assertEqual
(
retcode
,
0
)
# Verify the __pycache__ directory contents.
cachedir
=
os
.
path
.
join
(
self
.
pkgdir
,
'__pycache__'
)
self
.
assertTrue
(
os
.
path
.
exists
(
cachedir
))
expected
=
sorted
(
base
.
format
(
imp
.
get_tag
(),
ext
)
for
base
in
(
'__init__.{}.{}'
,
'bar.{}.{}'
))
self
.
assertEqual
(
sorted
(
os
.
listdir
(
cachedir
)),
expected
)
# Make sure there are no .pyc files in the source directory.
self
.
assertFalse
([
pyc_file
for
pyc_file
in
os
.
listdir
(
self
.
pkgdir
)
if
pyc_file
.
endswith
(
ext
)])
locals
()[
'test_pep3147_paths_'
+
name
]
=
f
def
test_legacy_paths
(
self
):
# Ensure that with the proper switch, compileall leaves legacy
...
...
@@ -157,10 +163,7 @@ class CommandLineTests(unittest.TestCase):
# Verify the __pycache__ directory contents.
cachedir
=
os
.
path
.
join
(
self
.
pkgdir
,
'__pycache__'
)
self
.
assertFalse
(
os
.
path
.
exists
(
cachedir
))
ext
=
(
'pyc'
if
__debug__
else
'pyo'
)
expected
=
[
base
.
format
(
ext
)
for
base
in
(
'__init__.{}'
,
'bar.{}'
)]
expected
.
extend
([
'__init__.py'
,
'bar.py'
])
expected
.
sort
()
expected
=
sorted
([
'__init__.py'
,
'__init__.pyc'
,
'bar.py'
,
'bar.pyc'
])
self
.
assertEqual
(
sorted
(
os
.
listdir
(
self
.
pkgdir
)),
expected
)
def
test_multiple_runs
(
self
):
...
...
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