openpectus.test.engine.test_opcua_hardware

Attributes

logger

opcua_host

Classes

OPCUATestServer

Context manager which launches OPC-UA test server.

TestOPCUAHardware

A class whose instances are single test cases.

Functions

opcua_test_server_task(port_suffix, registers, ...)

sync_opcua_test_server_task(*args, **kwargs)

attempt_to_use_hardware()

Module Contents

openpectus.test.engine.test_opcua_hardware.logger
openpectus.test.engine.test_opcua_hardware.opcua_host = 'opc.tcp://127.0.0.1:484{:02d}'
async openpectus.test.engine.test_opcua_hardware.opcua_test_server_task(port_suffix, registers, callback_output_queue, stop_event, is_started_event, is_finished_event)
Parameters:
Return type:

None

openpectus.test.engine.test_opcua_hardware.sync_opcua_test_server_task(*args, **kwargs)
class openpectus.test.engine.test_opcua_hardware.OPCUATestServer(port_suffix=0, registers=None)

Context manager which launches OPC-UA test server.

Parameters:

port_suffix (int)

port_suffix = 0
callback_output_queue
server_write_events: list[tuple[str, Any]] = []
registers
__enter__()
__exit__(type, value, traceback)
class openpectus.test.engine.test_opcua_hardware.TestOPCUAHardware(methodName='runTest')

Bases: unittest.TestCase

A class whose instances are single test cases.

By default, the test code itself should be placed in a method named ‘runTest’.

If the fixture may be used for many test cases, create as many test methods as are needed. When instantiating such a TestCase subclass, specify in the constructor arguments the name of the test method that the instance is to execute.

Test authors should subclass TestCase for their own tests. Construction and deconstruction of the test’s environment (‘fixture’) can be implemented by overriding the ‘setUp’ and ‘tearDown’ methods respectively.

If it is necessary to override the __init__ method, the base class __init__ method must always be called. It is important that subclasses should not change the signature of their __init__ method, since instances of the classes are instantiated automatically by parts of the framework in order to be run.

When subclassing TestCase, you can set these attributes: * failureException: determines which exception will be raised when

the instance’s assertion methods fail; test methods raising this exception will be deemed to have ‘failed’ rather than ‘errored’.

  • longMessage: determines whether long messages (including repr of

    objects used in assert methods) will be printed on failure in addition to any explicit message passed.

  • maxDiff: sets the maximum length of a diff in failure messages

    by assert methods using difflib. It is looked up as an instance attribute so can be configured by individual tests if required.

test_can_connect()
test_reconnect()
test_connection_left_connected_does_not_hang()
test_can_read_register()
test_can_write_register()
test_can_read_multiple_registers()
test_can_write_multiple_registers()
test_does_help_user_fix_path_typo()
test_can_read_write_registers_with_type()
test_illegal_register_type_is_detected()
test_type_disparity_is_detected()
test_type_is_inferred()
test_access_level_disparity_is_detected()
test_exception_when_attempting_to_access_using_disconnected_client()
openpectus.test.engine.test_opcua_hardware.attempt_to_use_hardware()