blob: 9d773c99be18a33ca65ecd9c7bf6d2756bb380ab [file] [log] [blame]
Chris McDonalde69db662018-11-15 12:50:18 -07001# Copyright 2018 The Chromium OS Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5"""Unit tests for cros_run_unit_tests.py."""
6
Hengxiang Hu2e33c712022-01-25 19:11:07 -08007import os
8
Chris McDonalde69db662018-11-15 12:50:18 -07009from chromite.lib import cros_test_lib
10from chromite.scripts import cros_run_unit_tests
11
Mike Frysinger88770ef2021-05-21 11:04:00 -040012
Greg Edelstona4c9b3b2020-01-07 17:51:13 -070013pytestmark = cros_test_lib.pytestmark_inside_only
14
Chris McDonalde69db662018-11-15 12:50:18 -070015
Hengxiang Hu2e33c712022-01-25 19:11:07 -080016class CrosRunUnitTestsTest(cros_test_lib.MockTestCase):
17 """Tests for cros_run_unit_tests functions."""
Chris McDonalde69db662018-11-15 12:50:18 -070018
Chris McDonalde69db662018-11-15 12:50:18 -070019 def testNonEmptyPackageSet(self):
20 """Asserts that the deps of a known package are non-empty"""
Sloan Johnsona85640f2021-10-01 22:32:40 +000021 self.assertTrue(cros_run_unit_tests.determine_packages(
Chris McDonalde69db662018-11-15 12:50:18 -070022 '/', ('virtual/implicit-system',)))
Hengxiang Hu2e33c712022-01-25 19:11:07 -080023
24 def testGetKeepGoing(self):
25 """Tests set keep_going option based on env virables"""
26 self.PatchObject(os, 'environ', new={'USE': 'chrome_internal coverage'})
27 keep_going = cros_run_unit_tests.get_keep_going()
28 self.assertEqual(keep_going, True)