コード例 #1
0
    def test_run_isolated_by_test(self, mock_tests):
        mock_tests.return_value = [
            'suite.test1', 'suite.test2', 'suite2.test1'
        ]
        kunit.main(['exec', '--run_isolated=test', 'suite*'],
                   self.linux_source_mock)

        # Should respect the user's filter glob when listing tests.
        mock_tests.assert_called_once_with(
            mock.ANY,
            kunit.KunitExecRequest(None, None, '.kunit', 300, False, 'suite*',
                                   None, 'test'))
        self.linux_source_mock.run_kernel.assert_has_calls([
            mock.call(args=None,
                      build_dir='.kunit',
                      filter_glob='suite.test1',
                      timeout=300),
            mock.call(args=None,
                      build_dir='.kunit',
                      filter_glob='suite.test2',
                      timeout=300),
            mock.call(args=None,
                      build_dir='.kunit',
                      filter_glob='suite2.test1',
                      timeout=300),
        ])
コード例 #2
0
	def test_list_tests(self):
		want = ['suite.test1', 'suite.test2', 'suite2.test1']
		self.linux_source_mock.run_kernel.return_value = ['TAP version 14', 'init: random output'] + want

		got = kunit._list_tests(self.linux_source_mock,
				     kunit.KunitExecRequest(300, '.kunit', False, 'suite*', None, 'suite'))

		self.assertEqual(got, want)
		# Should respect the user's filter glob when listing tests.
		self.linux_source_mock.run_kernel.assert_called_once_with(
			args=['kunit.action=list'], build_dir='.kunit', filter_glob='suite*', timeout=300)