Run the tvm-bot script using the data from preprocess_data
(self, tmpdir_factory)
| 49 | |
| 50 | @tvm.testing.skip_if_wheel_test |
| 51 | def test(self, tmpdir_factory): |
| 52 | """ |
| 53 | Run the tvm-bot script using the data from preprocess_data |
| 54 | """ |
| 55 | mergebot_script = GITHUB_SCRIPT_ROOT / "github_tvmbot.py" |
| 56 | test_json_dir = Path(__file__).resolve().parent / "sample_prs" |
| 57 | with open(test_json_dir / f"pr{self.NUMBER}.json") as f: |
| 58 | test_data = json.load(f) |
| 59 | |
| 60 | # Update testing data with replacements / additions |
| 61 | test_data = self.preprocess_data(test_data) |
| 62 | |
| 63 | git = TempGit(tmpdir_factory.mktemp("tmp_git_dir")) |
| 64 | |
| 65 | comment = { |
| 66 | "body": self.COMMENT, |
| 67 | "id": 123, |
| 68 | "user": { |
| 69 | "login": self.USER, |
| 70 | }, |
| 71 | } |
| 72 | allowed_users = [{"login": "abc"}, {"login": "other-abc"}] |
| 73 | |
| 74 | proc = run_script( |
| 75 | [ |
| 76 | mergebot_script, |
| 77 | "--pr", |
| 78 | self.NUMBER, |
| 79 | "--dry-run", |
| 80 | "--run-url", |
| 81 | "https://example.com", |
| 82 | "--testing-pr-json", |
| 83 | json.dumps(test_data), |
| 84 | "--testing-collaborators-json", |
| 85 | json.dumps(allowed_users), |
| 86 | "--testing-mentionable-users-json", |
| 87 | json.dumps(allowed_users), |
| 88 | "--trigger-comment-json", |
| 89 | json.dumps(comment), |
| 90 | ], |
| 91 | env={ |
| 92 | "TVM_BOT_JENKINS_TOKEN": "123", |
| 93 | "GH_ACTIONS_TOKEN": "123", |
| 94 | }, |
| 95 | cwd=git.cwd, |
| 96 | ) |
| 97 | |
| 98 | if self.EXPECTED not in proc.stderr: |
| 99 | raise RuntimeError(f"{proc.stderr}\ndid not contain\n{self.EXPECTED}") |
| 100 | |
| 101 | |
| 102 | class TestNoRequest(_TvmBotTest): |
no test coverage detected