From 54bf506854da310c1fd6d3a39fb792a8a21f171b Mon Sep 17 00:00:00 2001 From: jhughesbiot Date: Fri, 2 Aug 2024 14:02:56 -0600 Subject: [PATCH 1/2] Pin all required packages Update modbus constructor to prevent error Add full trace logging for general errors in tests --- modules/test/base/python/src/test_module.py | 2 ++ modules/test/protocol/python/requirements.txt | 8 ++++---- modules/test/protocol/python/src/protocol_modbus.py | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/modules/test/base/python/src/test_module.py b/modules/test/base/python/src/test_module.py index dcd9be905..5af775b33 100644 --- a/modules/test/base/python/src/test_module.py +++ b/modules/test/base/python/src/test_module.py @@ -17,6 +17,7 @@ import os import util from datetime import datetime +import traceback LOGGER = None RESULTS_DIR = '/runtime/output/' @@ -113,6 +114,7 @@ def run_tests(self): except Exception as e: # pylint: disable=W0718 LOGGER.error(f'An error occurred whilst running {test["name"]}') LOGGER.error(e) + traceback.print_exc() else: LOGGER.info(f'Test {test["name"]} not implemented. Skipping') test['result'] = 'Error' diff --git a/modules/test/protocol/python/requirements.txt b/modules/test/protocol/python/requirements.txt index 57917735d..5b54a724d 100644 --- a/modules/test/protocol/python/requirements.txt +++ b/modules/test/protocol/python/requirements.txt @@ -1,7 +1,7 @@ # Required for BACnet protocol tests -netifaces -BAC0 -pytz +netifaces==0.11.0 +BAC0==23.7.3 +pytz==2024.1 # Required for Modbus protocol tests -pymodbus \ No newline at end of file +pymodbus==3.7.0 \ No newline at end of file diff --git a/modules/test/protocol/python/src/protocol_modbus.py b/modules/test/protocol/python/src/protocol_modbus.py index 925e9517a..a722f928e 100644 --- a/modules/test/protocol/python/src/protocol_modbus.py +++ b/modules/test/protocol/python/src/protocol_modbus.py @@ -103,7 +103,7 @@ def __init__(self, log, device_ip, config): self._discrete_input_enabled = False # Initialize the modbus client - self.client = ModbusClient(device_ip, self._port) + self.client = ModbusClient(host=device_ip, port=self._port) # Connections created from this method are simple socket connections # and aren't indicative of valid modbus From 872cac4cf818fb3770ad9df38e38e60ddf71c5e3 Mon Sep 17 00:00:00 2001 From: Jacob Boddey Date: Sun, 4 Aug 2024 09:39:57 +0100 Subject: [PATCH 2/2] Fix pylint issue --- modules/test/base/python/src/test_module.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/test/base/python/src/test_module.py b/modules/test/base/python/src/test_module.py index 5af775b33..deed0d978 100644 --- a/modules/test/base/python/src/test_module.py +++ b/modules/test/base/python/src/test_module.py @@ -114,7 +114,7 @@ def run_tests(self): except Exception as e: # pylint: disable=W0718 LOGGER.error(f'An error occurred whilst running {test["name"]}') LOGGER.error(e) - traceback.print_exc() + traceback.print_exc() else: LOGGER.info(f'Test {test["name"]} not implemented. Skipping') test['result'] = 'Error'