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

Function test_update_branch

tests/python/ci/test_ci.py:483–514  ·  view source on GitHub ↗

Test that the last-successful branch script updates successfully

(tmpdir_factory, statuses, expected_rc, expected_output)

Source from the content-addressed store, hash-verified

481 ),
482)
483def test_update_branch(tmpdir_factory, statuses, expected_rc, expected_output):
484 """
485 Test that the last-successful branch script updates successfully
486 """
487 update_script = GITHUB_SCRIPT_ROOT / "update_branch.py"
488
489 git = TempGit(tmpdir_factory.mktemp("tmp_git_dir"))
490 commit = {
491 "statusCheckRollup": {"contexts": {"nodes": statuses}},
492 "oid": "123",
493 "messageHeadline": "hello",
494 }
495 data = {
496 "data": {
497 "repository": {
498 "defaultBranchRef": {"target": {"history": {"edges": [], "nodes": [commit]}}}
499 }
500 }
501 }
502 proc = run_script(
503 [update_script, "--dry-run", "--testonly-json", json.dumps(data)],
504 cwd=git.cwd,
505 check=False,
506 )
507
508 if proc.returncode != expected_rc:
509 raise RuntimeError(f"Wrong return code:\nstdout:\n{proc.stdout}\n\nstderr:\n{proc.stderr}")
510
511 if expected_output not in proc.stdout:
512 raise RuntimeError(
513 f"Missing {expected_output}:\nstdout:\n{proc.stdout}\n\nstderr:\n{proc.stderr}"
514 )
515
516
517# pylint: disable=line-too-long

Callers

nothing calls this directly

Calls 2

TempGitClass · 0.85
run_scriptFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…