def test_opendriver_close_driver(self): print(inspect.getframeinfo(inspect.currentframe())[2]) status = xl.OpenDriver() self.assertEqual(status, xl.XL_SUCCESS) status = xl.CloseDriver() self.assertEqual(status, xl.XL_SUCCESS)
def __del__(self): # # tearDown Driver. see 4.2 Flowchart in XL Driver Library - Description.pdf # status = xl.DeactivateChannel(self.portHandle[0], self.accessMask) if status != xl.XL_SUCCESS: self.log.debug( f"[{self.appName:8}][{self.__del__.__name__:8}] DeactivateChannel returned {status}. portHandle:{self.portHandle}, accessMask:{self.accessMask}" ) status = xl.ClosePort(self.portHandle[0]) if status != xl.XL_SUCCESS: self.log.debug( f"[{self.appName:8}][{self.__del__.__name__:8}] ClosePort returned {status}. portHandle:{self.portHandle}" ) status = xl.CloseDriver() if status != xl.XL_SUCCESS: self.log.debug( f"[{self.appName:8}][{self.__del__.__name__:8}] CloseDriver returned {status}" )
def test_openport_closeport(self): print(inspect.getframeinfo(inspect.currentframe())[2]) portHandle = [xl.XL_INVALID_PORTHANDLE] permissionMask = [self.accessMask] rxQueueSize = 2 ^ 10 appName = self.appName accessMask = self.accessMask xlInterfaceVersion = xl.XL_INTERFACE_VERSION busType = self.busType status = xl.OpenPort(portHandle, appName, accessMask, permissionMask, rxQueueSize, xlInterfaceVersion, busType) self.assertEqual(status, xl.XL_SUCCESS) self.assertNotEqual(portHandle, xl.XL_INVALID_PORTHANDLE) self.assertEqual(permissionMask[0], self.accessMask) status = xl.ClosePort(portHandle[0]) self.assertEqual(status, xl.XL_SUCCESS) status = xl.CloseDriver() self.assertEqual(status, xl.XL_SUCCESS)
def tearDown(self): xl.CloseDriver()
def tearDown(self): xl.DeactivateChannel(self.portHandle[0], self.accessMask) xl.ClosePort(self.portHandle[0]) xl.CloseDriver()
def tearDown(self): xl.ClosePort(self.portHandle[0]) xl.CloseDriver()