Commit 2e1d6d96 authored by Guido Trotter's avatar Guido Trotter
Browse files

Add a new LockSet unittest

This test checks the LockSet behaviour when an empty list is passed.
The current behaviour is expected, but since this is a corner case,
we're safer to keep it under a check, and if we need a different one
monitor that everything is as we expect it to be.

Reviewed-by: imsnah
parent 5f33b613
......@@ -403,6 +403,18 @@ class TestLockSet(unittest.TestCase):
self.assertRaises(AssertionError, self.ls.add, 'five')
self.ls.release()
def testEmptyAcquire(self):
# Acquire an empty list of locks...
self.assertEquals(self.ls.acquire([]), set())
self.assertEquals(self.ls._list_owned(), set())
# New locks can still be addded
self.assert_(self.ls.add('six'))
# "re-acquiring" is not an issue, since we had really acquired nothing
self.assertEquals(self.ls.acquire([], shared=1), set())
self.assertEquals(self.ls._list_owned(), set())
# We haven't really acquired anything, so we cannot release
self.assertRaises(AssertionError, self.ls.release)
def _doLockSet(self, set, shared):
try:
self.ls.acquire(set, shared=shared)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment