示例#1
0
class TestBasicFunctions(unittest.TestCase):
    def setUp(self):
        self.elock = ELock(ELOCK_SERVER)

    def tearDown(self):
        self.elock.close()
        del self.elock

    def testBasic(self):
        self.assertTrue(self.elock.lock(LOCKS[0]))
        self.assertTrue(self.elock.lock(LOCKS[0]))
        self.assertTrue(self.elock.unlock(LOCKS[0]))
示例#2
0
文件: test.py 项目: nitzanm/pyelock
class TestBasicFunctions(unittest.TestCase):
    def setUp(self):
        self.elock = ELock(ELOCK_SERVER)

    def tearDown(self):
        self.elock.close()
        del self.elock

    def testBasic(self):
        self.assertTrue(self.elock.lock(LOCKS[0]))
        self.assertTrue(self.elock.lock(LOCKS[0]))
        self.assertTrue(self.elock.unlock(LOCKS[0]))
示例#3
0
文件: test.py 项目: nitzanm/pyelock
 def setUp(self):
     self.elock = ELock(ELOCK_SERVER)
示例#4
0
文件: test.py 项目: nitzanm/pyelock
 def setUp(self):
     self.l1 = ELock(ELOCK_SERVER)
     self.l2 = ELock(ELOCK_SERVER)
示例#5
0
文件: test.py 项目: nitzanm/pyelock
class TestTwoConnections(unittest.TestCase):
    def setUp(self):
        self.l1 = ELock(ELOCK_SERVER)
        self.l2 = ELock(ELOCK_SERVER)

    def tearDown(self):
        self.l1.close()
        self.l2.close()

    def testConcurrentLockUnlock(self):
        self.assertTrue(self.l1.lock(LOCKS[0]))
        self.assertFalse(self.l2.lock(LOCKS[0]))
        self.assertTrue(self.l1.unlock(LOCKS[0]))
        self.assertTrue(self.l2.lock(LOCKS[0]))

    def testUnlockAll(self):
        self.assertTrue(self.l1.lock(LOCKS[0]))
        self.assertFalse(self.l2.lock(LOCKS[0]))
        self.assertTrue(self.l1.unlock_all())
        self.assertTrue(self.l2.lock(LOCKS[0]))
示例#6
0
 def setUp(self):
     self.elock = ELock(ELOCK_SERVER)
示例#7
0
 def setUp(self):
     self.l1 = ELock(ELOCK_SERVER)
     self.l2 = ELock(ELOCK_SERVER)
示例#8
0
class TestTwoConnections(unittest.TestCase):
    def setUp(self):
        self.l1 = ELock(ELOCK_SERVER)
        self.l2 = ELock(ELOCK_SERVER)

    def tearDown(self):
        self.l1.close()
        self.l2.close()

    def testConcurrentLockUnlock(self):
        self.assertTrue(self.l1.lock(LOCKS[0]))
        self.assertFalse(self.l2.lock(LOCKS[0]))
        self.assertTrue(self.l1.unlock(LOCKS[0]))
        self.assertTrue(self.l2.lock(LOCKS[0]))

    def testUnlockAll(self):
        self.assertTrue(self.l1.lock(LOCKS[0]))
        self.assertFalse(self.l2.lock(LOCKS[0]))
        self.assertTrue(self.l1.unlock_all())
        self.assertTrue(self.l2.lock(LOCKS[0]))