Skip to content

Commit

Permalink
minor fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mhaoli committed Dec 17, 2024
1 parent ce91462 commit c2a8049
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions mobly/suite_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ def suite_end(self):
self._end_time = utils.get_current_epoch_time()

def set_extras(self, extras):
"""Sets extra information. Must be serializable."""
self._extras = extras

def to_dict(self):
Expand Down
13 changes: 12 additions & 1 deletion tests/mobly/suite_runner_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,6 @@ def test_run_suite_class_finds_suite_class_when_not_in_main_module(
):
mock_test_runner = mock_test_runner_class.return_value
mock_test_runner.results.is_all_pass = True
mock_test_runner
tmp_file_path = self._gen_tmp_config_file()
mock_cli_args = ['test_binary', f'--config={tmp_file_path}']

Expand All @@ -281,13 +280,25 @@ def test_run_suite_class_records_suite_info(self, mock_time, _):
)
expected_record.suite_begin()
expected_record.suite_end()
expected_record.set_extras(
{
'extra-key-0': 'extra-value-0',
'extra-key-1': 'extra-value-1',
}
)
expected_summary_entry = expected_record.to_dict()
expected_summary_entry['Type'] = (
suite_runner.TestSummaryEntryType.SUITE_INFO.value
)

class FakeTestSuite(base_suite.BaseSuite):

def get_suite_info(self):
return {
'extra-key-0': 'extra-value-0',
'extra-key-1': 'extra-value-1',
}

def setup_suite(self, config):
super().setup_suite(config)
self.add_test_class(FakeTest1)
Expand Down

0 comments on commit c2a8049

Please sign in to comment.