]>
Commit | Line | Data |
---|---|---|
c4ecf106 ER |
1 | # Description: add, document and test --all option |
2 | # Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=549736 | |
3 | # Author: Nikolaus Schulz <microschulz@web.de> | |
4 | # Last-Update: 2009-10-10 | |
5 | --- a/test_archivemail.py | |
6 | +++ b/test_archivemail.py | |
7 | @@ -69,6 +69,8 @@ | |
8 | print "Try renaming it from 'archivemail' to 'archivemail.py'." | |
9 | sys.exit(1) | |
10 | ||
11 | +# precision of os.utime() when restoring mbox timestamps | |
12 | +utimes_precision = 5 | |
13 | ||
14 | class TestCaseInTempdir(unittest.TestCase): | |
15 | """Base class for testcases that need to create temporary files. | |
16 | @@ -718,8 +720,8 @@ | |
17 | assert(os.path.exists(self.mbox_name)) | |
18 | new_atime = os.path.getatime(self.mbox_name) | |
19 | new_mtime = os.path.getmtime(self.mbox_name) | |
20 | - self.assertEqual(self.mtime, new_mtime) | |
21 | - self.assertEqual(self.atime, new_atime) | |
22 | + self.assertAlmostEqual(self.mtime, new_mtime, utimes_precision) | |
23 | + self.assertAlmostEqual(self.atime, new_atime, utimes_precision) | |
24 | self.tearDown() | |
25 | ||
26 | def testMixed(self): | |
27 | @@ -741,8 +743,8 @@ | |
28 | assert(os.path.exists(self.mbox_name)) | |
29 | new_atime = os.path.getatime(self.mbox_name) | |
30 | new_mtime = os.path.getmtime(self.mbox_name) | |
31 | - self.assertEqual(self.mtime, new_mtime) | |
32 | - self.assertEqual(self.atime, new_atime) | |
33 | + self.assertAlmostEqual(self.mtime, new_mtime, utimes_precision) | |
34 | + self.assertAlmostEqual(self.atime, new_atime, utimes_precision) | |
35 | self.tearDown() | |
36 | ||
37 | def testOld(self): | |
38 | @@ -764,8 +766,8 @@ | |
39 | assert(os.path.exists(self.mbox_name)) | |
40 | new_atime = os.path.getatime(self.mbox_name) | |
41 | new_mtime = os.path.getmtime(self.mbox_name) | |
42 | - self.assertEqual(self.mtime, new_mtime) | |
43 | - self.assertEqual(self.atime, new_atime) | |
44 | + self.assertAlmostEqual(self.mtime, new_mtime, utimes_precision) | |
45 | + self.assertAlmostEqual(self.atime, new_atime, utimes_precision) | |
46 | self.tearDown() | |
47 | ||
48 | def tearDown(self): |