def testLockUnlock(self): device = FakeDevice("d1") devLock = DeviceLock(device, FakeTestExec()) devLock.lock() self.assertTrue(devLock._locked) devLock.unlock() self.assertFalse(devLock._locked)
def testGetattr(self): device = FakeDevice("d1") devLock = DeviceLock(device, FakeTestExec()) box = {"TestName": "TestValue"} device.box = box self.assertEqual(box, devLock.box) device.connected = False try: devLock.box except TestAbortError, err: self.failUnlessEqual(str(err), "Device disconnected")
def testStop(self): device = FakeDevice("d1") devLock = DeviceLock(device, FakeTestExec()) devLock.stop() self.assertFalse(devLock._locked) self.assertTrue(devLock._shouldAbort)
def testEqual(self): device = FakeDevice("d1") devLock = DeviceLock(device, FakeTestExec()) self.assertTrue(devLock == device)
def testCreate(self): device = FakeDevice("d1") devLock = DeviceLock(device, FakeTestExec()) self.assertFalse(devLock._locked) self.assertFalse(devLock._shouldAbort)