From a6ff806d2a1d862b33a48351161ad753a881cc1a Mon Sep 17 00:00:00 2001 From: Nikolaus Schulz Date: Sun, 1 Oct 2006 02:32:19 +0000 Subject: [PATCH] Fixed unittest failure by updating --suffix testcase: archivemail used to expand date directives in the suffix to the current date, but rev. 94 changed that to the archive cut off date. Based on analysis by Peter Poeml. Thanks, Peter. --- test_archivemail.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/test_archivemail.py b/test_archivemail.py index 788a866..3ac6c84 100755 --- a/test_archivemail.py +++ b/test_archivemail.py @@ -706,7 +706,9 @@ class TestArchiveMboxSuffix(unittest.TestCase): """archiving with specified --suffix arguments""" for suffix in ("_static_", "_%B_%Y", "-%Y-%m-%d"): for execute in ("system_long", "system_short", "package"): - self.mbox_name = make_mbox(messages=3, hours_old=(24 * 181)) + days_old_max = 180 + self.mbox_name = make_mbox(messages=3, + hours_old=(24 * (days_old_max+1))) self.copy_name = tempfile.mktemp() shutil.copyfile(self.mbox_name, self.copy_name) if execute == "system_long": @@ -725,7 +727,11 @@ class TestArchiveMboxSuffix(unittest.TestCase): sys.exit(1) assert(os.path.exists(self.mbox_name)) self.assertEqual(os.path.getsize(self.mbox_name), 0) - parsed_suffix = time.strftime(suffix, time.localtime(time.time())) + + parsed_suffix_time = time.time() - days_old_max*24*60*60 + parsed_suffix = time.strftime(suffix, + time.localtime(parsed_suffix_time)) + archive_name = self.mbox_name + parsed_suffix + ".gz" assert(os.path.exists(archive_name)) self.assertEqual(os.system("gzip -d %s" % archive_name), 0)