Add unique test identifier to be able to manage logs

Signed-off-by: Katarzyna Treder <katarzyna.treder@h-partners.com>
This commit is contained in:
Katarzyna Treder 2025-01-07 15:18:46 +01:00
parent 2f827e2ff0
commit 99b731d180
2 changed files with 4 additions and 1 deletions

@ -1 +1 @@
Subproject commit f7f2914e41ce73d13dafe6cd749aa6e2d33b4315 Subproject commit 1d7589644a95caeaaeda0eeb99a2985d174f68d0

View File

@ -81,6 +81,7 @@ def pytest_runtest_setup(item):
test_name = item.name.split("[")[0] test_name = item.name.split("[")[0]
TestRun.LOGGER = create_log(item.config.getoption("--log-path"), test_name) TestRun.LOGGER = create_log(item.config.getoption("--log-path"), test_name)
TestRun.LOGGER.unique_test_identifier = f"TEST__{item.name}__random_seed_{TestRun.random_seed}"
duts = item.config.getoption("--dut-config") duts = item.config.getoption("--dut-config")
required_duts = next(item.iter_markers(name="multidut"), None) required_duts = next(item.iter_markers(name="multidut"), None)
@ -126,6 +127,8 @@ def pytest_runtest_setup(item):
f"Exception occurred during test setup:\n{str(ex)}\n{traceback.format_exc()}" f"Exception occurred during test setup:\n{str(ex)}\n{traceback.format_exc()}"
) )
TestRun.LOGGER.print_test_identifier_to_logs()
TestRun.usr = Opencas( TestRun.usr = Opencas(
repo_dir=os.path.join(os.path.dirname(__file__), "../../.."), repo_dir=os.path.join(os.path.dirname(__file__), "../../.."),
working_dir=dut_config["working_dir"], working_dir=dut_config["working_dir"],