]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Restore LockTests.test_acquire_fifo. 1353/head
authorA. Jesse Jiryu Davis <jesse@mongodb.com>
Sat, 28 Feb 2015 18:40:32 +0000 (13:40 -0500)
committerA. Jesse Jiryu Davis <jesse@mongodb.com>
Sat, 28 Feb 2015 18:40:32 +0000 (13:40 -0500)
tornado/test/locks_test.py

index 82504f9921b1b3027b6aabb75a15049b980110e6..fb022b6cb899052e5df01d5b7c455760f03708b1 100644 (file)
@@ -382,20 +382,22 @@ class LockTests(AsyncTestCase):
         self.assertTrue(future.done())
 
     @gen_test
-    def test_acquire_contended(self):
+    def test_acquire_fifo(self):
         lock = locks.Lock()
         self.assertTrue(lock.acquire().done())
         N = 5
+        history = []
 
         @gen.coroutine
-        def f():
+        def f(idx):
             with (yield lock.acquire()):
-                pass
+                history.append(idx)
 
-        futures = [f() for _ in range(N)]
+        futures = [f(i) for i in range(N)]
         self.assertFalse(any(future.done() for future in futures))
         lock.release()
         yield futures
+        self.assertEqual(list(range(N)), history)
 
     @gen_test
     def test_acquire_timeout(self):