@@ -319,8 +319,8 @@ def ensure_test_parity(ctx, bep, flavor_name, verbose=False, emit_metrics=False)
319319
320320class BepTestArtifacts (TypedDict ):
321321 cached : bool
322- xml_paths : list [Path ]
323- log_paths : list [Path ]
322+ xml_paths : list [Path ] # noqa: F841 - TypedDict field, not a local variable
323+ log_paths : list [Path ] # noqa: F841 - TypedDict field, not a local variable
324324
325325
326326def _resolve_test_output_path (
@@ -488,8 +488,10 @@ def _collect_test2json(ctx, test_artifacts, output_path):
488488 with tempfile .TemporaryDirectory () as tmpdir :
489489 manifest_path = os .path .join (tmpdir , "manifest.tsv" )
490490 with open (manifest_path , "w" ) as manifest :
491- for entry in sorted (test_artifacts .keys ()):
492- manifest .writelines (f'{ entry } \t { log_path } \n ' for log_path in test_artifacts [entry ]["log_paths" ])
491+ for import_path in sorted (test_artifacts .keys ()):
492+ manifest .writelines (
493+ f'{ import_path } \t { log_path } \n ' for log_path in test_artifacts [import_path ]["log_paths" ]
494+ )
493495
494496 bazel (
495497 ctx ,
@@ -506,23 +508,31 @@ def _collect_test2json(ctx, test_artifacts, output_path):
506508@task (
507509 help = {
508510 "bep_file" : "Path to a Bazel BEP JSON file (--build_event_json_file) used to gather all necessary data." ,
511+ "result_json" : "Path to write test2json JSONL output." ,
512+ "junit_tar" : "Path to write the JUnit tgz." ,
509513 },
510514)
511- def process_test_results (ctx , bep_file , result_json , junit_tar ):
515+ def process_test_results (ctx , bep_file , result_json = "test_output.json" , junit_tar = "" ):
512516 """Collect results from Bazel-run tests and produce various artifacts.
513517
514518 This task:
515519 - Produces a tgz JUnit XML file compatible with our existing upload machinery.
516520 - Produces a test2json file with test results and a UTOF json file created from it.
517521 - Displays test results in a human-friendly way (based on UTOF).
518522 """
519- # BEP is the authoritative source: it lists exactly the test.xml and test.out files
523+ # BEP is the authoritative source: it lists exactly the test.xml and test.log files
520524 # produced by this invocation, avoiding stale results from previous runs
521525 # with a different Bazel configuration.
522526 test_artifacts = _parse_bep (Path (bep_file ))
523527
524- # Produce the junit tar
525- _collect_junit (test_artifacts , junit_tar )
526-
527528 # Produce the test2json result file
528529 _collect_test2json (ctx , test_artifacts , result_json )
530+
531+ # Produce UTOF and associated terminal output
532+ from tasks .libs .testing .utof .go .generate import generate_unified_output
533+
534+ generate_unified_output (ctx , result_json , "bazel" , "" )
535+
536+ # Produce the junit tar
537+ if junit_tar :
538+ _collect_junit (test_artifacts , junit_tar )
0 commit comments