Skip to content
Snippets Groups Projects
Commit c43bfd67 authored by Jan David Mol's avatar Jan David Mol
Browse files

L2SS-412: Use asynctest for tests (they didnt run without), and fix tests

parent 570b9d97
Branches
Tags
No related merge requests found
......@@ -31,7 +31,7 @@ class TestCase(BaseTestCase):
super().setUp()
class AsyncTestCase(BaseTestCase):
class AsyncTestCase(testscenarios.WithScenarios, asynctest.TestCase):
"""Test case base class for all asyncio unit tests."""
def setUp(self):
......
......@@ -70,7 +70,7 @@ class TestOPCua(base.AsyncTestCase):
@asynctest.patch.object(OPCUAConnection, "ping")
@asynctest.patch.object(opcua_client, "Client")
@mock.patch.object(opcua_client, 'ProtocolAttribute')
@asynctest.patch.object(opcua_client, 'ProtocolAttribute')
async def test_opcua_attr_setup(self, m_protocol_attr, m_opc_client, m_ping):
"""
This tests covers the correct creation of read/write functions.
......@@ -238,9 +238,9 @@ class TestOPCua(base.AsyncTestCase):
# create the protocolattribute
if len(j) == 1:
test = opcua_client.ProtocolAttribute(m_node, j[0], 0, opcua_client.numpy_to_OPCua_dict[i.numpy_type], self.loop)
test = opcua_client.ProtocolAttribute(m_node, j[0], 0, opcua_client.numpy_to_OPCua_dict[i.numpy_type])
else:
test = opcua_client.ProtocolAttribute(m_node, j[1], j[0], opcua_client.numpy_to_OPCua_dict[i.numpy_type], self.loop)
test = opcua_client.ProtocolAttribute(m_node, j[1], j[0], opcua_client.numpy_to_OPCua_dict[i.numpy_type])
# comparison function that replaces `set_data_value` inside the attributes write function
async def compare_values(val):
......
......@@ -75,7 +75,7 @@ class TestLofarLogging(base.TestCase):
# create a Tango Device that logs something
class MyDevice(Device):
def __init__(self):
def init_device(self):
self.log_deeper_in_stack()
def log_deeper_in_stack(self):
......@@ -83,7 +83,7 @@ class TestLofarLogging(base.TestCase):
with mock.patch.object(device_server.DeviceImpl, '__info_stream') as m_info_stream:
# logs in the constructor already
mydevice = MyDevice()
mydevice = MyDevice(None, "MyDeviceName")
self.assertEqual(mydevice, self.memory_handler.records[0].tango_device, msg="configure_logging did not detect active Tango device")
self.assertEqual(1, m_info_stream.call_count, msg="configure_logger did not send logs to active Tango device")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment