cros_test_lib: turn self.tempdir into a Path object

Path objects are easier to work with than plain strings, so convert
self.tempdir into it.  This allows us to cleanup some tests that were
already converting self.tempdir to a Path.

For tests that use protobufs, we often have to coerce the path back
into a string because the bindings don't understand Path types.

For some APIs we keep coercing Paths to strings.  Hopefully by moving
self.tempdir to Path, we can encourage more natural conversion of code
to pathlib, and to have new code use pathlib from the start.

BUG=None
TEST=unittests pass

Change-Id: I6afb531489332dc0599c6b4a41307f258debfdfc
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/3612622
Auto-Submit: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Ram Chandrasekar <rchandrasekar@google.com>
Commit-Queue: Ram Chandrasekar <rchandrasekar@google.com>
Tested-by: Mike Frysinger <vapier@chromium.org>
diff --git a/scripts/cros_generate_sysroot_unittest.py b/scripts/cros_generate_sysroot_unittest.py
index 7e04547..04dd53c 100644
--- a/scripts/cros_generate_sysroot_unittest.py
+++ b/scripts/cros_generate_sysroot_unittest.py
@@ -61,7 +61,7 @@
     with mock.patch.object(cros_build_lib, 'IsInsideChroot'):
       cros_build_lib.IsInsideChroot.returnvalue = True
       cros_gen.main(
-          ['--board', BOARD, '--out-dir', self.tempdir,
+          ['--board', BOARD, '--out-dir', str(self.tempdir),
            '--out-file', TAR_NAME, '--package', constants.CHROME_CP])
       self.cg_mock.VerifyTarball(os.path.join(self.tempdir, TAR_NAME))
 
@@ -73,7 +73,7 @@
 
   def _Parse(self, extra_args):
     return cros_gen.ParseCommandLine(
-        ['--board', BOARD, '--out-dir', self.tempdir,
+        ['--board', BOARD, '--out-dir', str(self.tempdir),
          '--package', constants.CHROME_CP] + extra_args)
 
   def testDefaultTargetName(self):
@@ -86,7 +86,7 @@
     """Test getting the right target name with multiple pkgs."""
     pkgs = '%s virtual/target-os' % constants.CHROME_CP
     options = cros_gen.ParseCommandLine(
-        ['--board', BOARD, '--out-dir', self.tempdir,
+        ['--board', BOARD, '--out-dir', str(self.tempdir),
          '--package', pkgs])
 
     self.assertEqual(