Skip to content

Commit

Permalink
Make the summary file path more accessible. (#865)
Browse files Browse the repository at this point in the history
This file is the entry point of all result parsing. We make this path
clear so the upper layer systems don't have to calculate it with
assumptions that may change implicitly.
  • Loading branch information
xpconanfan authored Jan 16, 2023
1 parent 1c44fd9 commit 86688d3
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions mobly/test_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,10 @@ def generate_test_run_log_path(self):
self._logger_start_time)
return self.root_output_path

@property
def summary_file_path(self):
return os.path.join(self.root_output_path, records.OUTPUT_FILE_SUMMARY)

def set_start_point(self):
"""Sets the start point of a test run.
Expand Down Expand Up @@ -401,8 +405,7 @@ def run(self):
utils.create_dir(self._test_run_metadata.root_output_path)

summary_writer = records.TestSummaryWriter(
os.path.join(self._test_run_metadata.root_output_path,
records.OUTPUT_FILE_SUMMARY))
self._test_run_metadata.summary_file_path)

# When a SIGTERM is received during the execution of a test, the Mobly test
# immediately terminates without executing any of the finally blocks. This
Expand Down Expand Up @@ -439,6 +442,7 @@ def sigterm_handler(*args):
f'Summary for test run {self._test_run_metadata.run_id}:',
f'Total time elapsed {self._test_run_metadata.time_elapsed_sec}s',
f'Artifacts are saved in "{self._test_run_metadata.root_output_path}"',
f'Test summary saved in "{self._test_run_metadata.summary_file_path}"',
f'Test results: {self.results.summary_str()}'
]
logging.info('\n'.join(summary_lines))

0 comments on commit 86688d3

Please sign in to comment.