Test the PR commenting bot
(tmpdir_factory, pr_author, comments, expected)
| 592 | ) |
| 593 | # pylint: enable=line-too-long |
| 594 | def test_pr_comment(tmpdir_factory, pr_author, comments, expected): |
| 595 | """ |
| 596 | Test the PR commenting bot |
| 597 | """ |
| 598 | comment_script = GITHUB_SCRIPT_ROOT / "github_pr_comment.py" |
| 599 | |
| 600 | git = TempGit(tmpdir_factory.mktemp("tmp_git_dir")) |
| 601 | target_url = "https://ci.tlcpack.ai/job/tvm/job/PR-11594/3/display/redirect" |
| 602 | commit = { |
| 603 | "commit": { |
| 604 | "oid": "sha1234", |
| 605 | "statusCheckRollup": { |
| 606 | "contexts": { |
| 607 | "nodes": [ |
| 608 | { |
| 609 | "context": "tvm-ci/pr-head", |
| 610 | "targetUrl": target_url, |
| 611 | } |
| 612 | ] |
| 613 | } |
| 614 | }, |
| 615 | } |
| 616 | } |
| 617 | data = { |
| 618 | "[1] POST - https://api.github.com/graphql": {}, |
| 619 | "[2] POST - https://api.github.com/graphql": { |
| 620 | "data": { |
| 621 | "repository": { |
| 622 | "pullRequest": { |
| 623 | "number": 1234, |
| 624 | "comments": { |
| 625 | "nodes": comments, |
| 626 | }, |
| 627 | "author": { |
| 628 | "login": pr_author, |
| 629 | }, |
| 630 | "commits": { |
| 631 | "nodes": [commit], |
| 632 | }, |
| 633 | } |
| 634 | } |
| 635 | } |
| 636 | }, |
| 637 | } |
| 638 | comments = { |
| 639 | "ccs": "the cc", |
| 640 | "docs": "the docs", |
| 641 | "skipped-tests": "the skipped tests", |
| 642 | } |
| 643 | proc = run_script( |
| 644 | [ |
| 645 | comment_script, |
| 646 | "--dry-run", |
| 647 | "--test-data", |
| 648 | json.dumps(data), |
| 649 | "--test-comments", |
| 650 | json.dumps(comments), |
| 651 | "--pr", |
nothing calls this directly
no test coverage detected
searching dependent graphs…