diff options
author | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2011-05-05 13:18:33 (GMT) |
---|---|---|
committer | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2011-05-05 13:18:33 (GMT) |
commit | e9a56e8d49fcac2f8c4e4c65f588468f1aeb6a09 (patch) | |
tree | 323e6a22cbce35f0e5ccbaa08ab5dc704f16d35b /Lib/test | |
parent | 6c9f8c7e4c24dfb0d1fe335ca4477393085a4628 (diff) | |
download | cpython-e9a56e8d49fcac2f8c4e4c65f588468f1aeb6a09.zip cpython-e9a56e8d49fcac2f8c4e4c65f588468f1aeb6a09.tar.gz cpython-e9a56e8d49fcac2f8c4e4c65f588468f1aeb6a09.tar.bz2 |
Tweaked timed rollover test to allow for test-time delays.
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_logging.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py index 2e6de4c..fe42594 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 |