MCPcopy Create free account
hub / github.com/apache/tvm / TempGit

Class TempGit

tests/python/ci/test_utils.py:32–55  ·  view source on GitHub ↗

A wrapper to run commands in a directory (specifically for use in CI tests)

Source from the content-addressed store, hash-verified

30
31
32class TempGit:
33 """
34 A wrapper to run commands in a directory (specifically for use in CI tests)
35 """
36
37 def __init__(self, cwd):
38 self.cwd = cwd
39 # Jenkins git is too old and doesn't have 'git init --initial-branch',
40 # so init and checkout need to be separate steps
41 self.run("init", stderr=subprocess.PIPE, stdout=subprocess.PIPE)
42 self.run("checkout", "-b", "main", stderr=subprocess.PIPE)
43 self.run("remote", "add", "origin", "https://github.com/apache/tvm.git")
44
45 def run(self, *args, **kwargs):
46 """
47 Run a git command based on *args
48 """
49 proc = subprocess.run(
50 ["git"] + list(args), encoding="utf-8", cwd=self.cwd, check=False, **kwargs
51 )
52 if proc.returncode != 0:
53 raise RuntimeError(f"git command failed: '{args}'")
54
55 return proc
56
57
58def run_script(command: list[Any], check: bool = True, **kwargs):

Callers 11

testMethod · 0.85
test_cc_reviewersFunction · 0.85
test_update_branchFunction · 0.85
test_pr_commentFunction · 0.85
test_skip_ciFunction · 0.85
test_skip_globsFunction · 0.85
test_ping_reviewersFunction · 0.85
test_github_tag_teamsFunction · 0.85

Calls

no outgoing calls

Tested by 11

testMethod · 0.68
test_cc_reviewersFunction · 0.68
test_update_branchFunction · 0.68
test_pr_commentFunction · 0.68
test_skip_ciFunction · 0.68
test_skip_globsFunction · 0.68
test_ping_reviewersFunction · 0.68
test_github_tag_teamsFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…