test_logging: Changed TimedRotatingFileHandler tests to use UTC time rather than local time.

This commit is contained in:
Vinay Sajip 2011-02-26 07:18:22 +00:00
parent d032131dcb
commit ec5a2d5e89
1 changed files with 3 additions and 3 deletions

View File

@ -2044,13 +2044,13 @@ for when, exp in (('S', 1),
('M', 60), ('M', 60),
('H', 60 * 60), ('H', 60 * 60),
('D', 60 * 60 * 24), ('D', 60 * 60 * 24),
('MIDNIGHT', 60 * 60 * 23), ('MIDNIGHT', 60 * 60 * 24),
# current time (epoch start) is a Thursday, W0 means Monday # 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): def test_compute_rollover(self, when=when, exp=exp):
rh = logging.handlers.TimedRotatingFileHandler( rh = logging.handlers.TimedRotatingFileHandler(
self.fn, when=when, interval=1, backupCount=0) self.fn, when=when, interval=1, backupCount=0, utc=True)
currentTime = 0.0 currentTime = 0.0
actual = rh.computeRollover(currentTime) actual = rh.computeRollover(currentTime)
if exp != actual: if exp != actual: