From 63f2e7248f338ec65c176192c6394b5c2e3cccbd Mon Sep 17 00:00:00 2001 From: Guido Trotter <ultrotter@google.com> Date: Thu, 1 Oct 2009 10:41:36 +0100 Subject: [PATCH] Move the "done" queue inside _ThreadedTestCase All (ok, all but one) _ThreadedTestCase users have a done Queue, so we move its building in the _ThreadedTestCase setUp Signed-off-by: Guido Trotter <ultrotter@google.com> Reviewed-by: Michael Hanselmann <hansmi@google.com> --- test/ganeti.locking_unittest.py | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/test/ganeti.locking_unittest.py b/test/ganeti.locking_unittest.py index 79c48888e..3a77bc0f7 100755 --- a/test/ganeti.locking_unittest.py +++ b/test/ganeti.locking_unittest.py @@ -52,6 +52,7 @@ class _ThreadedTestCase(unittest.TestCase): """Test class that supports adding/waiting on threads""" def setUp(self): unittest.TestCase.setUp(self) + self.done = Queue.Queue(0) self.threads = [] def _addThread(self, *args, **kwargs): @@ -76,7 +77,6 @@ class TestPipeCondition(_ThreadedTestCase): _ThreadedTestCase.setUp(self) self.lock = threading.Lock() self.cond = locking._PipeCondition(self.lock) - self.done = Queue.Queue(0) def testAcquireRelease(self): self.assert_(not self.cond._is_owned()) @@ -280,8 +280,6 @@ class TestSharedLock(_ThreadedTestCase): def setUp(self): _ThreadedTestCase.setUp(self) self.sl = locking.SharedLock() - # helper threads use the 'done' queue to tell the master they finished. - self.done = Queue.Queue(0) def testSequenceAndOwnership(self): self.assert_(not self.sl._is_owned()) @@ -725,8 +723,6 @@ class TestSSynchronizedDecorator(_ThreadedTestCase): def setUp(self): _ThreadedTestCase.setUp(self) - # helper threads use the 'done' queue to tell the master they finished. - self.done = Queue.Queue(0) @locking.ssynchronized(_decoratorlock) def _doItExclusive(self): @@ -785,8 +781,6 @@ class TestLockSet(_ThreadedTestCase): def setUp(self): _ThreadedTestCase.setUp(self) self._setUpLS() - # helper threads use the 'done' queue to tell the master they finished. - self.done = Queue.Queue(0) def _setUpLS(self): """Helper to (re)initialize the lock set""" @@ -1138,7 +1132,6 @@ class TestGanetiLockManager(_ThreadedTestCase): self.instances=['i1', 'i2', 'i3'] self.GL = locking.GanetiLockManager(nodes=self.nodes, instances=self.instances) - self.done = Queue.Queue(0) def tearDown(self): # Don't try this at home... -- GitLab