Loading csp-lmc-mid/tests/MidCspSubarray_test.py +0 −77 Original line number Diff line number Diff line Loading @@ -306,80 +306,3 @@ class TestCspSubarray(object): if df: err_msg = str(df.value.args[0].desc) assert "RemoveAllReceptors command can't be issued when the obsState is READY" in err_msg def test_remove_receptors_when_idle(self, midcsp_subarray01): """ Test the complete deallocation of receptors from a CspSubarray when the subarray is IDLE. """ obs_state = midcsp_subarray01.obsState assert obs_state == ObsState.READY # command transition to IDLE midcsp_subarray01.GoToIdle() time.sleep(3) obs_state = midcsp_subarray01.obsState assert obs_state == ObsState.IDLE midcsp_subarray01.RemoveAllReceptors() time.sleep(3) subarray_state = midcsp_subarray01.state() assert subarray_state == tango.DevState.OFF assert obs_state == ObsState.IDLE def test_two_subarrays_configureScan(self, midcsp_subarray01, midcsp_subarray02, midcsp_master, tm1_telstate_proxy): """ Test that the Configure() command is issued when the Subarray state is ON and ObsState is IDLE or READY """ midcsp_subarray01.Init() time.sleep(5) # reinitialize TmTelState simulator to have success # in configurin the subarray_01 tm1_telstate_proxy.Init() obs_state1 = midcsp_subarray01.obsState obs_state2 = midcsp_subarray02.obsState assert ((obs_state1 == 0) and (obs_state2 == 0)) receptor_membership = midcsp_master.receptorMembership receptor_list = midcsp_master.unassignedReceptorIDs midcsp_subarray01.AddReceptors([1,4]) midcsp_subarray02.AddReceptors([2,3]) time.sleep(2) start_time = time.time() timeout = False while True: sub1_state = midcsp_subarray01.state() sub2_state = midcsp_subarray02.state() if ((sub1_state == tango.DevState.ON) and (sub2_state == tango.DevState.ON)): break else: time.sleep(0.2) elapsed_time = time.time() - start_time if elapsed_time > 3: timeout = True break assert not timeout obs_state1 = midcsp_subarray01.obsState obs_state2 = midcsp_subarray02.obsState file_path = os.path.dirname(os.path.abspath(__file__)) f1 = open(file_path + "/configScan_sub1.json") f2 = open(file_path + "/configScan_sub2.json") midcsp_subarray01.Configure(f1.read().replace("\n", "")) time.sleep(2) midcsp_subarray02.Configure(f2.read().replace("\n", "")) f1.close() f2.close() start_time = time.time() while True: obs_state1 = midcsp_subarray01.obsState obs_state2 = midcsp_subarray02.obsState if ((obs_state1 == 2) and (obs_state2 == 2)): break else: time.sleep(0.2) elapsed_time = time.time() - start_time # use the default value for the configureDelayExpected # need to do some work on setting this value if elapsed_time > 10: break assert ((obs_state2 == 2) and (obs_state1 == 2)) time.sleep(1) assert not midcsp_subarray01.timeoutExpiredFlag Loading
csp-lmc-mid/tests/MidCspSubarray_test.py +0 −77 Original line number Diff line number Diff line Loading @@ -306,80 +306,3 @@ class TestCspSubarray(object): if df: err_msg = str(df.value.args[0].desc) assert "RemoveAllReceptors command can't be issued when the obsState is READY" in err_msg def test_remove_receptors_when_idle(self, midcsp_subarray01): """ Test the complete deallocation of receptors from a CspSubarray when the subarray is IDLE. """ obs_state = midcsp_subarray01.obsState assert obs_state == ObsState.READY # command transition to IDLE midcsp_subarray01.GoToIdle() time.sleep(3) obs_state = midcsp_subarray01.obsState assert obs_state == ObsState.IDLE midcsp_subarray01.RemoveAllReceptors() time.sleep(3) subarray_state = midcsp_subarray01.state() assert subarray_state == tango.DevState.OFF assert obs_state == ObsState.IDLE def test_two_subarrays_configureScan(self, midcsp_subarray01, midcsp_subarray02, midcsp_master, tm1_telstate_proxy): """ Test that the Configure() command is issued when the Subarray state is ON and ObsState is IDLE or READY """ midcsp_subarray01.Init() time.sleep(5) # reinitialize TmTelState simulator to have success # in configurin the subarray_01 tm1_telstate_proxy.Init() obs_state1 = midcsp_subarray01.obsState obs_state2 = midcsp_subarray02.obsState assert ((obs_state1 == 0) and (obs_state2 == 0)) receptor_membership = midcsp_master.receptorMembership receptor_list = midcsp_master.unassignedReceptorIDs midcsp_subarray01.AddReceptors([1,4]) midcsp_subarray02.AddReceptors([2,3]) time.sleep(2) start_time = time.time() timeout = False while True: sub1_state = midcsp_subarray01.state() sub2_state = midcsp_subarray02.state() if ((sub1_state == tango.DevState.ON) and (sub2_state == tango.DevState.ON)): break else: time.sleep(0.2) elapsed_time = time.time() - start_time if elapsed_time > 3: timeout = True break assert not timeout obs_state1 = midcsp_subarray01.obsState obs_state2 = midcsp_subarray02.obsState file_path = os.path.dirname(os.path.abspath(__file__)) f1 = open(file_path + "/configScan_sub1.json") f2 = open(file_path + "/configScan_sub2.json") midcsp_subarray01.Configure(f1.read().replace("\n", "")) time.sleep(2) midcsp_subarray02.Configure(f2.read().replace("\n", "")) f1.close() f2.close() start_time = time.time() while True: obs_state1 = midcsp_subarray01.obsState obs_state2 = midcsp_subarray02.obsState if ((obs_state1 == 2) and (obs_state2 == 2)): break else: time.sleep(0.2) elapsed_time = time.time() - start_time # use the default value for the configureDelayExpected # need to do some work on setting this value if elapsed_time > 10: break assert ((obs_state2 == 2) and (obs_state1 == 2)) time.sleep(1) assert not midcsp_subarray01.timeoutExpiredFlag