Skip to content

Commit 3c47e99

Browse files
crazydemomikeiovine
authored andcommitted
[TRTLLM-8580][test] save runtime report periodically (#8312) (#8455)
Signed-off-by: Ivy Zhang <25222398+crazydemo@users.noreply.github.com>
1 parent 1c5517f commit 3c47e99

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
@@ -2313,6 +2313,40 @@ def deselect_by_test_model_suites(test_model_suites, items, test_prefix,
23132313
config.hook.pytest_deselected(items=deselected)
23142314
items[:] = selected
23152315

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

23172351
def deselect_by_test_model_suites(test_model_suites, items, test_prefix,
23182352
config):

0 commit comments

Comments
 (0)