def test_extend03(self): """File not exist""" lock = Host(self.test_root).get_lock('test') lock.acquire() os.remove(lock.file) with self.assertRaises(wsb_host.LockExtendNotFoundError): lock.extend()
def test_extend01(self): """Nnormal case""" lock = Host(self.test_root).get_lock('test') lock.acquire() prev_time = os.stat(lock.file).st_mtime time.sleep(0.05) lock.extend() cur_time = os.stat(lock.file).st_mtime self.assertGreater(cur_time, prev_time) self.assertTrue(lock.locked)
def test_extend02(self): """Not acquired""" lock = Host(self.test_root).get_lock('test') with self.assertRaises(wsb_host.LockExtendNotAcquiredError): lock.extend()