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
ed0473cf
Kaydet (Commit)
ed0473cf
authored
Şub 26, 2011
tarafından
Vinay Sajip
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #9941: Fixed TimedRotatingHandler test issues.
üst
2a4c0f8b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
6 deletions
+36
-6
test_logging.py
Lib/test/test_logging.py
+36
-6
No files found.
Lib/test/test_logging.py
Dosyayı görüntüle @
ed0473cf
#!/usr/bin/env python
#
# Copyright 2001-201
0
by Vinay Sajip. All Rights Reserved.
# Copyright 2001-201
1
by Vinay Sajip. All Rights Reserved.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose and without fee is hereby granted,
...
...
@@ -18,7 +18,7 @@
"""Test harness for the logging module. Run all tests.
Copyright (C) 2001-201
0
Vinay Sajip. All Rights Reserved.
Copyright (C) 2001-201
1
Vinay Sajip. All Rights Reserved.
"""
import
logging
...
...
@@ -2044,13 +2044,43 @@ for when, exp in (('S', 1),
(
'M'
,
60
),
(
'H'
,
60
*
60
),
(
'D'
,
60
*
60
*
24
),
(
'MIDNIGHT'
,
60
*
60
*
2
3
),
(
'MIDNIGHT'
,
60
*
60
*
2
4
),
# current time (epoch start) is a Thursday, W0 means Monday
(
'W0'
,
secs
(
days
=
4
,
hours
=
23
)),):
(
'W0'
,
secs
(
days
=
4
,
hours
=
24
)),
):
def
test_compute_rollover
(
self
,
when
=
when
,
exp
=
exp
):
rh
=
logging
.
handlers
.
TimedRotatingFileHandler
(
self
.
fn
,
when
=
when
,
interval
=
1
,
backupCount
=
0
)
self
.
assertEqual
(
exp
,
rh
.
computeRollover
(
0.0
))
self
.
fn
,
when
=
when
,
interval
=
1
,
backupCount
=
0
,
utc
=
True
)
currentTime
=
0.0
actual
=
rh
.
computeRollover
(
currentTime
)
if
exp
!=
actual
:
# Failures occur on some systems for MIDNIGHT and W0.
# Print detailed calculation for MIDNIGHT so we can try to see
# what's going on
import
time
if
when
==
'MIDNIGHT'
:
try
:
if
rh
.
utc
:
t
=
time
.
gmtime
(
currentTime
)
else
:
t
=
time
.
localtime
(
currentTime
)
currentHour
=
t
[
3
]
currentMinute
=
t
[
4
]
currentSecond
=
t
[
5
]
# r is the number of seconds left between now and midnight
r
=
logging
.
handlers
.
_MIDNIGHT
-
((
currentHour
*
60
+
currentMinute
)
*
60
+
currentSecond
)
result
=
currentTime
+
r
print
(
't:
%
s (
%
s)'
%
(
t
,
rh
.
utc
),
file
=
sys
.
stderr
)
print
(
'currentHour:
%
s'
%
currentHour
,
file
=
sys
.
stderr
)
print
(
'currentMinute:
%
s'
%
currentMinute
,
file
=
sys
.
stderr
)
print
(
'currentSecond:
%
s'
%
currentSecond
,
file
=
sys
.
stderr
)
print
(
'r:
%
s'
%
r
,
file
=
sys
.
stderr
)
print
(
'result:
%
s'
%
result
,
file
=
sys
.
stderr
)
except
Exception
:
print
(
'exception in diagnostic code:
%
s'
%
sys
.
exc_info
()[
1
],
file
=
sys
.
stderr
)
self
.
assertEqual
(
exp
,
actual
)
rh
.
close
()
setattr
(
TimedRotatingFileHandlerTest
,
"test_compute_rollover_
%
s"
%
when
,
test_compute_rollover
)
...
...
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