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

L2SS-412: Migrate integration tests to asyncua and asynctest

parent 74acc067
No related branches found
No related tags found
1 merge request!142L2SS-412: Use asyncio for opcua and other clients
...@@ -7,26 +7,26 @@ ...@@ -7,26 +7,26 @@
# Distributed under the terms of the APACHE license. # Distributed under the terms of the APACHE license.
# See LICENSE.txt for more info. # See LICENSE.txt for more info.
from opcua import Client from asyncua import Client
from integration_test import base from integration_test import base
class TestSDPTRSim(base.IntegrationTestCase): class TestSDPTRSim(base.IntegrationAsyncTestCase):
def setUp(self): def setUp(self):
super(TestSDPTRSim, self).setUp() super(TestSDPTRSim, self).setUp()
def test_opcua_connection(self): async def test_opcua_connection(self):
"""Check if we can connect to sdptr-sim""" """Check if we can connect to sdptr-sim"""
client = Client("opc.tcp://sdptr-sim:4840") client = Client("opc.tcp://sdptr-sim:4840")
root_node = None root_node = None
try: try:
client.connect() await client.connect()
root_node = client.get_root_node() root_node = await client.get_root_node()
finally: finally:
client.disconnect() await client.disconnect()
self.assertNotEqual(None, root_node) self.assertNotEqual(None, root_node)
...@@ -7,27 +7,27 @@ ...@@ -7,27 +7,27 @@
# Distributed under the terms of the APACHE license. # Distributed under the terms of the APACHE license.
# See LICENSE.txt for more info. # See LICENSE.txt for more info.
from opcua import Client from asyncua import Client
from integration_test import base from integration_test import base
class TestUNB2Sim(base.IntegrationTestCase): class TestUNB2Sim(base.IntegrationAsyncTestCase):
def setUp(self): def setUp(self):
super(TestUNB2Sim, self).setUp() super(TestUNB2Sim, self).setUp()
def test_opcua_connection(self): async def test_opcua_connection(self):
"""Check if we can connect to unb2-sim""" """Check if we can connect to unb2-sim"""
client = Client("opc.tcp://unb2-sim:4844") client = Client("opc.tcp://unb2-sim:4844")
root_node = None root_node = None
client.connect() await client.connect()
try: try:
root_node = client.get_root_node() root_node = await client.get_root_node()
finally: finally:
client.disconnect() await client.disconnect()
self.assertNotEqual(None, root_node) self.assertNotEqual(None, root_node)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment