def setUp(self): """ Initialize test members. Start port agent. Start container and client. Start streams and subscribers. Start agent, client. """ TrhphTestCase.setUp(self) # Start port agent, add stop to cleanup. self._pagent = None self._start_pagent() self.addCleanup(self._stop_pagent) # Start container. self._start_container() # Bring up services in a deploy file (no need to message) self.container.start_rel_from_url("res/deploy/r2dm.yml") # Start data suscribers, add stop to cleanup. # Define stream_config. self._no_samples = None self._async_data_result = AsyncResult() self._data_greenlets = [] self._stream_config = {} self._samples_received = [] self._data_subscribers = [] self._start_data_subscribers() self.addCleanup(self._stop_data_subscribers) # Start event subscribers, add stop to cleanup. self._no_events = None self._async_event_result = AsyncResult() self._events_received = [] self._event_subscribers = [] self._start_event_subscribers() self.addCleanup(self._stop_event_subscribers) # Create agent config. agent_config = { "driver_config": DVR_CONFIG, "stream_config": self._stream_config, "agent": {"resource_id": IA_RESOURCE_ID}, "test_mode": True, } # Start instrument agent. self._ia_pid = None log.debug("TestInstrumentAgent.setup(): starting IA.") container_client = ContainerAgentClient(node=self.container.node, name=self.container.name) self._ia_pid = container_client.spawn_process(name=IA_NAME, module=IA_MOD, cls=IA_CLS, config=agent_config) log.info("Agent pid=%s.", str(self._ia_pid)) # Start a resource agent client to talk with the instrument agent. self._ia_client = None self._ia_client = ResourceAgentClient(IA_RESOURCE_ID, process=FakeProcess()) log.info("Got ia client %s.", str(self._ia_client))
def setUp(self): """ Calls TrhphTestCase.setUp(self),creates and assigns the TrhphDriverProxy, and assign the comm_config object. """ TrhphTestCase.setUp(self) def evt_callback(event): log.info("CALLBACK: %s" % str(event)) # needed by DriverTestMixin self.driver = TrhphInstrumentDriver(evt_callback) self.comms_config = { 'addr': self.device_address, 'port': self.device_port}
def setUp(self): """ Calls TrhphTestCase.setUp(self), creates and assigns the TrhphDriverProxy, and assigns the comms_config object. """ TrhphTestCase.setUp(self) # needed by DriverTestMixin self.driver = TrhphDriverProxy(self.device_address, self.device_port) self.comms_config = self.driver.comms_config def cleanup(): self.driver._support.stop_pagent() self.driver._support.stop_driver() self.addCleanup(cleanup)