class_docstr: A wrapper for running tests in ray ci docker container
class_docstr_tok: ["A","wrapper","for","running","tests","in","ray","ci","docker","container"]
code: def _get_test_and_results(
      self, team, bazel_log_dir: str
  ) -> List[Tuple[Test, TestResult]]:
      bazel_logs = []
      # Find all bazel logs
      for file in listdir(bazel_log_dir):
          log = path.join(bazel_log_dir, file)
          if path.isfile(log) and file.startswith("bazel_log"):
              bazel_logs.append(log)
  
      tests = {}
      # Parse bazel logs and print test results
      for file in bazel_logs:
          with open(file, "rb") as f:
              for line in f:
                  event = json.loads(line.decode("utf-8"))
                  if "testResult" not in event:
                      continue
                  test = Test.from_bazel_event(event, team)
                  test_result = TestResult.from_bazel_event(event)
                  # Obtain only the final test result for a given test in case
                  # the test is retried.
                  tests[test.get_name()] = (test, test_result)
  
      return list(tests.values())
  
imports: import json
  import os
  import platform
  import random
  import shutil
  import string
  import subprocess
  from typing import List, Tuple, Optional
  from os import path, listdir
  from ci.ray_ci.utils import shard_tests, chunk_into_n
  from ci.ray_ci.utils import logger
  from ci.ray_ci.container import Container
  from ray_release.test import TestResult, Test
label_desc: Use image node_id 7 for calling the TesterContainer obj's underlying member method code with example usage: obj._get_test_and_results(team, bazel_log_dir) and returns: list