Skip to content

Commit 9d2d09f

Browse files
committed
[None][test] CBTS coverage: load cbts_plugin in inner unittest pytest
test_unittests_v2 spawns the unittest run as an inner pytest. It now adds -p cbts_plugin when CBTS_COVERAGE_CONFIG is set, so in-process unittest coverage is attributed per test instead of landing in the empty context. Signed-off-by: Ivy Zhang <25222398+crazydemo@users.noreply.github.com>
1 parent dd70f53 commit 9d2d09f

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

tests/integration/defs/test_unittests.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# SPDX-FileCopyrightText: Copyright (c) 2022-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
1+
# SPDX-FileCopyrightText: Copyright (c) 2022-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
22
# SPDX-License-Identifier: Apache-2.0
33
#
44
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -147,6 +147,9 @@ def test_unittests_v2(llm_root, llm_venv, case: str, output_dir, request):
147147
"--periodic-batch-size=1",
148148
"--periodic-save-unfinished-test",
149149
]
150+
# Load the CBTS per-test coverage plugin in this inner pytest when CBTS is active.
151+
if os.environ.get("CBTS_COVERAGE_CONFIG"):
152+
command += ["-p", "cbts_plugin"]
150153
if test_prefix:
151154
command += [f"--test-prefix={test_prefix}"]
152155

0 commit comments

Comments
 (0)