diff options
author | Nikolaus Schulz <microschulz@web.de> | 2006-10-01 02:32:19 +0000 |
---|---|---|
committer | Nikolaus Schulz <microschulz@web.de> | 2006-10-01 02:32:19 +0000 |
commit | a6ff806d2a1d862b33a48351161ad753a881cc1a (patch) | |
tree | 4f30b673565da83d47d0a071e2ad14ed286bf79c | |
parent | 6895571d3bdee6141d11eaba07d9e9278a374d5d (diff) | |
download | archivemail-a6ff806d2a1d862b33a48351161ad753a881cc1a.tar.gz archivemail-a6ff806d2a1d862b33a48351161ad753a881cc1a.tar.bz2 archivemail-a6ff806d2a1d862b33a48351161ad753a881cc1a.zip |
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.
-rwxr-xr-x | test_archivemail.py | 10 |
1 files 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) |