test_archivemail.py: removed nested calls to setUp() and tearDown().
This commit is contained in:
parent
afa61f8597
commit
f6f7903f58
|
@ -424,7 +424,6 @@ class TestArchiveMbox(TestCaseInTempdir):
|
|||
def testOld(self):
|
||||
"""archiving an old mailbox"""
|
||||
for execute in ("package", "system"):
|
||||
self.setUp()
|
||||
self.mbox_name = make_mbox(messages=3, hours_old=(24 * 181))
|
||||
self.mbox_mode = os.stat(self.mbox_name)[stat.ST_MODE]
|
||||
self.copy_name = tempfile.mkstemp()[1]
|
||||
|
@ -446,7 +445,6 @@ class TestArchiveMbox(TestCaseInTempdir):
|
|||
archive_name = self.mbox_name + "_archive"
|
||||
assert(os.path.exists(archive_name))
|
||||
assert(filecmp.cmp(archive_name, self.copy_name, shallow=0))
|
||||
self.tearDown()
|
||||
|
||||
def testOldFromInBody(self):
|
||||
"""archiving an old mailbox with 'From ' in the body"""
|
||||
|
@ -491,7 +489,6 @@ This is after the ^From line"""
|
|||
for headers in test_headers:
|
||||
for option in ('--date=2000-07-29', '-D2000-07-29',
|
||||
'--date="29 Jul 2000"', '--date="29 July 2000"'):
|
||||
self.setUp()
|
||||
self.mbox_name = make_mbox(messages=3, headers=headers)
|
||||
self.copy_name = tempfile.mkstemp()[1]
|
||||
shutil.copyfile(self.mbox_name, self.copy_name)
|
||||
|
@ -505,10 +502,8 @@ This is after the ^From line"""
|
|||
archive_name = self.mbox_name + "_archive"
|
||||
assert(os.path.exists(archive_name))
|
||||
assert(filecmp.cmp(archive_name, self.copy_name, shallow=0))
|
||||
self.tearDown()
|
||||
for option in ('--date=2000-07-27', '-D2000-07-27',
|
||||
'--date="27 Jul 2000"', '--date="27 July 2000"'):
|
||||
self.setUp()
|
||||
self.mbox_name = make_mbox(messages=3, headers=headers)
|
||||
self.copy_name = tempfile.mkstemp()[1]
|
||||
shutil.copyfile(self.mbox_name, self.copy_name)
|
||||
|
@ -518,12 +513,10 @@ This is after the ^From line"""
|
|||
assert(filecmp.cmp(self.mbox_name, self.copy_name, shallow=0))
|
||||
archive_name = self.mbox_name + "_archive.gz"
|
||||
assert(not os.path.exists(archive_name))
|
||||
self.tearDown()
|
||||
|
||||
def testMixed(self):
|
||||
"""archiving a mixed mailbox"""
|
||||
for execute in ("package", "system"):
|
||||
self.setUp()
|
||||
self.new_mbox = make_mbox(messages=3, hours_old=(24 * 179))
|
||||
self.old_mbox = make_mbox(messages=3, hours_old=(24 * 181))
|
||||
self.mbox_name = tempfile.mkstemp()[1]
|
||||
|
@ -544,12 +537,10 @@ This is after the ^From line"""
|
|||
archive_name = self.mbox_name + "_archive"
|
||||
assert(os.path.exists(archive_name))
|
||||
assert(filecmp.cmp(archive_name, self.old_mbox, shallow=0))
|
||||
self.tearDown()
|
||||
|
||||
def testNew(self):
|
||||
"""archiving a new mailbox"""
|
||||
for execute in ("package", "system"):
|
||||
self.setUp()
|
||||
self.mbox_name = make_mbox(messages=3, hours_old=(24 * 179))
|
||||
self.mbox_mode = os.stat(self.mbox_name)[stat.ST_MODE]
|
||||
self.copy_name = tempfile.mkstemp()[1]
|
||||
|
@ -567,13 +558,11 @@ This is after the ^From line"""
|
|||
self.assertEqual(self.mbox_mode, new_mode)
|
||||
archive_name = self.mbox_name + "_archive.gz"
|
||||
assert(not os.path.exists(archive_name))
|
||||
self.tearDown()
|
||||
|
||||
|
||||
def testOldExisting(self):
|
||||
"""archiving an old mailbox with an existing archive"""
|
||||
for execute in ("package", "system"):
|
||||
self.setUp()
|
||||
self.mbox_name = make_mbox(messages=3, hours_old=(24 * 181))
|
||||
self.mbox_mode = os.stat(self.mbox_name)[stat.ST_MODE]
|
||||
self.copy_name = tempfile.mkstemp()[1]
|
||||
|
@ -599,7 +588,6 @@ This is after the ^From line"""
|
|||
archive_name = self.mbox_name + "_archive"
|
||||
assert(os.path.exists(archive_name))
|
||||
assert(filecmp.cmp(archive_name, self.copy_name, shallow=0))
|
||||
self.tearDown()
|
||||
|
||||
def testOldWeirdHeaders(self):
|
||||
"""archiving old mailboxes with weird headers"""
|
||||
|
@ -643,7 +631,6 @@ This is after the ^From line"""
|
|||
},
|
||||
)
|
||||
for headers in weird_headers:
|
||||
self.setUp()
|
||||
self.mbox_name = make_mbox(messages=3, headers=headers)
|
||||
self.copy_name = tempfile.mkstemp()[1]
|
||||
shutil.copyfile(self.mbox_name, self.copy_name)
|
||||
|
@ -656,7 +643,6 @@ This is after the ^From line"""
|
|||
archive_name = self.mbox_name + "_archive"
|
||||
assert(os.path.exists(archive_name))
|
||||
assert(filecmp.cmp(archive_name, self.copy_name, shallow=0))
|
||||
self.tearDown()
|
||||
|
||||
def tearDown(self):
|
||||
archivemail.options.quiet = 0
|
||||
|
@ -672,7 +658,6 @@ class TestArchiveMboxTimestamp(TestCaseInTempdir):
|
|||
def testNew(self):
|
||||
"""mbox timestamps should not change after no archival"""
|
||||
for execute in ("package", "system"):
|
||||
self.setUp()
|
||||
self.mbox_name = make_mbox(messages=3, hours_old=(24 * 179))
|
||||
self.mtime = os.path.getmtime(self.mbox_name) - 66
|
||||
self.atime = os.path.getatime(self.mbox_name) - 88
|
||||
|
@ -689,12 +674,10 @@ class TestArchiveMboxTimestamp(TestCaseInTempdir):
|
|||
new_mtime = os.path.getmtime(self.mbox_name)
|
||||
self.assertEqual(self.mtime, new_mtime)
|
||||
self.assertEqual(self.atime, new_atime)
|
||||
self.tearDown()
|
||||
|
||||
def testMixed(self):
|
||||
"""mbox timestamps should not change after semi-archival"""
|
||||
for execute in ("package", "system"):
|
||||
self.setUp()
|
||||
self.mbox_name = make_mbox(messages=3, hours_old=(24 * 181))
|
||||
self.mtime = os.path.getmtime(self.mbox_name) - 66
|
||||
self.atime = os.path.getatime(self.mbox_name) - 88
|
||||
|
@ -712,12 +695,10 @@ class TestArchiveMboxTimestamp(TestCaseInTempdir):
|
|||
new_mtime = os.path.getmtime(self.mbox_name)
|
||||
self.assertEqual(self.mtime, new_mtime)
|
||||
self.assertEqual(self.atime, new_atime)
|
||||
self.tearDown()
|
||||
|
||||
def testOld(self):
|
||||
"""mbox timestamps should not change after archival"""
|
||||
for execute in ("package", "system"):
|
||||
self.setUp()
|
||||
self.mbox_name = make_mbox(messages=3, hours_old=(24 * 181))
|
||||
self.mtime = os.path.getmtime(self.mbox_name) - 66
|
||||
self.atime = os.path.getatime(self.mbox_name) - 88
|
||||
|
@ -735,7 +716,6 @@ class TestArchiveMboxTimestamp(TestCaseInTempdir):
|
|||
new_mtime = os.path.getmtime(self.mbox_name)
|
||||
self.assertEqual(self.mtime, new_mtime)
|
||||
self.assertEqual(self.atime, new_atime)
|
||||
self.tearDown()
|
||||
|
||||
def tearDown(self):
|
||||
archivemail.options.quiet = 0
|
||||
|
@ -752,7 +732,6 @@ class TestArchiveMboxPreserveStatus(TestCaseInTempdir):
|
|||
def testOldRead(self):
|
||||
"""archiving an old read mailbox should create an archive"""
|
||||
for execute in ("package", "system_long", "system_short"):
|
||||
self.setUp()
|
||||
self.mbox_name = make_mbox(messages=3, hours_old=(24 * 181), \
|
||||
headers={"Status":"RO"})
|
||||
self.copy_name = tempfile.mkstemp()[1]
|
||||
|
@ -776,12 +755,10 @@ class TestArchiveMboxPreserveStatus(TestCaseInTempdir):
|
|||
archive_name = self.mbox_name + "_archive"
|
||||
assert(os.path.exists(archive_name))
|
||||
assert(filecmp.cmp(archive_name, self.copy_name, shallow=0))
|
||||
self.tearDown()
|
||||
|
||||
def testOldUnread(self):
|
||||
"""archiving an unread mailbox should not create an archive"""
|
||||
for execute in ("package", "system_long", "system_short"):
|
||||
self.setUp()
|
||||
self.mbox_name = make_mbox(messages=3, hours_old=(24 * 181))
|
||||
self.copy_name = tempfile.mkstemp()[1]
|
||||
shutil.copyfile(self.mbox_name, self.copy_name)
|
||||
|
@ -800,7 +777,6 @@ class TestArchiveMboxPreserveStatus(TestCaseInTempdir):
|
|||
assert(filecmp.cmp(self.mbox_name, self.copy_name, shallow=0))
|
||||
archive_name = self.mbox_name + "_archive.gz"
|
||||
assert(not os.path.exists(archive_name))
|
||||
self.tearDown()
|
||||
|
||||
def tearDown(self):
|
||||
archivemail.options.quiet = 0
|
||||
|
@ -818,7 +794,6 @@ class TestArchiveMboxSuffix(TestCaseInTempdir):
|
|||
"""archiving with specified --suffix arguments"""
|
||||
for suffix in ("_static_", "_%B_%Y", "-%Y-%m-%d"):
|
||||
for execute in ("system_long", "system_short", "package"):
|
||||
self.setUp()
|
||||
days_old_max = 180
|
||||
self.mbox_name = make_mbox(messages=3,
|
||||
hours_old=(24 * (days_old_max+1)))
|
||||
|
@ -851,7 +826,6 @@ class TestArchiveMboxSuffix(TestCaseInTempdir):
|
|||
assert(os.path.exists(archive_name))
|
||||
assert(filecmp.cmp(archive_name, self.copy_name, shallow=0))
|
||||
os.remove(archive_name)
|
||||
self.tearDown()
|
||||
|
||||
def tearDown(self):
|
||||
archivemail.options.quiet = 0
|
||||
|
@ -869,7 +843,6 @@ class TestArchiveDryRun(TestCaseInTempdir):
|
|||
def testOld(self):
|
||||
"""archiving an old mailbox with the 'dry-run' option"""
|
||||
for execute in ("package", "system_long", "system_short"):
|
||||
self.setUp()
|
||||
self.mbox_name = make_mbox(messages=3, hours_old=(24 * 181))
|
||||
self.copy_name = tempfile.mkstemp()[1]
|
||||
shutil.copyfile(self.mbox_name, self.copy_name)
|
||||
|
@ -887,7 +860,6 @@ class TestArchiveDryRun(TestCaseInTempdir):
|
|||
assert(filecmp.cmp(self.mbox_name, self.copy_name, shallow=0))
|
||||
archive_name = self.mbox_name + "_archive.gz"
|
||||
assert(not os.path.exists(archive_name))
|
||||
self.tearDown()
|
||||
|
||||
def tearDown(self):
|
||||
archivemail.options.dry_run = 0
|
||||
|
@ -904,7 +876,6 @@ class TestArchiveDays(TestCaseInTempdir):
|
|||
def testOld(self):
|
||||
"""specifying the 'days' option on an older mailbox"""
|
||||
for execute in ("package", "system", "system_long"):
|
||||
self.setUp()
|
||||
self.mbox_name = make_mbox(messages=3, hours_old=(24 * 12))
|
||||
self.copy_name = tempfile.mkstemp()[1]
|
||||
shutil.copyfile(self.mbox_name, self.copy_name)
|
||||
|
@ -927,12 +898,10 @@ class TestArchiveDays(TestCaseInTempdir):
|
|||
archive_name = self.mbox_name + "_archive"
|
||||
assert(os.path.exists(archive_name))
|
||||
assert(filecmp.cmp(archive_name, self.copy_name, shallow=0))
|
||||
self.tearDown()
|
||||
|
||||
def testNew(self):
|
||||
"""specifying the 'days' option on a newer mailbox"""
|
||||
for execute in ("package", "system", "system_long"):
|
||||
self.setUp()
|
||||
self.mbox_name = make_mbox(messages=3, hours_old=(24 * 10))
|
||||
self.copy_name = tempfile.mkstemp()[1]
|
||||
shutil.copyfile(self.mbox_name, self.copy_name)
|
||||
|
@ -951,7 +920,6 @@ class TestArchiveDays(TestCaseInTempdir):
|
|||
assert(filecmp.cmp(self.mbox_name, self.copy_name, shallow=0))
|
||||
archive_name = self.mbox_name + "_archive.gz"
|
||||
assert(not os.path.exists(archive_name))
|
||||
self.tearDown()
|
||||
|
||||
def tearDown(self):
|
||||
archivemail.options.days_old_max = 180
|
||||
|
@ -974,7 +942,6 @@ class TestArchiveDelete(TestCaseInTempdir):
|
|||
def testNew(self):
|
||||
"""archiving a new mailbox with the 'delete' option"""
|
||||
for execute in ("package", "system"):
|
||||
self.setUp()
|
||||
self.mbox_name = make_mbox(messages=3, hours_old=(24 * 179))
|
||||
self.copy_name = tempfile.mkstemp()[1]
|
||||
shutil.copyfile(self.mbox_name, self.copy_name)
|
||||
|
@ -989,12 +956,10 @@ class TestArchiveDelete(TestCaseInTempdir):
|
|||
assert(filecmp.cmp(self.mbox_name, self.copy_name, shallow=0))
|
||||
archive_name = self.mbox_name + "_archive.gz"
|
||||
assert(not os.path.exists(archive_name))
|
||||
self.tearDown()
|
||||
|
||||
def testMixed(self):
|
||||
"""archiving a mixed mailbox with the 'delete' option"""
|
||||
for execute in ("package", "system"):
|
||||
self.setUp()
|
||||
self.new_mbox = make_mbox(messages=3, hours_old=(24 * 179))
|
||||
self.old_mbox = make_mbox(messages=3, hours_old=(24 * 181))
|
||||
self.mbox_name = tempfile.mkstemp()[1]
|
||||
|
@ -1011,12 +976,10 @@ class TestArchiveDelete(TestCaseInTempdir):
|
|||
assert(filecmp.cmp(self.new_mbox, self.mbox_name, shallow=0))
|
||||
archive_name = self.mbox_name + "_archive.gz"
|
||||
assert(not os.path.exists(archive_name))
|
||||
self.tearDown()
|
||||
|
||||
def testOld(self):
|
||||
"""archiving an old mailbox with the 'delete' option"""
|
||||
for execute in ("package", "system"):
|
||||
self.setUp()
|
||||
self.mbox_name = make_mbox(messages=3, hours_old=(24 * 181))
|
||||
self.copy_name = tempfile.mkstemp()[1]
|
||||
shutil.copyfile(self.mbox_name, self.copy_name)
|
||||
|
@ -1031,7 +994,6 @@ class TestArchiveDelete(TestCaseInTempdir):
|
|||
self.assertEqual(os.path.getsize(self.mbox_name), 0)
|
||||
archive_name = self.mbox_name + "_archive.gz"
|
||||
assert(not os.path.exists(archive_name))
|
||||
self.tearDown()
|
||||
|
||||
def tearDown(self):
|
||||
archivemail.options.delete_old_mail = 0
|
||||
|
@ -1054,7 +1016,6 @@ class TestArchiveCopy(TestCaseInTempdir):
|
|||
def testNew(self):
|
||||
"""archiving a new mailbox with the 'copy' option"""
|
||||
for execute in ("package", "system"):
|
||||
self.setUp()
|
||||
self.mbox_name = make_mbox(messages=3, hours_old=(24 * 179))
|
||||
self.mbox_backup_name = tempfile.mkstemp()[1]
|
||||
shutil.copyfile(self.mbox_name, self.mbox_backup_name)
|
||||
|
@ -1071,12 +1032,10 @@ class TestArchiveCopy(TestCaseInTempdir):
|
|||
archive_name = self.mbox_name + "_archive.gz"
|
||||
# There is no archive.
|
||||
assert(not os.path.exists(archive_name))
|
||||
self.tearDown()
|
||||
|
||||
def testMixed(self):
|
||||
"""archiving a mixed mailbox with the 'copy' option"""
|
||||
for execute in ("package", "system"):
|
||||
self.setUp()
|
||||
self.new_mbox = make_mbox(messages=3, hours_old=(24 * 179))
|
||||
self.old_mbox = make_mbox(messages=3, hours_old=(24 * 181))
|
||||
self.mbox_name = tempfile.mkstemp()[1]
|
||||
|
@ -1101,12 +1060,10 @@ class TestArchiveCopy(TestCaseInTempdir):
|
|||
archive_name = self.mbox_name + "_archive"
|
||||
assert(os.path.exists(archive_name))
|
||||
assert(filecmp.cmp(archive_name, self.old_mbox, shallow=0))
|
||||
self.tearDown()
|
||||
|
||||
def testOld(self):
|
||||
"""archiving an old mailbox with the 'copy' option"""
|
||||
for execute in ("package", "system"):
|
||||
self.setUp()
|
||||
self.mbox_name = make_mbox(messages=3, hours_old=(24 * 181))
|
||||
self.mbox_backup_name = tempfile.mkstemp()[1]
|
||||
shutil.copyfile(self.mbox_name, self.mbox_backup_name)
|
||||
|
@ -1127,7 +1084,6 @@ class TestArchiveCopy(TestCaseInTempdir):
|
|||
archive_name = self.mbox_name + "_archive"
|
||||
assert(os.path.exists(archive_name))
|
||||
assert(filecmp.cmp(archive_name, self.mbox_name, shallow=0))
|
||||
self.tearDown()
|
||||
|
||||
def tearDown(self):
|
||||
archivemail.options.copy_old_mail = 0
|
||||
|
@ -1144,7 +1100,6 @@ class TestArchiveMboxFlagged(TestCaseInTempdir):
|
|||
def testOld(self):
|
||||
"""by default, old flagged messages should not be archived"""
|
||||
for execute in ("system", "package"):
|
||||
self.setUp()
|
||||
self.mbox_name = make_mbox(messages=3, hours_old=(24 * 181), \
|
||||
headers={"X-Status":"F"})
|
||||
self.copy_name = tempfile.mkstemp()[1]
|
||||
|
@ -1161,12 +1116,10 @@ class TestArchiveMboxFlagged(TestCaseInTempdir):
|
|||
assert(filecmp.cmp(self.mbox_name, self.copy_name, shallow=0))
|
||||
archive_name = self.mbox_name + "_archive.gz"
|
||||
assert(not os.path.exists(archive_name))
|
||||
self.tearDown()
|
||||
|
||||
def testIncludeFlaggedNew(self):
|
||||
"""new flagged messages should not be archived with include_flagged"""
|
||||
for execute in ("system", "package"):
|
||||
self.setUp()
|
||||
self.mbox_name = make_mbox(messages=3, hours_old=(24 * 179), \
|
||||
headers={"X-Status":"F"})
|
||||
self.copy_name = tempfile.mkstemp()[1]
|
||||
|
@ -1184,12 +1137,10 @@ class TestArchiveMboxFlagged(TestCaseInTempdir):
|
|||
assert(filecmp.cmp(self.mbox_name, self.copy_name, shallow=0))
|
||||
archive_name = self.mbox_name + "_archive.gz"
|
||||
assert(not os.path.exists(archive_name))
|
||||
self.tearDown()
|
||||
|
||||
def testIncludeFlaggedOld(self):
|
||||
"""old flagged messages should be archived with include_flagged"""
|
||||
for execute in ("system", "package"):
|
||||
self.setUp()
|
||||
self.mbox_name = make_mbox(messages=3, hours_old=(24 * 181), \
|
||||
headers={"X-Status":"F"})
|
||||
self.copy_name = tempfile.mkstemp()[1]
|
||||
|
@ -1211,7 +1162,6 @@ class TestArchiveMboxFlagged(TestCaseInTempdir):
|
|||
archive_name = self.mbox_name + "_archive"
|
||||
assert(os.path.exists(archive_name))
|
||||
assert(filecmp.cmp(archive_name, self.copy_name, shallow=0))
|
||||
self.tearDown()
|
||||
|
||||
def tearDown(self):
|
||||
archivemail.options.include_flagged = 0
|
||||
|
@ -1228,7 +1178,6 @@ class TestArchiveMboxOutputDir(TestCaseInTempdir):
|
|||
def testOld(self):
|
||||
"""archiving an old mailbox with a sepecified output dir"""
|
||||
for execute in ("package", "system_long", "system_short"):
|
||||
self.setUp()
|
||||
self.mbox_name = make_mbox(messages=3, hours_old=(24 * 181))
|
||||
self.copy_name = tempfile.mkstemp()[1]
|
||||
shutil.copyfile(self.mbox_name, self.copy_name)
|
||||
|
@ -1255,7 +1204,6 @@ class TestArchiveMboxOutputDir(TestCaseInTempdir):
|
|||
archive_name = re.sub(".gz$", "", archive_name)
|
||||
assert(os.path.exists(archive_name))
|
||||
assert(filecmp.cmp(archive_name, self.copy_name, shallow=0))
|
||||
self.tearDown()
|
||||
|
||||
def tearDown(self):
|
||||
archivemail.options.quiet = 0
|
||||
|
@ -1278,7 +1226,6 @@ class TestArchiveMboxUncompressed(TestCaseInTempdir):
|
|||
def testOld(self):
|
||||
"""archiving an old mailbox uncompressed"""
|
||||
for execute in ("package", "system"):
|
||||
self.setUp()
|
||||
self.mbox_name = make_mbox(messages=3, hours_old=(24 * 181))
|
||||
self.mbox_mode = os.stat(self.mbox_name)[stat.ST_MODE]
|
||||
self.copy_name = tempfile.mkstemp()[1]
|
||||
|
@ -1299,12 +1246,10 @@ class TestArchiveMboxUncompressed(TestCaseInTempdir):
|
|||
assert(os.path.exists(archive_name))
|
||||
assert(filecmp.cmp(archive_name, self.copy_name, shallow=0))
|
||||
assert(not os.path.exists(archive_name + ".gz"))
|
||||
self.tearDown()
|
||||
|
||||
def testNew(self):
|
||||
"""archiving a new mailbox uncompressed"""
|
||||
for execute in ("package", "system"):
|
||||
self.setUp()
|
||||
self.mbox_name = make_mbox(messages=3, hours_old=(24 * 179))
|
||||
self.mbox_mode = os.stat(self.mbox_name)[stat.ST_MODE]
|
||||
self.copy_name = tempfile.mkstemp()[1]
|
||||
|
@ -1324,12 +1269,10 @@ class TestArchiveMboxUncompressed(TestCaseInTempdir):
|
|||
archive_name = self.mbox_name + "_archive"
|
||||
assert(not os.path.exists(archive_name))
|
||||
assert(not os.path.exists(archive_name + ".gz"))
|
||||
self.tearDown()
|
||||
|
||||
def testMixed(self):
|
||||
"""archiving a mixed mailbox uncompressed"""
|
||||
for execute in ("package", "system"):
|
||||
self.setUp()
|
||||
self.new_mbox = make_mbox(messages=3, hours_old=(24 * 179))
|
||||
self.old_mbox = make_mbox(messages=3, hours_old=(24 * 181))
|
||||
self.mbox_name = tempfile.mkstemp()[1]
|
||||
|
@ -1349,12 +1292,10 @@ class TestArchiveMboxUncompressed(TestCaseInTempdir):
|
|||
assert(os.path.exists(archive_name))
|
||||
assert(filecmp.cmp(archive_name, self.old_mbox, shallow=0))
|
||||
assert(not os.path.exists(archive_name + ".gz"))
|
||||
self.tearDown()
|
||||
|
||||
def testOldExists(self):
|
||||
"""archiving an old mailbox uncopressed with an existing archive"""
|
||||
for execute in ("package", "system"):
|
||||
self.setUp()
|
||||
self.mbox_name = make_mbox(messages=3, hours_old=(24 * 181))
|
||||
self.mbox_mode = os.stat(self.mbox_name)[stat.ST_MODE]
|
||||
self.copy_name = tempfile.mkstemp()[1]
|
||||
|
@ -1378,7 +1319,6 @@ class TestArchiveMboxUncompressed(TestCaseInTempdir):
|
|||
assert(os.path.exists(archive_name))
|
||||
assert(filecmp.cmp(archive_name, self.copy_name, shallow=0))
|
||||
assert(not os.path.exists(archive_name + ".gz"))
|
||||
self.tearDown()
|
||||
|
||||
def tearDown(self):
|
||||
archivemail.options.quiet = 0
|
||||
|
@ -1395,7 +1335,6 @@ class TestArchiveSize(TestCaseInTempdir):
|
|||
def testSmaller(self):
|
||||
"""giving a size argument smaller than the message"""
|
||||
for execute in ("package", "system_long", "system_short"):
|
||||
self.setUp()
|
||||
self.mbox_name = make_mbox(messages=1, hours_old=(24 * 181))
|
||||
size_arg = os.path.getsize(self.mbox_name) - 1
|
||||
self.copy_name = tempfile.mkstemp()[1]
|
||||
|
@ -1421,12 +1360,10 @@ class TestArchiveSize(TestCaseInTempdir):
|
|||
archive_name = self.mbox_name + "_archive"
|
||||
assert(os.path.exists(archive_name))
|
||||
assert(filecmp.cmp(archive_name, self.copy_name, shallow=0))
|
||||
self.tearDown()
|
||||
|
||||
def testBigger(self):
|
||||
"""giving a size argument bigger than the message"""
|
||||
for execute in ("package", "system_long", "system_short"):
|
||||
self.setUp()
|
||||
self.mbox_name = make_mbox(messages=1, hours_old=(24 * 181))
|
||||
size_arg = os.path.getsize(self.mbox_name) + 1
|
||||
self.copy_name = tempfile.mkstemp()[1]
|
||||
|
@ -1448,7 +1385,6 @@ class TestArchiveSize(TestCaseInTempdir):
|
|||
assert(filecmp.cmp(self.mbox_name, self.copy_name, shallow=0))
|
||||
archive_name = self.mbox_name + "_archive.gz"
|
||||
assert(not os.path.exists(archive_name))
|
||||
self.tearDown()
|
||||
|
||||
def tearDown(self):
|
||||
archivemail.options.quiet = 0
|
||||
|
@ -1466,7 +1402,6 @@ class TestArchiveMboxMode(TestCaseInTempdir):
|
|||
"""after archiving, the original mbox mode should be preserved"""
|
||||
for mode in (0666, 0664, 0660, 0640, 0600):
|
||||
for execute in ("package", "system"):
|
||||
self.setUp()
|
||||
self.mbox_name = make_mbox(messages=1, hours_old=(24 * 181))
|
||||
os.chmod(self.mbox_name, mode)
|
||||
if execute == "package":
|
||||
|
@ -1483,13 +1418,11 @@ class TestArchiveMboxMode(TestCaseInTempdir):
|
|||
self.assertEqual(mode, stat.S_IMODE(new_mode))
|
||||
archive_mode = os.stat(archive_name)[stat.ST_MODE]
|
||||
self.assertEqual(0600, stat.S_IMODE(archive_mode))
|
||||
self.tearDown()
|
||||
|
||||
def testNew(self):
|
||||
"""after no archiving, the original mbox mode should be preserved"""
|
||||
for mode in (0666, 0664, 0660, 0640, 0600):
|
||||
for execute in ("package", "system"):
|
||||
self.setUp()
|
||||
self.mbox_name = make_mbox(messages=1, hours_old=(24 * 179))
|
||||
os.chmod(self.mbox_name, mode)
|
||||
if execute == "package":
|
||||
|
@ -1505,7 +1438,6 @@ class TestArchiveMboxMode(TestCaseInTempdir):
|
|||
new_mode = os.stat(self.mbox_name)[stat.ST_MODE]
|
||||
self.assertEqual(mode, stat.S_IMODE(new_mode))
|
||||
os.remove(self.mbox_name)
|
||||
self.tearDown()
|
||||
|
||||
def tearDown(self):
|
||||
archivemail.options.quiet = 0
|
||||
|
|
Loading…
Reference in New Issue