Revision b8140229 test/ganeti.locking_unittest.py
b/test/ganeti.locking_unittest.py | ||
---|---|---|
95 | 95 |
|
96 | 96 |
def _testNotification(self): |
97 | 97 |
def _NotifyAll(): |
98 |
self.done.put("NE") |
|
98 | 99 |
self.cond.acquire() |
100 |
self.done.put("NA") |
|
99 | 101 |
self.cond.notifyAll() |
102 |
self.done.put("NN") |
|
100 | 103 |
self.cond.release() |
101 | 104 |
|
102 | 105 |
self.cond.acquire() |
103 | 106 |
self._addThread(target=_NotifyAll) |
107 |
self.assertEqual(self.done.get(True, 1), "NE") |
|
108 |
self.assertRaises(Queue.Empty, self.done.get_nowait) |
|
104 | 109 |
self.cond.wait() |
110 |
self.assertEqual(self.done.get(True, 1), "NA") |
|
111 |
self.assertEqual(self.done.get(True, 1), "NN") |
|
105 | 112 |
self.assert_(self.cond._is_owned()) |
106 | 113 |
self.cond.release() |
107 | 114 |
self.assert_(not self.cond._is_owned()) |
Also available in: Unified diff