diff options
| author | guido@google.com <guido@google.com> | 2011-03-29 19:09:45 (GMT) |
|---|---|---|
| committer | guido@google.com <guido@google.com> | 2011-03-29 19:09:45 (GMT) |
| commit | 69cfcabae3d72845d44e1078d25072fdbb02072c (patch) | |
| tree | 0aedaa424e8c8f7139567aed7b6980ea59e16c97 /Lib/test/test_mailbox.py | |
| parent | 2008a8f8c09b18fbd24e8039553d50a828dd3fb2 (diff) | |
| parent | e6c1eb92675f67d1907bd7ba00c44262c18e93d4 (diff) | |
| download | cpython-69cfcabae3d72845d44e1078d25072fdbb02072c.zip cpython-69cfcabae3d72845d44e1078d25072fdbb02072c.tar.gz cpython-69cfcabae3d72845d44e1078d25072fdbb02072c.tar.bz2 | |
Merge.
Diffstat (limited to 'Lib/test/test_mailbox.py')
| -rw-r--r-- | Lib/test/test_mailbox.py | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/Lib/test/test_mailbox.py b/Lib/test/test_mailbox.py index 03f814a..9b4613e 100644 --- a/Lib/test/test_mailbox.py +++ b/Lib/test/test_mailbox.py @@ -869,8 +869,6 @@ class TestMaildir(TestMailbox): self.assertFalse((perms & 0o111)) # Execute bits should all be off. def test_reread(self): - # Wait for 2 seconds - time.sleep(2) # Initially, the mailbox has not been read and the time is null. assert getattr(self._box, '_last_read', None) is None @@ -879,15 +877,21 @@ class TestMaildir(TestMailbox): self._box._refresh() assert getattr(self._box, '_last_read', None) is not None - # Try calling _refresh() again; the modification times shouldn't have - # changed, so the mailbox should not be re-reading. Re-reading causes - # the ._toc attribute to be assigned a new dictionary object, so - # we'll check that the ._toc attribute isn't a different object. + # Put the last modified times more than one second into the past + # (because mtime has a one second granularity, a refresh is done + # unconditionally if called for within the same second, just in case + # the mbox has changed). + for subdir in ('cur', 'new'): + os.utime(os.path.join(self._box._path, subdir), + (time.time()-5,)*2) + + # Re-reading causes the ._toc attribute to be assigned a new dictionary + # object, so we'll check that the ._toc attribute isn't a different + # object. orig_toc = self._box._toc def refreshed(): return self._box._toc is not orig_toc - time.sleep(1) # Wait 1sec to ensure time.time()'s value changes self._box._refresh() assert not refreshed() |
