2 # Copyright 2014 The Chromium OS Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
6 """Unit tests for the cros_list_modified_packages program"""
8 from __future__ import print_function
14 sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.dirname(
15 os.path.abspath(__file__)))))
17 from chromite.lib import cros_test_lib
18 from chromite.scripts import cros_list_modified_packages
21 class ListModifiedWorkonPackagesTest(cros_test_lib.MockTestCase):
22 """Test for cros_list_modified_packages.ListModifiedWorkonPackages."""
24 def testListModifiedWorkonPackages(self):
25 """Test that no ebuild breaks cros_list_modified_packages"""
27 # A hook to set the "all_opt" parameter when calling ListWorkonPackages
28 _ListWorkonPackagesPatch = \
29 functools.partial(cros_list_modified_packages.ListWorkonPackages,
32 with self.PatchObject(cros_list_modified_packages, 'ListWorkonPackages',
33 side_effect=_ListWorkonPackagesPatch):
34 # ListModifiedWorkonPackages returns a generator object and doesn't
35 # actually do any work automatically. We have to extract the elements
36 # from it to get it to exercise the code, and we can do that by turning
38 list(cros_list_modified_packages.ListModifiedWorkonPackages(None, True))
41 if __name__ == '__main__':