Esempio n. 1
0
 def test_merge_relative_paths(self):
     self.assertEqual(
         file_utils.merge_relative_path("gs://module-cache", ""),
         "gs://module-cache")
     self.assertEqual(
         file_utils.merge_relative_path("gs://module-cache", "./"),
         "gs://module-cache")
     self.assertEqual(
         file_utils.merge_relative_path("gs://module-cache", "./file"),
         "gs://module-cache/file")
     self.assertEqual(
         file_utils.merge_relative_path("gs://module-cache",
                                        "hello/../bla"),
         "gs://module-cache/bla")
     self.assertEqual(
         file_utils.merge_relative_path("gs://module-cache", "/"),
         "gs://module-cache", "/")
     with self.assertRaisesRegex(ValueError, "is invalid"):
         file_utils.merge_relative_path("gs://module-cache", "/../")
     with self.assertRaisesRegex(ValueError, "is invalid"):
         file_utils.merge_relative_path("gs://module-cache",
                                        "hello/../../bla")
Esempio n. 2
0
def _merge_relative_path(dst_path, rel_path):
    """Merge a relative tar file to a destination (which can be "gs://...")."""
    return file_utils.merge_relative_path(dst_path, rel_path)