summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2011-11-12 19:36:51 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2011-11-12 19:36:51 (GMT)
commit4339a7767d6abdad62c8460805b5b44d6357ffaf (patch)
tree7c98c226e110fafb192f2a9c13f334fc248bb046 /Lib
parente0815e2db04c1b4d06163cbe4b0ea76119b41f96 (diff)
parentf89d8fcc36555b324a0fd9aa3a81c810570fdd80 (diff)
downloadcpython-4339a7767d6abdad62c8460805b5b44d6357ffaf.zip
cpython-4339a7767d6abdad62c8460805b5b44d6357ffaf.tar.gz
cpython-4339a7767d6abdad62c8460805b5b44d6357ffaf.tar.bz2
Merge
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_mailbox.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/Lib/test/test_mailbox.py b/Lib/test/test_mailbox.py
index 17aebc7..a1c684e 100644
--- a/Lib/test/test_mailbox.py
+++ b/Lib/test/test_mailbox.py
@@ -815,7 +815,7 @@ class TestMaildir(TestMailbox):
# skew factor to make _refresh think that the filesystem
# safety period has passed and re-reading the _toc is only
# required if mtimes differ.
- self._box._skewfactor = -2
+ self._box._skewfactor = -3
self._box._refresh()
self.assertEqual(sorted(self._box._toc.keys()), sorted([key0, key1]))
@@ -908,7 +908,12 @@ class TestMaildir(TestMailbox):
# refresh is done unconditionally if called for within
# two-second-plus-a-bit of the last one, just in case the mbox has
# changed; so now we have to wait for that interval to expire.
- time.sleep(2.01 + self._box._skewfactor)
+ #
+ # Because this is a test, emulate sleeping. Instead of
+ # sleeping for 2 seconds, use the skew factor to make _refresh
+ # think that 2 seconds have passed and re-reading the _toc is
+ # only required if mtimes differ.
+ self._box._skewfactor = -3
# 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
@@ -921,7 +926,8 @@ class TestMaildir(TestMailbox):
self.assertFalse(refreshed())
# Now, write something into cur and remove it. This changes
- # the mtime and should cause a re-read.
+ # the mtime and should cause a re-read. Note that "sleep
+ # emulation" is still in effect, as skewfactor is -3.
filename = os.path.join(self._path, 'cur', 'stray-file')
support.create_empty_file(filename)
os.unlink(filename)