From: Vinay Sajip Date: Thu, 5 May 2011 13:18:33 +0000 (+0100) Subject: Tweaked timed rollover test to allow for test-time delays. X-Git-Tag: v3.3.0a1~2401 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e9a56e8d49fcac2f8c4e4c65f588468f1aeb6a09;p=thirdparty%2FPython%2Fcpython.git Tweaked timed rollover test to allow for test-time delays. --- diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py index 2e6de4cd64ab..fe42594030c7 100644 --- a/Lib/test/test_logging.py +++ b/Lib/test/test_logging.py @@ -3491,8 +3491,12 @@ class TimedRotatingFileHandlerTest(BaseFileTest): fh.emit(r) now = datetime.datetime.now() prevsec = now - datetime.timedelta(seconds=1) - suffix = prevsec.strftime(".%Y-%m-%d_%H-%M-%S") - self.assertLogFile(self.fn + suffix) + earlier = now - datetime.timedelta(seconds=2) + fn1 = self.fn + prevsec.strftime(".%Y-%m-%d_%H-%M-%S") + fn2 = self.fn + earlier.strftime(".%Y-%m-%d_%H-%M-%S") + self.assertTrue(os.path.exists(fn1) or + os.path.exists(fn2), + msg="Neither exists: %s nor %s" % (fn1, fn2)) def test_invalid(self): assertRaises = self.assertRaises