[Python-checkins] cpython (3.2): #15802: Fix test logic in TestMaildir.test_create_tmp

petri.lehtinen python-checkins at python.org
Sat Sep 1 13:30:46 CEST 2012


http://hg.python.org/cpython/rev/aef4a2ba3210
changeset:   78825:aef4a2ba3210
branch:      3.2
parent:      78821:1b614921aefa
user:        Petri Lehtinen <petri at digip.org>
date:        Sat Sep 01 14:22:36 2012 +0300
summary:
  #15802: Fix test logic in TestMaildir.test_create_tmp

files:
  Lib/test/test_mailbox.py |  10 +++++-----
  Misc/NEWS                |   3 +++
  2 files changed, 8 insertions(+), 5 deletions(-)


diff --git a/Lib/test/test_mailbox.py b/Lib/test/test_mailbox.py
--- a/Lib/test/test_mailbox.py
+++ b/Lib/test/test_mailbox.py
@@ -759,13 +759,13 @@
             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))
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -457,6 +457,9 @@
 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.

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list