summaryrefslogtreecommitdiffstats
path: root/Lib/test/lock_tests.py
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2011-03-30 23:00:32 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2011-03-30 23:00:32 (GMT)
commit7899acfc23c6262cea8f69bda36cf256cdfc3501 (patch)
treee69ab3896fd2048781e4ecc98af68476a0ddc975 /Lib/test/lock_tests.py
parent8c5b74802606403208551e0ec579cc4266fc92dd (diff)
downloadcpython-7899acfc23c6262cea8f69bda36cf256cdfc3501.zip
cpython-7899acfc23c6262cea8f69bda36cf256cdfc3501.tar.gz
cpython-7899acfc23c6262cea8f69bda36cf256cdfc3501.tar.bz2
Issue #11618: Fix the timeout logic in threading.Lock.acquire() under
Windows.
Diffstat (limited to 'Lib/test/lock_tests.py')
-rw-r--r--Lib/test/lock_tests.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/lock_tests.py b/Lib/test/lock_tests.py
index b6d818e..005c912 100644
--- a/Lib/test/lock_tests.py
+++ b/Lib/test/lock_tests.py
@@ -213,6 +213,16 @@ class LockTests(BaseLockTests):
lock.acquire()
lock.release()
+ def test_state_after_timeout(self):
+ # Issue #11618: check that lock is in a proper state after a
+ # (non-zero) timeout.
+ lock = self.locktype()
+ lock.acquire()
+ self.assertFalse(lock.acquire(timeout=0.01))
+ lock.release()
+ self.assertFalse(lock.locked())
+ self.assertTrue(lock.acquire(blocking=False))
+
class RLockTests(BaseLockTests):
"""