コード例 #1
0
ファイル: test_git.py プロジェクト: thiagotnunes/synthtool
 def testPrecloneMap(self):
     # Pre clone the repo into a temporary directory.
     tmpdir = tmp.tmpdir()
     local_directory = git.clone(
         "https://github.com/googleapis/nodejs-vision.git", tmpdir
     )
     # Write out a preclone map.
     preconfig_path = tmpdir / "preconfig.json"
     preconfig = Preconfig()
     preconfig.precloned_repos[
         "https://github.com/googleapis/nodejs-vision.git"
     ] = str(local_directory)
     preconfig_path.write_text(google.protobuf.json_format.MessageToJson(preconfig))
     # Reload the module so it reexamines the environment variable.
     importlib.reload(synthtool.preconfig)
     metadata.reset()
     # Confirm calling clone with the preclone map returns the precloned local directory.
     os.environ[synthtool.preconfig.PRECONFIG_ENVIRONMENT_VARIABLE] = str(
         preconfig_path
     )
     same_local_directory = git.clone(
         "https://github.com/googleapis/nodejs-vision.git"
     )
     self.assertEqual(local_directory, same_local_directory)
     # Make sure it was recorded in the metadata.
     self.assertEqual("nodejs-vision", metadata.get().sources[0].git.name)
コード例 #2
0
ファイル: templates.py プロジェクト: googleapis/synthtool
 def __init__(self, location: PathOrStr, excludes: List[str] = []) -> None:
     self.env = _make_env(location)
     self.dir = tmp.tmpdir()
     self.excludes = excludes
コード例 #3
0
ファイル: templates.py プロジェクト: googleapis/synthtool
 def __init__(self, location: PathOrStr) -> None:
     self.env = _make_env(location)
     self.source_path = Path(location)
     self.dir = tmp.tmpdir()
コード例 #4
0
def source_tree():
    tmp_dir = tmpdir()
    cwd = os.getcwd()
    os.chdir(tmp_dir)
    yield SourceTree(tmp_dir)
    os.chdir(cwd)