blob: 630dfea0afc5a6ed89f985f31d213d976005244e [file] [log] [blame]
Mike Frysingerf1ba7ad2022-09-12 05:42:57 -04001# Copyright 2018 The ChromiumOS Authors
Chris McDonalde69db662018-11-15 12:50:18 -07002# 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):
Alex Klein1699fab2022-09-08 08:46:06 -060017 """Tests for cros_run_unit_tests functions."""
Chris McDonalde69db662018-11-15 12:50:18 -070018
Alex Klein1699fab2022-09-08 08:46:06 -060019 def testNonEmptyPackageSet(self):
20 """Asserts that the deps of a known package are non-empty"""
21 self.assertTrue(
22 cros_run_unit_tests.determine_packages(
23 "/", ("virtual/implicit-system",)
24 )
25 )
Hengxiang Hu2e33c712022-01-25 19:11:07 -080026
Alex Klein1699fab2022-09-08 08:46:06 -060027 def testGetKeepGoing(self):
28 """Tests set keep_going option based on env virables"""
29 self.PatchObject(os, "environ", new={"USE": "chrome_internal coverage"})
30 keep_going = cros_run_unit_tests.get_keep_going()
31 self.assertEqual(keep_going, True)