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
b4162305
Kaydet (Commit)
b4162305
authored
Ara 04, 2010
tarafından
Gregory P. Smith
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
refactor the warning test.
üst
10064e9d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
23 deletions
+11
-23
test_subprocess.py
Lib/test/test_subprocess.py
+11
-23
No files found.
Lib/test/test_subprocess.py
Dosyayı görüntüle @
b4162305
...
...
@@ -59,31 +59,19 @@ class BaseTestCase(unittest.TestCase):
class
DeprecationWarningTests
(
BaseTestCase
):
def
setUp
(
self
):
BaseTestCase
.
setUp
(
self
)
self
.
_saved_warn
=
warnings
.
warn
self
.
_warn_calls
=
[]
warnings
.
warn
=
self
.
_record_warn
def
tearDown
(
self
):
warnings
.
warn
=
self
.
_saved_warn
BaseTestCase
.
tearDown
(
self
)
def
_record_warn
(
self
,
*
args
):
"""A warnings.warn function that records calls."""
self
.
_warn_calls
.
append
(
args
)
self
.
_saved_warn
(
*
args
)
def
testCloseFdsWarning
(
self
):
quick_process
=
[
sys
.
executable
,
"-c"
,
"import sys; sys.exit(0)"
]
subprocess
.
call
(
quick_process
,
close_fds
=
True
)
self
.
assertEqual
([],
self
.
_warn_calls
)
subprocess
.
call
(
quick_process
,
close_fds
=
False
)
self
.
assertEqual
([],
self
.
_warn_calls
)
self
.
assertWarns
(
DeprecationWarning
,
subprocess
.
call
,
quick_process
)
self
.
assertEqual
(
1
,
len
(
self
.
_warn_calls
))
self
.
assertIn
(
'close_fds parameter was not specified'
,
self
.
_warn_calls
[
0
][
0
])
with
warnings
.
catch_warnings
(
record
=
True
)
as
warnlist
:
warnings
.
simplefilter
(
"always"
)
subprocess
.
call
(
quick_process
,
close_fds
=
True
)
self
.
assertEqual
([],
warnlist
)
subprocess
.
call
(
quick_process
,
close_fds
=
False
)
self
.
assertEqual
([],
warnlist
)
with
self
.
assertWarns
(
DeprecationWarning
)
as
wm
:
subprocess
.
Popen
(
quick_process
)
.
wait
()
self
.
assertEqual
(
1
,
len
(
wm
.
warnings
))
self
.
assertIn
(
'close_fds parameter was not specified'
,
str
(
wm
.
warnings
[
0
]))
class
ProcessTestCase
(
BaseTestCase
):
...
...
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