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
becf5c6d
Kaydet (Commit)
becf5c6d
authored
Mar 08, 2013
tarafından
Vinay Sajip
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #17384: Consolidated cleanup operations in tests.
üst
00e9886b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
4 deletions
+14
-4
test_logging.py
Lib/test/test_logging.py
+14
-4
No files found.
Lib/test/test_logging.py
Dosyayı görüntüle @
becf5c6d
...
@@ -3396,6 +3396,12 @@ class BasicConfigTest(unittest.TestCase):
...
@@ -3396,6 +3396,12 @@ class BasicConfigTest(unittest.TestCase):
self
.
assertEqual
(
logging
.
root
.
level
,
self
.
original_logging_level
)
self
.
assertEqual
(
logging
.
root
.
level
,
self
.
original_logging_level
)
def
test_filename
(
self
):
def
test_filename
(
self
):
def
cleanup
(
h1
,
h2
,
fn
):
h1
.
close
()
h2
.
close
()
os
.
remove
(
fn
)
logging
.
basicConfig
(
filename
=
'test.log'
)
logging
.
basicConfig
(
filename
=
'test.log'
)
self
.
assertEqual
(
len
(
logging
.
root
.
handlers
),
1
)
self
.
assertEqual
(
len
(
logging
.
root
.
handlers
),
1
)
...
@@ -3403,19 +3409,23 @@ class BasicConfigTest(unittest.TestCase):
...
@@ -3403,19 +3409,23 @@ class BasicConfigTest(unittest.TestCase):
self
.
assertIsInstance
(
handler
,
logging
.
FileHandler
)
self
.
assertIsInstance
(
handler
,
logging
.
FileHandler
)
expected
=
logging
.
FileHandler
(
'test.log'
,
'a'
)
expected
=
logging
.
FileHandler
(
'test.log'
,
'a'
)
self
.
addCleanup
(
expected
.
close
)
self
.
assertEqual
(
handler
.
stream
.
mode
,
expected
.
stream
.
mode
)
self
.
assertEqual
(
handler
.
stream
.
mode
,
expected
.
stream
.
mode
)
self
.
assertEqual
(
handler
.
stream
.
name
,
expected
.
stream
.
name
)
self
.
assertEqual
(
handler
.
stream
.
name
,
expected
.
stream
.
name
)
self
.
addCleanup
(
os
.
remove
,
'test.log'
)
self
.
addCleanup
(
cleanup
,
handler
,
expected
,
'test.log'
)
def
test_filemode
(
self
):
def
test_filemode
(
self
):
def
cleanup
(
h1
,
h2
,
fn
):
h1
.
close
()
h2
.
close
()
os
.
remove
(
fn
)
logging
.
basicConfig
(
filename
=
'test.log'
,
filemode
=
'wb'
)
logging
.
basicConfig
(
filename
=
'test.log'
,
filemode
=
'wb'
)
handler
=
logging
.
root
.
handlers
[
0
]
handler
=
logging
.
root
.
handlers
[
0
]
expected
=
logging
.
FileHandler
(
'test.log'
,
'wb'
)
expected
=
logging
.
FileHandler
(
'test.log'
,
'wb'
)
self
.
addCleanup
(
expected
.
close
)
self
.
assertEqual
(
handler
.
stream
.
mode
,
expected
.
stream
.
mode
)
self
.
assertEqual
(
handler
.
stream
.
mode
,
expected
.
stream
.
mode
)
self
.
addCleanup
(
os
.
remove
,
'test.log'
)
self
.
addCleanup
(
cleanup
,
handler
,
expected
,
'test.log'
)
def
test_stream
(
self
):
def
test_stream
(
self
):
stream
=
io
.
StringIO
()
stream
=
io
.
StringIO
()
...
...
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