#15802: Fix test logic in TestMaildir.test_create_tmp
authorPetri Lehtinen <petri@digip.org>
Sat, 1 Sep 2012 11:22:36 +0000 (14:22 +0300)
committerPetri Lehtinen <petri@digip.org>
Sat, 1 Sep 2012 11:22:36 +0000 (14:22 +0300)
Lib/test/test_mailbox.py
Misc/NEWS

index 65120f7af9b49378e26225547bf7b23e50b5ce43..b83e2c3d5af2b31ce1df7079d28b7f0846290f43 100644 (file)
@@ -759,13 +759,13 @@ class TestMaildir(TestMailbox, unittest.TestCase):
             self.assertIsNot(match, None, "Invalid file name: '%s'" % tail)
             groups = match.groups()
             if previous_groups is not None:
-                self.assertTrue(int(groups[0] >= previous_groups[0]),
+                self.assertGreaterEqual(int(groups[0]), int(previous_groups[0]),
                              "Non-monotonic seconds: '%s' before '%s'" %
                              (previous_groups[0], groups[0]))
-                self.assertTrue(int(groups[1] >= previous_groups[1]) or
-                             groups[0] != groups[1],
-                             "Non-monotonic milliseconds: '%s' before '%s'" %
-                             (previous_groups[1], groups[1]))
+                if int(groups[0]) == int(previous_groups[0]):
+                    self.assertGreaterEqual(int(groups[1]), int(previous_groups[1]),
+                                "Non-monotonic milliseconds: '%s' before '%s'" %
+                                (previous_groups[1], groups[1]))
                 self.assertEqual(int(groups[2]), pid,
                              "Process ID mismatch: '%s' should be '%s'" %
                              (groups[2], pid))
index c78dc96ee75b1fc4d063e5fa39ef9af21a138510..4bb9698ac1d1964dbb9717ccf412a17694b5f549 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -457,6 +457,9 @@ Extension Modules
 Tests
 -----
 
+- Issue #15802: Fix test logic in TestMaildir.test_create_tmp. Patch
+  by Serhiy Storchaka.
+
 - Issue #15747: ZFS always returns EOPNOTSUPP when attempting to set the
   UF_IMMUTABLE flag (via either chflags or lchflags); refactor affected
   tests in test_posix.py to account for this.