Skip to content

optimize slow tests. #1992

@janiversen

Description

@janiversen

the slowest tests are:

3.53s test_comm.py::TestCommModbusProtocol::test_connected_multiple
3.31s test_comm.py::TestCommModbusProtocol::test_connected
3.01s test_client_sync.py::TestSynchronousClient::test_basic_sync_serial_client
3.00s test_client_sync.py::TestSynchronousClient::test_serial_client_recv
2.52s test_client_server_sync.py::TestClientServerSyncExamples::test_server_client_twice
2.20s test_examples.py::TestSyncExamples::test_client_calls[serial-rtu-localhost]
1.86s test_client_server_sync.py::TestClientServerSyncExamples::test_combinations[serial-rtu-localhost]
1.85s test_examples.py::TestSyncExamples::test_sync_simple_client[serial-rtu-localhost]
1.53s test_examples.py::TestSyncExamples::test_client_calls[tcp-socket-localhost]
1.53s test_examples.py::TestSyncExamples::test_client_calls[udp-socket-localhost]
1.53s test_examples.py::TestSyncExamples::test_sync_simple_client[tcp-socket-localhost]
1.52s call test/sub_examples/test_examples.py::TestSyncExamples::test_sync_simple_client[udp-socket-localhost]
1.52s call test/sub_examples/test_client_server_sync.py::TestClientServerSyncExamples::test_combinations[tcp-socket-localhost]

Most likely the problem is missing use of NULL_MODEM (apart from test_connected*)

Another problem is asyncio.sleep(), which can in many cases be changed to a "wait with timeout".

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions