Giter VIP home page Giter VIP logo

Comments (4)

kmadisa avatar kmadisa commented on July 17, 2024

Added a simple test that calls a command on the sim device in the class

class test_TangoSimGenDeviceIntegration(ClassCleanupUnittestMixin, unittest.TestCase):

def test_Add(self):
        command_name = "Add"
        expected_value = 5
        actual_value = self.sim_device.command_inout(command_name, [3, 2])
        time.sleep(1)
        self.assertEqual(
            expected_value,
            actual_value)

That resulted in an error:

test_Add (tango_simlib.tests.test_sim_test_interface.test_TangoSimGenDeviceIntegration) ... omniORB: (6) 2021-11-29 09:51:19.888749: Warning: method 'command_inout_4' raised an unexpected exception (not a CORBA exception).
ERROR

======================================================================
ERROR: test_Add (tango_simlib.tests.test_sim_test_interface.test_TangoSimGenDeviceIntegration)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/app/tango-simlib/tango_simlib/tests/test_sim_test_interface.py", line 401, in test_Add
    actual_value = self.sim_device.command_inout(command_name, [3, 2])
  File "/usr/local/lib/python3.7/dist-packages/tango/green.py", line 195, in greener
    return executor.run(fn, args, kwargs, wait=wait, timeout=timeout)
  File "/usr/local/lib/python3.7/dist-packages/tango/green.py", line 109, in run
    return fn(*args, **kwargs)
  File "/usr/local/lib/python3.7/dist-packages/tango/connection.py", line 108, in __Connection__command_inout
    r = Connection.command_inout_raw(self, name, *args, **kwds)
  File "/usr/local/lib/python3.7/dist-packages/tango/connection.py", line 137, in __Connection__command_inout_raw
    return self.__command_inout(cmd_name, param)
PyTango.CommunicationFailed: DevFailed[
DevError[
    desc = UNKNOWN CORBA system exception
  origin = Connection::command_inout()
  reason = API_CorbaException
severity = ERR]

DevError[
    desc = Failed to execute command_inout on device test/nodb/tangodeviceserver, command Add
  origin = Connection::command_inout()
  reason = API_CommunicationFailed
severity = ERR]
]

from tango-simlib.

kmadisa avatar kmadisa commented on July 17, 2024

I had a look at the model layer to check if the actions on the model worked as expected and this is the output:

In [66]: model.sim_actions['Command1']
Out[66]: functools.partial(<function PopulateModelActions.generate_action_handler.<locals>.action_handler at 0x7f7ddeac98c8>, <tango_simlib.model.Model object at 0x7f7ddeecbb70>)

In [67]: model.test_sim_actions['Command1']
Out[67]: functools.partial(<bound method TestSimControl.test_action_command1 of <test_module.TestSimControl object at 0x7f7ddecf6588>>, <tango_simlib.model.Model object at 0x7f7ddeecbb70>)

From the output we can see that the handler for Command1 in model.sim_actions is not a bound method of the Testsim class, as expected.

from tango-simlib.

kmadisa avatar kmadisa commented on July 17, 2024

This is the output of the command_info and its corresponding override_info of the model used for testing:

In[51] psr.get_device_command_metadata()
Out[52]: 
{'Command1': {'name': 'Command1',
  'description': 'Runs command2',
  'actions': [],
  'dtype_in': tango._tango.CmdArgType.DevVoid,
  'doc_in': 'No input parameter',
  'dformat_in': tango._tango.AttrDataFormat.SCALAR,
  'dtype_out': tango._tango.CmdArgType.DevVoid,
  'doc_out': 'Command responds',
  'dformat_out': tango._tango.AttrDataFormat.SCALAR},
 'test_Command1': {'name': 'test_Command1',
  'description': 'Runs command1',
  'dtype_in': tango._tango.CmdArgType.DevVoid,
  'doc_in': 'No input parameter',
  'dformat_in': tango._tango.AttrDataFormat.SCALAR,
  'dtype_out': tango._tango.CmdArgType.DevVoid,
  'doc_out': 'Command responds',
  'dformat_out': tango._tango.AttrDataFormat.SCALAR}}

In[53] psr.get_device_cmd_override_metadata()
Out[54]: 
{'Sim_Test': {'name': 'Sim_Test',
  'module_directory': '/tango_simlib/scripts/',
  'module_name': 'test_module',
  'class_name': 'TestSim'},
 'SimControl_Test': {'name': 'SimControl_Test',
  'module_directory': '/tango_simlib/scripts/',
  'module_name': 'test_module',
  'class_name': 'TestSimControl'}}

from tango-simlib.

kmadisa avatar kmadisa commented on July 17, 2024

Files used to reproduce the issue (NB: the files were placed in the scripts/ directory):

from tango-simlib.

Related Issues (10)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.