Import taurus in PyTango DS causes that delete_device is not called at shutdown

Not sure if this is a problem in Taurus or PyTango. But if I import taurus in PyTango DS this causes that the delete_device method is not called at the DS shutdown. This does not happen with python 2 but happens with python 3.

To reproduce:

  1. Copy the following snippet in PyDsExp.py file:
import sys

import PyTango
import taurus


class PyDsExpClass(PyTango.DeviceClass):


    def __init__(self, name):
        PyTango.DeviceClass.__init__(self, name)
        self.set_type("TestDevice")


class PyDsExp(PyTango.Device_4Impl):

    def __init__(self,cl,name):
        PyTango.Device_4Impl.__init__(self, cl, name)
        PyDsExp.init_device(self)

    def init_device(self):
        self.set_state(PyTango.DevState.ON)

    def delete_device(self):
        print("delete_device")


if __name__ == '__main__':
    util = PyTango.Util(sys.argv)
    util.add_class(PyDsExpClass, PyDsExp)

    U = PyTango.Util.instance()
    U.server_init()
    U.server_run()
  1. Define PyDsExp DS instance with one device:
tango_admin --add-server PyDsExp/test PyDsExp test/pydsexp/1

On Debian tango_admin is installed in /usr/lib/tango.

  1. Run DS:
python3 PyDsExp.py test
  1. After the DS is ready press Ctrl + C.

Then, you won't observe "delete_device" print. When you run it with python 2 you can see it.

Edited by Carlos Pascual