コード例 #1
0
    def test_direct_access_telnet_mode(self):
        """
        @brief This test manually tests that the Instrument Driver properly supports direct access to the physical
        instrument. (telnet mode)
        """
        self.assert_enter_command_mode()
        self.assert_direct_access_start_telnet()
        self.assertTrue(self.tcp_client)

        # set direct access parameters (these should be reset upon return from direct access)
        self.tcp_client.send_data('dcpwm 1')  # read-only, direct access
        self.tcp_client.expect_regex(' = ')

        self.tcp_client.send_data('m1a_tmoc 30')  # read-write, direct access
        self.tcp_client.expect_regex(' = ')

        # without saving the parameters, the values will be reset on reboot (which is part of wakeup)
        self.tcp_client.send_data('#3_params save')  # read-write, direct access
        self.tcp_client.expect_regex('save\*')

        self.assert_direct_access_stop_telnet()

        # verify that all direct access parameters are restored
        parameters = Parameter.dict()
        for key in self._driver_parameters.keys():
            # verify access of parameters - default values
            if self._driver_parameters[key][self.DA]:
                log.debug('checking direct access parameter: %s', key)
                # verify we cannot set readonly parameters
                self.assert_get_parameter(key, self._driver_parameters[key][self.VALUE])
コード例 #2
0
 def test_out_of_range(self):
     self.assert_initialize_driver()
     constraints = ParameterConstraints.dict()
     parameters = Parameter.dict()
     for key in constraints:
         _, minimum, maximum = constraints[key]
         self.assert_set_exception(parameters[key], minimum - 1)
         self.assert_set_exception(parameters[key], maximum + 1)
         self.assert_set_exception(parameters[key], 'expects int, not string!!')
コード例 #3
0
 def test_out_of_range(self):
     self.assert_initialize_driver()
     constraints = ParameterConstraints.dict()
     parameters = Parameter.dict()
     for key in constraints:
         _, minimum, maximum = constraints[key]
         self.assert_set_exception(parameters[key], minimum - 1)
         self.assert_set_exception(parameters[key], maximum + 1)
         self.assert_set_exception(parameters[key], 'expects int, not string!!')
コード例 #4
0
    def test_get_set_parameters(self):
        """
        verify that all parameters can be get set properly, this includes
        ensuring that read only parameters fail on set.
        """
        self.assert_enter_command_mode()

        # verify we can set read/write parameters
        constraints = ParameterConstraints.dict()
        parameters = Parameter.dict()
        for key in constraints:
            if self._driver_parameters[parameters[key]][self.READONLY]:
                continue
            _, _, maximum = constraints[key]
            self.assert_set_parameter(parameters[key], maximum)
コード例 #5
0
    def test_get_set_parameters(self):
        """
        verify that all parameters can be get set properly, this includes
        ensuring that read only parameters fail on set.
        """
        self.assert_enter_command_mode()

        # verify we can set read/write parameters
        constraints = ParameterConstraints.dict()
        parameters = Parameter.dict()
        for key in constraints:
            if self._driver_parameters[parameters[key]][self.READONLY]:
                continue
            _, _, maximum = constraints[key]
            self.assert_set_parameter(parameters[key], maximum)