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
62f68ed3
Kaydet (Commit)
62f68ed3
authored
Agu 04, 2010
tarafından
Antoine Pitrou
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Factor out stripping of interpreter debug output in test.support.strip_python_stderr()
üst
f96482e9
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
3 deletions
+13
-3
support.py
Lib/test/support.py
+10
-0
test_subprocess.py
Lib/test/test_subprocess.py
+1
-1
test_threading.py
Lib/test/test_threading.py
+2
-2
No files found.
Lib/test/support.py
Dosyayı görüntüle @
62f68ed3
...
...
@@ -1243,3 +1243,13 @@ def swap_item(obj, item, new_val):
yield
finally
:
del
obj
[
item
]
def
strip_python_stderr
(
stderr
):
"""Strip the stderr of a Python process from potential debug output
emitted by the interpreter.
This will typically be run on the result of the communicate() method
of a subprocess.Popen object.
"""
stderr
=
re
.
sub
(
br
"
\
[
\
d+ refs
\
]
\r
?
\n
?$"
,
b
""
,
stderr
)
.
strip
()
return
stderr
Lib/test/test_subprocess.py
Dosyayı görüntüle @
62f68ed3
...
...
@@ -53,7 +53,7 @@ class BaseTestCase(unittest.TestCase):
# In a debug build, stuff like "[6580 refs]" is printed to stderr at
# shutdown time. That frustrates tests trying to check stderr produced
# from a spawned Python process.
actual
=
re
.
sub
(
"
\
[
\
d+ refs
\
]
\r
?
\n
?$"
,
""
,
stderr
.
decode
())
.
encode
(
)
actual
=
support
.
strip_python_stderr
(
stderr
)
self
.
assertEqual
(
actual
,
expected
,
msg
)
...
...
Lib/test/test_threading.py
Dosyayı görüntüle @
62f68ed3
# Very rudimentary test of threading module
import
test.support
from
test.support
import
verbose
from
test.support
import
verbose
,
strip_python_stderr
import
random
import
re
import
sys
...
...
@@ -350,7 +350,7 @@ class ThreadTests(BaseTestCase):
stdout
,
stderr
=
p
.
communicate
()
self
.
assertEqual
(
stdout
.
strip
(),
b
"Woke up, sleep function is: <built-in function sleep>"
)
stderr
=
re
.
sub
(
br
"^
\
[
\
d+ refs
\
]"
,
b
""
,
stderr
,
re
.
MULTILINE
)
.
strip
(
)
stderr
=
strip_python_stderr
(
stderr
)
self
.
assertEqual
(
stderr
,
b
""
)
def
test_enumerate_after_join
(
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