Skip to content

Commit 23717cd

Browse files
crazydemochzblych
authored andcommitted
[TRTLLM-8580][test] save runtime report periodically (#8312) (#8455)
Signed-off-by: Ivy Zhang <[email protected]> Signed-off-by: Mike Iovine <[email protected]>
1 parent 2b58dba commit 23717cd

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

tests/integration/defs/conftest.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2317,6 +2317,40 @@ def deselect_by_test_model_suites(test_model_suites, items, test_prefix,
23172317
config.hook.pytest_deselected(items=deselected)
23182318
items[:] = selected
23192319

2320+
# Initialize PeriodicJUnitXML reporter if enabled
2321+
periodic = config.getoption("--periodic-junit", default=False)
2322+
output_dir = config.getoption("--output-dir", default=None)
2323+
2324+
if periodic and output_dir:
2325+
periodic_interval = config.getoption("--periodic-interval")
2326+
periodic_batch_size = config.getoption("--periodic-batch-size")
2327+
2328+
# Create the reporter with logger
2329+
xmlpath = os.path.join(output_dir, "results.xml")
2330+
reporter = PeriodicJUnitXML(
2331+
xmlpath=xmlpath,
2332+
interval=periodic_interval,
2333+
batch_size=periodic_batch_size,
2334+
logger={
2335+
'info': print_info,
2336+
'warning': print_warning
2337+
},
2338+
)
2339+
2340+
# Configure and register the reporter
2341+
reporter.pytest_configure(config)
2342+
config.pluginmanager.register(reporter, 'periodic_junit')
2343+
2344+
print_info("PeriodicJUnitXML reporter registered")
2345+
print_info(
2346+
f" Interval: {periodic_interval}s ({periodic_interval/60:.1f} min)"
2347+
)
2348+
print_info(f" Batch size: {periodic_batch_size} tests")
2349+
elif periodic and not output_dir:
2350+
print_warning(
2351+
"Warning: --periodic-junit requires --output-dir to be set. "
2352+
"Periodic reporting disabled.")
2353+
23202354

23212355
def deselect_by_test_model_suites(test_model_suites, items, test_prefix,
23222356
config):

0 commit comments

Comments
 (0)