Snap for 15110852 from 4af36d6528a63800efc190d0c6e8c153a438383b to 26Q2-release Change-Id: I9a878e53c8ea06b1af09e28e103b149a40ddd90b
diff --git a/atest/test_runner_handler_unittest.py b/atest/test_runner_handler_unittest.py index 4e58c71..81e3805 100755 --- a/atest/test_runner_handler_unittest.py +++ b/atest/test_runner_handler_unittest.py
@@ -86,10 +86,11 @@ } def setUp(self): - mock.patch( + self.mock_get_test_runners = mock.patch( 'atest.test_runner_handler._get_test_runners', - return_value=self._TEST_RUNNERS, - ).start() + return_value=dict(self._TEST_RUNNERS), + ) + self.mock_get_test_runners.start() def tearDown(self): mock.patch.stopall() @@ -118,6 +119,36 @@ [BAD_TESTINFO], ) + def test_group_tests_by_test_runners_empty(self): + """Test group_tests_by_test_runners with empty input.""" + self.assertEqual([], test_runner_handler.group_tests_by_test_runners([])) + + def test_create_test_runner_invocations(self): + """Test create_test_runner_invocations correctly creates invocations.""" + test_infos = [MODULE_INFO_A] + results_dir = '/tmp/results' + mod_info = mock.MagicMock() + extra_args = {'key': 'value'} + + with mock.patch.object( + FakeTestRunnerA, 'create_invocations' + ) as mock_create_inv: + mock_invocation = mock.MagicMock() + mock_create_inv.return_value = [mock_invocation] + + invocations = test_runner_handler.create_test_runner_invocations( + test_infos=test_infos, + results_dir=results_dir, + mod_info=mod_info, + extra_args=extra_args, + minimal_build=True, + ) + + self.assertEqual([mock_invocation], invocations) + mock_create_inv.assert_called_once_with( + extra_args=extra_args, test_infos=[MODULE_INFO_A] + ) + def test_get_test_runner_reqs(self): """Test that we get all the reqs from the test runners.""" test_infos = [MODULE_INFO_A, MODULE_INFO_B]