Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mobly/test_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def main(argv=None):
runner.run()
ok = runner.results.is_all_pass and ok
except signals.TestAbortAll:
pass
ok = False
except Exception:
logging.exception('Exception when executing %s.', config.testbed_name)
ok = False
Expand Down
19 changes: 19 additions & 0 deletions tests/mobly/test_runner_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,25 @@ def test_main_parse_args(self, mock_test_runner, mock_config, mock_find_test):
test_runner.main(['-c', 'some/path/foo.yaml', '-b', 'hello'])
mock_config.assert_called_with('some/path/foo.yaml', None)

@mock.patch(
'mobly.test_runner._find_test_class',
return_value=type('SampleTest', (), {}),
)
@mock.patch(
'mobly.test_runner.config_parser.load_test_config_file',
return_value=[config_parser.TestRunConfig()],
)
@mock.patch('mobly.test_runner.TestRunner')
@mock.patch('sys.exit')
def test_main_with_abort_all(
self, mock_exit, mock_test_runner_class, mock_config, mock_find_test
):
mock_runner = mock.MagicMock()
mock_runner.run.side_effect = signals.TestAbortAll('Aborting all tests.')
mock_test_runner_class.return_value = mock_runner
test_runner.main(['-c', 'some/path/foo.yaml'])
mock_exit.assert_called_once_with(1)

@mock.patch(
'mobly.test_runner._find_test_class',
return_value=integration_test.IntegrationTest,
Expand Down
Loading