Skip to content

Commit 6f858a2

Browse files
committed
#15802: Fix test logic in TestMaildir.test_create_tmp
2 parents 64b0ef1 + 1c371b2 commit 6f858a2

2 files changed

Lines changed: 8 additions & 5 deletions

File tree

Lib/test/test_mailbox.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -763,13 +763,13 @@ def test_create_tmp(self, repetitions=10):
763763
self.assertIsNot(match, None, "Invalid file name: '%s'" % tail)
764764
groups = match.groups()
765765
if previous_groups is not None:
766-
self.assertTrue(int(groups[0] >= previous_groups[0]),
766+
self.assertGreaterEqual(int(groups[0]), int(previous_groups[0]),
767767
"Non-monotonic seconds: '%s' before '%s'" %
768768
(previous_groups[0], groups[0]))
769-
self.assertTrue(int(groups[1] >= previous_groups[1]) or
770-
groups[0] != groups[1],
771-
"Non-monotonic milliseconds: '%s' before '%s'" %
772-
(previous_groups[1], groups[1]))
769+
if int(groups[0]) == int(previous_groups[0]):
770+
self.assertGreaterEqual(int(groups[1]), int(previous_groups[1]),
771+
"Non-monotonic milliseconds: '%s' before '%s'" %
772+
(previous_groups[1], groups[1]))
773773
self.assertEqual(int(groups[2]), pid,
774774
"Process ID mismatch: '%s' should be '%s'" %
775775
(groups[2], pid))

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ Extension Modules
2828
Tests
2929
-----
3030

31+
- Issue #15802: Fix test logic in TestMaildir.test_create_tmp. Patch
32+
by Serhiy Storchaka.
33+
3134
Build
3235
-----
3336

0 commit comments

Comments
 (0)