api: controller/sysroot: YAPF
YAPF controller and its tests.
BUG=b:223433932
TEST=None
Change-Id: Ie47436b7ca5ebec5cb52cae2c50ada90035b38c6
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/3791831
Tested-by: Alex Klein <saklein@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Alex Klein <saklein@chromium.org>
diff --git a/api/controller/sysroot_unittest.py b/api/controller/sysroot_unittest.py
index 2bfcdfd..e6e6d0b 100644
--- a/api/controller/sysroot_unittest.py
+++ b/api/controller/sysroot_unittest.py
@@ -26,8 +26,12 @@
class CreateTest(cros_test_lib.MockTestCase, api_config.ApiConfigMixin):
"""Create function tests."""
- def _InputProto(self, build_target=None, profile=None, replace=False,
- current=False, package_indexes=None):
+ def _InputProto(self,
+ build_target=None,
+ profile=None,
+ replace=False,
+ current=False,
+ package_indexes=None):
"""Helper to build and input proto instance."""
proto = sysroot_pb2.SysrootCreateRequest()
if build_target:
@@ -55,8 +59,11 @@
profile = None
force = False
upgrade_chroot = True
- in_proto = self._InputProto(build_target=board, profile=profile,
- replace=force, current=not upgrade_chroot)
+ in_proto = self._InputProto(
+ build_target=board,
+ profile=profile,
+ replace=force,
+ current=not upgrade_chroot)
sysroot_controller.Create(in_proto, self._OutputProto(),
self.validate_only_config)
patch.assert_not_called()
@@ -104,8 +111,8 @@
sysroot_path = '/sysroot/path'
sysroot = sysroot_lib.Sysroot(sysroot_path)
- create_patch = self.PatchObject(sysroot_service, 'Create',
- return_value=sysroot)
+ create_patch = self.PatchObject(
+ sysroot_service, 'Create', return_value=sysroot)
rc_patch = self.PatchObject(sysroot_service, 'SetupBoardRunConfig')
# Default values.
@@ -113,14 +120,17 @@
profile = None
force = False
upgrade_chroot = True
- in_proto = self._InputProto(build_target=board, profile=profile,
- replace=force, current=not upgrade_chroot)
+ in_proto = self._InputProto(
+ build_target=board,
+ profile=profile,
+ replace=force,
+ current=not upgrade_chroot)
out_proto = self._OutputProto()
sysroot_controller.Create(in_proto, out_proto, self.api_config)
# Default value checks.
- rc_patch.assert_called_with(force=force, upgrade_chroot=upgrade_chroot,
- package_indexes=[])
+ rc_patch.assert_called_with(
+ force=force, upgrade_chroot=upgrade_chroot, package_indexes=[])
self.assertEqual(board, out_proto.sysroot.build_target.name)
self.assertEqual(sysroot_path, out_proto.sysroot.path)
@@ -132,26 +142,35 @@
upgrade_chroot = False
package_indexes = [
common_pb2.PackageIndexInfo(
- snapshot_sha='SHA', snapshot_number=5,
+ snapshot_sha='SHA',
+ snapshot_number=5,
build_target=common_pb2.BuildTarget(name=board),
- location='LOCATION', profile=common_pb2.Profile(name=profile)),
+ location='LOCATION',
+ profile=common_pb2.Profile(name=profile)),
common_pb2.PackageIndexInfo(
- snapshot_sha='SHA2', snapshot_number=4,
+ snapshot_sha='SHA2',
+ snapshot_number=4,
build_target=common_pb2.BuildTarget(name=board),
- location='LOCATION2', profile=common_pb2.Profile(name=profile))]
+ location='LOCATION2',
+ profile=common_pb2.Profile(name=profile))
+ ]
- in_proto = self._InputProto(build_target=board, profile=profile,
- replace=force, current=not upgrade_chroot,
- package_indexes=package_indexes)
+ in_proto = self._InputProto(
+ build_target=board,
+ profile=profile,
+ replace=force,
+ current=not upgrade_chroot,
+ package_indexes=package_indexes)
out_proto = self._OutputProto()
sysroot_controller.Create(in_proto, out_proto, self.api_config)
# Not default value checks.
rc_patch.assert_called_with(
- force=force, package_indexes=[
- binpkg.PackageIndexInfo.from_protobuf(x)
- for x in package_indexes
- ], upgrade_chroot=upgrade_chroot)
+ force=force,
+ package_indexes=[
+ binpkg.PackageIndexInfo.from_protobuf(x) for x in package_indexes
+ ],
+ upgrade_chroot=upgrade_chroot)
self.assertEqual(board, out_proto.sysroot.build_target.name)
self.assertEqual(sysroot_path, out_proto.sysroot.path)
@@ -173,8 +192,7 @@
for pkg in pkg_list:
pkg_string_parts = pkg.split('/')
package_info_msg = common_pb2.PackageInfo(
- category=pkg_string_parts[0],
- package_name=pkg_string_parts[1])
+ category=pkg_string_parts[0], package_name=pkg_string_parts[1])
package_list.append(package_info_msg)
else:
package_list = []
@@ -192,9 +210,10 @@
"""Sanity check that a validate only call does not execute any logic."""
patch = self.PatchObject(sysroot_service, 'GenerateArchive')
- in_proto = self._InputProto(build_target=self.board,
- chroot_path=self.chroot_path,
- pkg_list=['virtual/target-fuzzers'])
+ in_proto = self._InputProto(
+ build_target=self.board,
+ chroot_path=self.chroot_path,
+ pkg_list=['virtual/target-fuzzers'])
sysroot_controller.GenerateArchive(in_proto, self._OutputProto(),
self.validate_only_config)
patch.assert_not_called()
@@ -203,11 +222,11 @@
"""Sanity check that a mock call does not execute any logic."""
patch = self.PatchObject(sysroot_service, 'GenerateArchive')
- in_proto = self._InputProto(build_target=self.board,
- chroot_path=self.chroot_path,
- pkg_list=['virtual/target-fuzzers'])
- sysroot_controller.GenerateArchive(in_proto,
- self._OutputProto(),
+ in_proto = self._InputProto(
+ build_target=self.board,
+ chroot_path=self.chroot_path,
+ pkg_list=['virtual/target-fuzzers'])
+ sysroot_controller.GenerateArchive(in_proto, self._OutputProto(),
self.mock_call_config)
patch.assert_not_called()
@@ -220,17 +239,20 @@
sysroot_controller.GenerateArchive(in_proto, out_proto, self.api_config)
# Error when packages is not specified.
- in_proto = self._InputProto(build_target='board',
- chroot_path=self.chroot_path)
+ in_proto = self._InputProto(
+ build_target='board', chroot_path=self.chroot_path)
with self.assertRaises(cros_build_lib.DieSystemExit):
sysroot_controller.GenerateArchive(in_proto, out_proto, self.api_config)
# Valid when board, chroot path, and package are specified.
- patch = self.PatchObject(sysroot_service, 'GenerateArchive',
- return_value='/path/to/sysroot/tar.bz')
- in_proto = self._InputProto(build_target='board',
- chroot_path=self.chroot_path,
- pkg_list=['virtual/target-fuzzers'])
+ patch = self.PatchObject(
+ sysroot_service,
+ 'GenerateArchive',
+ return_value='/path/to/sysroot/tar.bz')
+ in_proto = self._InputProto(
+ build_target='board',
+ chroot_path=self.chroot_path,
+ pkg_list=['virtual/target-fuzzers'])
out_proto = self._OutputProto()
sysroot_controller.GenerateArchive(in_proto, out_proto, self.api_config)
patch.assert_called_once()
@@ -255,7 +277,9 @@
sysroot_lib.Sysroot, 'portage_logdir', new=self.portage_dir)
osutils.SafeMakedirs(self.portage_dir)
- def _InputProto(self, build_target=None, sysroot_path=None,
+ def _InputProto(self,
+ build_target=None,
+ sysroot_path=None,
compile_source=False):
"""Helper to build an input proto instance."""
proto = sysroot_pb2.InstallToolchainRequest()
@@ -285,17 +309,17 @@
path = os.path.join(log_path,
f'{pkg_info.category}:{pkg_info.pvr}:' \
f'{timestamp.strftime("%Y%m%d-%H%M%S")}.log')
- osutils.WriteFile(path,
- f'Test log file for package {pkg_info.category}/'
- f'{pkg_info.package} written to {path}')
+ osutils.WriteFile(
+ path, f'Test log file for package {pkg_info.category}/'
+ f'{pkg_info.package} written to {path}')
return path
def testValidateOnly(self):
"""Sanity check that a validate only call does not execute any logic."""
patch = self.PatchObject(sysroot_service, 'InstallToolchain')
- in_proto = self._InputProto(build_target=self.board,
- sysroot_path=self.sysroot)
+ in_proto = self._InputProto(
+ build_target=self.board, sysroot_path=self.sysroot)
sysroot_controller.InstallToolchain(in_proto, self._OutputProto(),
self.validate_only_config)
patch.assert_not_called()
@@ -345,8 +369,8 @@
sysroot_controller.InstallToolchain(in_proto, out_proto, self.api_config)
# Both provided, but invalid sysroot path.
- in_proto = self._InputProto(build_target=self.board,
- sysroot_path=self.invalid_sysroot)
+ in_proto = self._InputProto(
+ build_target=self.board, sysroot_path=self.invalid_sysroot)
with self.assertRaises(cros_build_lib.DieSystemExit):
sysroot_controller.InstallToolchain(in_proto, out_proto, self.api_config)
@@ -354,20 +378,19 @@
"""Test the output is processed and recorded correctly."""
self.PatchObject(sysroot_service, 'InstallToolchain')
out_proto = self._OutputProto()
- in_proto = self._InputProto(build_target=self.board,
- sysroot_path=self.sysroot)
+ in_proto = self._InputProto(
+ build_target=self.board, sysroot_path=self.sysroot)
rc = sysroot_controller.InstallToolchain(in_proto, out_proto,
self.api_config)
self.assertFalse(rc)
self.assertFalse(out_proto.failed_package_data)
-
def testErrorOutputHandling(self):
"""Test the error output is processed and recorded correctly."""
out_proto = self._OutputProto()
- in_proto = self._InputProto(build_target=self.board,
- sysroot_path=self.sysroot)
+ in_proto = self._InputProto(
+ build_target=self.board, sysroot_path=self.sysroot)
err_pkgs = ['cat/pkg-1.0-r1', 'cat2/pkg2-1.0-r1']
err_cpvs = [package_info.parse(pkg) for pkg in err_pkgs]
@@ -377,14 +400,12 @@
for i, pkg in enumerate(err_pkgs):
self._CreatePortageLogFile(self.portage_dir, err_cpvs[i],
datetime.datetime(2021, 6, 9, 13, 37, 0))
- new_logs[pkg] = self._CreatePortageLogFile(self.portage_dir, err_cpvs[i],
- datetime.datetime(2021, 6, 9,
- 16, 20, 0)
- )
+ new_logs[pkg] = self._CreatePortageLogFile(
+ self.portage_dir, err_cpvs[i],
+ datetime.datetime(2021, 6, 9, 16, 20, 0))
- err = sysroot_lib.ToolchainInstallError('Error',
- cros_build_lib.CommandResult(),
- tc_info=err_cpvs)
+ err = sysroot_lib.ToolchainInstallError(
+ 'Error', cros_build_lib.CommandResult(), tc_info=err_cpvs)
self.PatchObject(sysroot_service, 'InstallToolchain', side_effect=err)
rc = sysroot_controller.InstallToolchain(in_proto, out_proto,
@@ -424,10 +445,16 @@
osutils.SafeMakedirs(self.goma_out_dir)
os.environ['GLOG_log_dir'] = self.goma_dir
- def _InputProto(self, build_target=None, sysroot_path=None,
- build_source=False, goma_dir=None, goma_log_dir=None,
- goma_stats_file=None, goma_counterz_file=None,
- package_indexes=None, packages=None):
+ def _InputProto(self,
+ build_target=None,
+ sysroot_path=None,
+ build_source=False,
+ goma_dir=None,
+ goma_log_dir=None,
+ goma_stats_file=None,
+ goma_counterz_file=None,
+ package_indexes=None,
+ packages=None):
"""Helper to build an input proto instance."""
instance = sysroot_pb2.InstallPackagesRequest()
@@ -471,8 +498,7 @@
goma_log_dir,
'%s.host.log.INFO.%s' % (name, timestamp.strftime('%Y%m%d-%H%M%S.%f')))
osutils.WriteFile(
- path,
- timestamp.strftime('Goma log file created at: %Y/%m/%d %H:%M:%S'))
+ path, timestamp.strftime('Goma log file created at: %Y/%m/%d %H:%M:%S'))
def _CreatePortageLogFile(self, log_path: Union[str, os.PathLike],
pkg_info: package_info.PackageInfo,
@@ -487,16 +513,17 @@
path = os.path.join(log_path,
f'{pkg_info.category}:{pkg_info.pvr}:' \
f'{timestamp.strftime("%Y%m%d-%H%M%S")}.log')
- osutils.WriteFile(path, f'Test log file for package {pkg_info.category}/'
- f'{pkg_info.package} written to {path}')
+ osutils.WriteFile(
+ path, f'Test log file for package {pkg_info.category}/'
+ f'{pkg_info.package} written to {path}')
return path
def testValidateOnly(self):
"""Sanity check that a validate only call does not execute any logic."""
patch = self.PatchObject(sysroot_service, 'BuildPackages')
- in_proto = self._InputProto(build_target=self.build_target,
- sysroot_path=self.sysroot)
+ in_proto = self._InputProto(
+ build_target=self.build_target, sysroot_path=self.sysroot)
sysroot_controller.InstallPackages(in_proto, self._OutputProto(),
self.validate_only_config)
patch.assert_not_called()
@@ -550,29 +577,30 @@
def testArgumentValidationInvalidSysroot(self):
"""Test sysroot that hasn't had the toolchain installed."""
out_proto = self._OutputProto()
- in_proto = self._InputProto(build_target=self.build_target,
- sysroot_path=self.sysroot)
- self.PatchObject(sysroot_lib.Sysroot, 'IsToolchainInstalled',
- return_value=False)
+ in_proto = self._InputProto(
+ build_target=self.build_target, sysroot_path=self.sysroot)
+ self.PatchObject(
+ sysroot_lib.Sysroot, 'IsToolchainInstalled', return_value=False)
with self.assertRaises(cros_build_lib.DieSystemExit):
sysroot_controller.InstallPackages(in_proto, out_proto, self.api_config)
def testArgumentValidationInvalidPackage(self):
out_proto = self._OutputProto()
- in_proto = self._InputProto(build_target=self.build_target,
- sysroot_path=self.sysroot,
- packages=['package-1.0.0-r2'])
+ in_proto = self._InputProto(
+ build_target=self.build_target,
+ sysroot_path=self.sysroot,
+ packages=['package-1.0.0-r2'])
with self.assertRaises(cros_build_lib.DieSystemExit):
sysroot_controller.InstallPackages(in_proto, out_proto, self.api_config)
def testSuccessOutputHandling(self):
"""Test successful call output handling."""
# Prevent argument validation error.
- self.PatchObject(sysroot_lib.Sysroot, 'IsToolchainInstalled',
- return_value=True)
+ self.PatchObject(
+ sysroot_lib.Sysroot, 'IsToolchainInstalled', return_value=True)
- in_proto = self._InputProto(build_target=self.build_target,
- sysroot_path=self.sysroot)
+ in_proto = self._InputProto(
+ build_target=self.build_target, sysroot_path=self.sysroot)
out_proto = self._OutputProto()
self.PatchObject(sysroot_service, 'BuildPackages')
@@ -584,21 +612,27 @@
def testSuccessPackageIndexes(self):
"""Test successful call with package_indexes."""
# Prevent argument validation error.
- self.PatchObject(sysroot_lib.Sysroot, 'IsToolchainInstalled',
- return_value=True)
+ self.PatchObject(
+ sysroot_lib.Sysroot, 'IsToolchainInstalled', return_value=True)
package_indexes = [
common_pb2.PackageIndexInfo(
- snapshot_sha='SHA', snapshot_number=5,
+ snapshot_sha='SHA',
+ snapshot_number=5,
build_target=common_pb2.BuildTarget(name='board'),
- location='LOCATION', profile=common_pb2.Profile(name='profile')),
+ location='LOCATION',
+ profile=common_pb2.Profile(name='profile')),
common_pb2.PackageIndexInfo(
- snapshot_sha='SHA2', snapshot_number=4,
+ snapshot_sha='SHA2',
+ snapshot_number=4,
build_target=common_pb2.BuildTarget(name='board'),
- location='LOCATION2', profile=common_pb2.Profile(name='profile'))]
+ location='LOCATION2',
+ profile=common_pb2.Profile(name='profile'))
+ ]
- in_proto = self._InputProto(build_target=self.build_target,
- sysroot_path=self.sysroot,
- package_indexes=package_indexes)
+ in_proto = self._InputProto(
+ build_target=self.build_target,
+ sysroot_path=self.sysroot,
+ package_indexes=package_indexes)
out_proto = self._OutputProto()
rc_patch = self.PatchObject(sysroot_service, 'BuildPackagesRunConfig')
@@ -631,13 +665,14 @@
datetime.datetime(2018, 9, 21, 12, 2, 0))
# Prevent argument validation error.
- self.PatchObject(sysroot_lib.Sysroot, 'IsToolchainInstalled',
- return_value=True)
+ self.PatchObject(
+ sysroot_lib.Sysroot, 'IsToolchainInstalled', return_value=True)
- in_proto = self._InputProto(build_target=self.build_target,
- sysroot_path=self.sysroot,
- goma_dir=self.goma_dir,
- goma_log_dir=self.goma_out_dir)
+ in_proto = self._InputProto(
+ build_target=self.build_target,
+ sysroot_path=self.sysroot,
+ goma_dir=self.goma_dir,
+ goma_log_dir=self.goma_out_dir)
out_proto = self._OutputProto()
self.PatchObject(sysroot_service, 'BuildPackages')
@@ -649,7 +684,8 @@
self.assertCountEqual(out_proto.goma_artifacts.log_files, [
'compiler_proxy-subproc.host.log.INFO.20180921-120100.000000.gz',
'compiler_proxy.host.log.INFO.20180921-120000.000000.gz',
- 'gomacc.host.log.INFO.20180921-120200.000000.tar.gz'])
+ 'gomacc.host.log.INFO.20180921-120200.000000.tar.gz'
+ ])
def testSuccessWithGomaLogsAndStatsCounterzFiles(self):
"""Test successful call with goma including stats and counterz files."""
@@ -660,21 +696,24 @@
self._CreateGomaLogFile(self.goma_dir, 'gomacc',
datetime.datetime(2018, 9, 21, 12, 2, 0))
# Create stats and counterz files.
- osutils.WriteFile(os.path.join(self.goma_dir, 'stats.binaryproto'),
- 'File: stats.binaryproto')
- osutils.WriteFile(os.path.join(self.goma_dir, 'counterz.binaryproto'),
- 'File: counterz.binaryproto')
+ osutils.WriteFile(
+ os.path.join(self.goma_dir, 'stats.binaryproto'),
+ 'File: stats.binaryproto')
+ osutils.WriteFile(
+ os.path.join(self.goma_dir, 'counterz.binaryproto'),
+ 'File: counterz.binaryproto')
# Prevent argument validation error.
- self.PatchObject(sysroot_lib.Sysroot, 'IsToolchainInstalled',
- return_value=True)
+ self.PatchObject(
+ sysroot_lib.Sysroot, 'IsToolchainInstalled', return_value=True)
- in_proto = self._InputProto(build_target=self.build_target,
- sysroot_path=self.sysroot,
- goma_dir=self.goma_dir,
- goma_log_dir=self.goma_out_dir,
- goma_stats_file='stats.binaryproto',
- goma_counterz_file='counterz.binaryproto')
+ in_proto = self._InputProto(
+ build_target=self.build_target,
+ sysroot_path=self.sysroot,
+ goma_dir=self.goma_dir,
+ goma_log_dir=self.goma_out_dir,
+ goma_stats_file='stats.binaryproto',
+ goma_counterz_file='counterz.binaryproto')
out_proto = self._OutputProto()
self.PatchObject(sysroot_service, 'BuildPackages')
@@ -686,20 +725,20 @@
self.assertCountEqual(out_proto.goma_artifacts.log_files, [
'compiler_proxy-subproc.host.log.INFO.20180921-120100.000000.gz',
'compiler_proxy.host.log.INFO.20180921-120000.000000.gz',
- 'gomacc.host.log.INFO.20180921-120200.000000.tar.gz'])
+ 'gomacc.host.log.INFO.20180921-120200.000000.tar.gz'
+ ])
# Verify that the output dir has 5 files -- since there should be 3 log
# files, the stats file, and the counterz file.
output_files = os.listdir(self.goma_out_dir)
self.assertCountEqual(output_files, [
- 'stats.binaryproto',
- 'counterz.binaryproto',
+ 'stats.binaryproto', 'counterz.binaryproto',
'compiler_proxy-subproc.host.log.INFO.20180921-120100.000000.gz',
'compiler_proxy.host.log.INFO.20180921-120000.000000.gz',
- 'gomacc.host.log.INFO.20180921-120200.000000.tar.gz'])
+ 'gomacc.host.log.INFO.20180921-120200.000000.tar.gz'
+ ])
self.assertEqual(out_proto.goma_artifacts.counterz_file,
'counterz.binaryproto')
- self.assertEqual(out_proto.goma_artifacts.stats_file,
- 'stats.binaryproto')
+ self.assertEqual(out_proto.goma_artifacts.stats_file, 'stats.binaryproto')
def testFailureMissingGomaStatsCounterzFiles(self):
"""Test successful call with goma including stats and counterz files."""
@@ -713,15 +752,16 @@
# the proto below.
# Prevent argument validation error.
- self.PatchObject(sysroot_lib.Sysroot, 'IsToolchainInstalled',
- return_value=True)
+ self.PatchObject(
+ sysroot_lib.Sysroot, 'IsToolchainInstalled', return_value=True)
- in_proto = self._InputProto(build_target=self.build_target,
- sysroot_path=self.sysroot,
- goma_dir=self.goma_dir,
- goma_log_dir=self.goma_out_dir,
- goma_stats_file='stats.binaryproto',
- goma_counterz_file='counterz.binaryproto')
+ in_proto = self._InputProto(
+ build_target=self.build_target,
+ sysroot_path=self.sysroot,
+ goma_dir=self.goma_dir,
+ goma_log_dir=self.goma_out_dir,
+ goma_stats_file='stats.binaryproto',
+ goma_counterz_file='counterz.binaryproto')
out_proto = self._OutputProto()
self.PatchObject(sysroot_service, 'BuildPackages')
@@ -733,18 +773,19 @@
self.assertCountEqual(out_proto.goma_artifacts.log_files, [
'compiler_proxy-subproc.host.log.INFO.20180921-120100.000000.gz',
'compiler_proxy.host.log.INFO.20180921-120000.000000.gz',
- 'gomacc.host.log.INFO.20180921-120200.000000.tar.gz'])
+ 'gomacc.host.log.INFO.20180921-120200.000000.tar.gz'
+ ])
self.assertFalse(out_proto.goma_artifacts.counterz_file)
self.assertFalse(out_proto.goma_artifacts.stats_file)
def testFailureOutputHandling(self):
"""Test failed package handling."""
# Prevent argument validation error.
- self.PatchObject(sysroot_lib.Sysroot, 'IsToolchainInstalled',
- return_value=True)
+ self.PatchObject(
+ sysroot_lib.Sysroot, 'IsToolchainInstalled', return_value=True)
- in_proto = self._InputProto(build_target=self.build_target,
- sysroot_path=self.sysroot)
+ in_proto = self._InputProto(
+ build_target=self.build_target, sysroot_path=self.sysroot)
out_proto = self._OutputProto()
# Failed package info and expected list for verification.
@@ -756,14 +797,12 @@
for i, pkg in enumerate(err_pkgs):
self._CreatePortageLogFile(self.portage_dir, err_cpvs[i],
datetime.datetime(2021, 6, 9, 13, 37, 0))
- new_logs[pkg] = self._CreatePortageLogFile(self.portage_dir, err_cpvs[i],
- datetime.datetime(2021, 6, 9,
- 16, 20, 0)
- )
+ new_logs[pkg] = self._CreatePortageLogFile(
+ self.portage_dir, err_cpvs[i],
+ datetime.datetime(2021, 6, 9, 16, 20, 0))
# Force error to be raised with the packages.
- error = sysroot_lib.PackageInstallError('Error',
- cros_build_lib.CommandResult(),
- packages=err_cpvs)
+ error = sysroot_lib.PackageInstallError(
+ 'Error', cros_build_lib.CommandResult(), packages=err_cpvs)
self.PatchObject(sysroot_service, 'BuildPackages', side_effect=error)
rc = sysroot_controller.InstallPackages(in_proto, out_proto,
@@ -779,17 +818,16 @@
def testNoPackageFailureOutputHandling(self):
"""Test failure handling without packages to report."""
# Prevent argument validation error.
- self.PatchObject(sysroot_lib.Sysroot, 'IsToolchainInstalled',
- return_value=True)
+ self.PatchObject(
+ sysroot_lib.Sysroot, 'IsToolchainInstalled', return_value=True)
- in_proto = self._InputProto(build_target=self.build_target,
- sysroot_path=self.sysroot)
+ in_proto = self._InputProto(
+ build_target=self.build_target, sysroot_path=self.sysroot)
out_proto = self._OutputProto()
# Force error to be raised with no packages.
- error = sysroot_lib.PackageInstallError('Error',
- cros_build_lib.CommandResult(),
- packages=[])
+ error = sysroot_lib.PackageInstallError(
+ 'Error', cros_build_lib.CommandResult(), packages=[])
self.PatchObject(sysroot_service, 'BuildPackages', side_effect=error)
rc = sysroot_controller.InstallPackages(in_proto, out_proto,