Close handler opened in test.

This commit is contained in:
Vinay Sajip 2011-05-06 07:19:41 +01:00
parent 1c7b7f7fbe
commit 89c8862ee5

View file

@ -3484,6 +3484,7 @@ class TimedRotatingFileHandlerTest(BaseFileTest):
def test_rollover(self):
fh = logging.handlers.TimedRotatingFileHandler(self.fn, 'S',
backupCount=1)
try:
r = logging.makeLogRecord({'msg': 'testing'})
fh.emit(r)
self.assertLogFile(self.fn)
@ -3506,7 +3507,8 @@ class TimedRotatingFileHandlerTest(BaseFileTest):
for fn in (fn1, fn2):
if os.path.exists(fn):
self.rmfiles.append(fn)
finally:
fh.close()
def test_invalid(self):
assertRaises = self.assertRaises