Skip to content

Commit 28e9bf6

Browse files
authored
[None][chore] add periodic junit xml path in conftest (#9337)
Signed-off-by: Ivy Zhang <[email protected]>
1 parent cc0dc7c commit 28e9bf6

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

tests/integration/defs/conftest.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2131,6 +2131,13 @@ def pytest_addoption(parser):
21312131
"Number of completed tests before triggering a periodic save (default: 10). "
21322132
"Only used with --periodic-junit.",
21332133
)
2134+
parser.addoption(
2135+
"--periodic-junit-xmlpath",
2136+
action="store",
2137+
default=None,
2138+
help="Path to the output XML file for periodic JUnit XML reporter. "
2139+
"Only used with --periodic-junit.",
2140+
)
21342141

21352142

21362143
@pytest.hookimpl(trylast=True)
@@ -2235,7 +2242,8 @@ def pytest_configure(config):
22352242
# Initialize PeriodicJUnitXML reporter if enabled
22362243
periodic = config.getoption("--periodic-junit", default=False)
22372244
output_dir = config.getoption("--output-dir", default=None)
2238-
2245+
periodic_junit_xmlpath = config.getoption("--periodic-junit-xmlpath",
2246+
default=None)
22392247
if periodic and output_dir:
22402248
periodic_interval = config.getoption("--periodic-interval")
22412249
periodic_batch_size = config.getoption("--periodic-batch-size")
@@ -2245,7 +2253,8 @@ def pytest_configure(config):
22452253
os.makedirs(output_dir, exist_ok=True)
22462254

22472255
# Create the reporter with logger
2248-
xmlpath = os.path.join(output_dir, "results.xml")
2256+
xmlpath = periodic_junit_xmlpath or os.path.join(
2257+
output_dir, "results.xml")
22492258
reporter = PeriodicJUnitXML(
22502259
xmlpath=xmlpath,
22512260
interval=periodic_interval,

0 commit comments

Comments
 (0)