Skip to content

Commit 0c7f0c1

Browse files
author
Katarzyna Treder
committed
Add unique test identifier to be able to manage logs
Signed-off-by: Katarzyna Treder <katarzyna.treder@h-partners.com>
1 parent 1934e80 commit 0c7f0c1

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

test/functional/test-framework

test/functional/tests/conftest.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#
22
# Copyright(c) 2019-2022 Intel Corporation
3-
# Copyright(c) 2023-2024 Huawei Technologies Co., Ltd.
3+
# Copyright(c) 2023-2025 Huawei Technologies Co., Ltd.
44
# SPDX-License-Identifier: BSD-3-Clause
55
#
66

@@ -77,6 +77,7 @@ def pytest_runtest_setup(item):
7777

7878
test_name = item.name.split("[")[0]
7979
TestRun.LOGGER = create_log(item.config.getoption("--log-path"), test_name)
80+
TestRun.LOGGER.unique_test_identifier = f"TEST__{item.name}__random_seed_{TestRun.random_seed}"
8081

8182
duts = item.config.getoption("--dut-config")
8283
required_duts = next(item.iter_markers(name="multidut"), None)
@@ -122,6 +123,8 @@ def pytest_runtest_setup(item):
122123
f"Exception occurred during test setup:\n{str(ex)}\n{traceback.format_exc()}"
123124
)
124125

126+
TestRun.LOGGER.print_test_identifier_to_logs()
127+
125128
TestRun.usr = Opencas(
126129
repo_dir=os.path.join(os.path.dirname(__file__), "../../.."),
127130
working_dir=dut_config["working_dir"],

0 commit comments

Comments
 (0)