Rename PartialMock.Start to start().
So that partial mocks can be managed by calling
MockTestCase.StartPatcher().
BUG=None
TEST=unit tests.
Change-Id: I72cfd3033c5da400712465d6b33d9b321b694ca0
Reviewed-on: https://gerrit.chromium.org/gerrit/39685
Reviewed-by: David James <davidjames@chromium.org>
Tested-by: Ryan Cui <rcui@chromium.org>
Commit-Ready: Ryan Cui <rcui@chromium.org>
diff --git a/scripts/cros_generate_sysroot_unittest.py b/scripts/cros_generate_sysroot_unittest.py
index 5d374bf..c8a6d05 100755
--- a/scripts/cros_generate_sysroot_unittest.py
+++ b/scripts/cros_generate_sysroot_unittest.py
@@ -49,24 +49,20 @@
TAR_NAME = 'test.tar.xz'
-class OverallTest(cros_test_lib.TempDirTestCase):
+class OverallTest(cros_test_lib.MockTempDirTestCase):
def setUp(self):
self.cg_mock = CrosGenMock()
- self.cg_mock.Start()
-
- def tearDown(self):
- self.cg_mock.Stop()
- mock.patch.stopall()
+ self.StartPatcher(self.cg_mock)
def testTarballGeneration(self):
"""End-to-end test of tarball generation."""
- mock.patch.object(cros_build_lib, 'IsInsideChroot').start()
- cros_build_lib.IsInsideChroot.returnvalue = True
- cros_gen.main(
- ['--board', BOARD, '--out-dir', self.tempdir,
- '--out-file', TAR_NAME, '--package', constants.CHROME_CP])
- self.cg_mock.VerifyTarball(os.path.join(self.tempdir, TAR_NAME))
+ with mock.patch.object(cros_build_lib, 'IsInsideChroot'):
+ cros_build_lib.IsInsideChroot.returnvalue = True
+ cros_gen.main(
+ ['--board', BOARD, '--out-dir', self.tempdir,
+ '--out-file', TAR_NAME, '--package', constants.CHROME_CP])
+ self.cg_mock.VerifyTarball(os.path.join(self.tempdir, TAR_NAME))
class InterfaceTest(cros_test_lib.TempDirTestCase):