From 87a044635f7bda9dc44ec9e82df7a381b36a6f73 Mon Sep 17 00:00:00 2001 From: Aliaksandr Nikitsin Date: Thu, 25 Jun 2026 18:32:38 +0200 Subject: [PATCH] handle device ip changed --- modules/test/base/python/src/test_module.py | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/modules/test/base/python/src/test_module.py b/modules/test/base/python/src/test_module.py index 7e376fa64..52677b5b6 100644 --- a/modules/test/base/python/src/test_module.py +++ b/modules/test/base/python/src/test_module.py @@ -129,12 +129,24 @@ def _get_device_test_module(self): return None def run_tests(self): - + tests = self._get_tests() if self._config['config']['network']: self._device_ipv4_addr = self._get_device_ipv4() - LOGGER.info('Resolved device IP: ' + str(self._device_ipv4_addr)) - - tests = self._get_tests() + if self._device_ipv4_addr is not None: + LOGGER.info('Resolved device IP: ' + str(self._device_ipv4_addr)) + else: + LOGGER.error('Could not resolve device IP address.') + now_iso = datetime.now().isoformat() + for test in tests: + test['start'] = now_iso + test['end'] = now_iso + test['duration'] = str(datetime.fromisoformat(test['end']) - + datetime.fromisoformat(test['start'])) + test['result'] = TestResult.ERROR + test['description'] = 'Could not resolve device IP address' + json_results = json.dumps({'results': tests}, indent=2) + self._write_results(json_results) + return for test in tests: test_method_name = '_' + test['name'].replace('.', '_') result = None