Test that a comment with a link to the docs is successfully left on PRs
(
caplog,
tmpdir_factory,
main_xml_file,
main_xml_content,
pr_xml_file,
pr_xml_content,
additional_tests_to_check,
target_url,
s3_prefix,
jenkins_prefix,
common_main_build,
commit_sha,
expected_body,
)
| 251 | @parameterize_named(**TEST_DATA_SKIPPED_BOT) |
| 252 | # pylint: enable=line-too-long |
| 253 | def test_skipped_tests_comment( |
| 254 | caplog, |
| 255 | tmpdir_factory, |
| 256 | main_xml_file, |
| 257 | main_xml_content, |
| 258 | pr_xml_file, |
| 259 | pr_xml_content, |
| 260 | additional_tests_to_check, |
| 261 | target_url, |
| 262 | s3_prefix, |
| 263 | jenkins_prefix, |
| 264 | common_main_build, |
| 265 | commit_sha, |
| 266 | expected_body, |
| 267 | ): |
| 268 | """ |
| 269 | Test that a comment with a link to the docs is successfully left on PRs |
| 270 | """ |
| 271 | |
| 272 | def write_xml_file(root_dir, xml_file, xml_content): |
| 273 | shutil.rmtree(root_dir, ignore_errors=True) |
| 274 | file = root_dir / xml_file |
| 275 | file.parent.mkdir(parents=True) |
| 276 | with open(file, "w") as f: |
| 277 | f.write(textwrap.dedent(xml_content)) |
| 278 | |
| 279 | git = TempGit(tmpdir_factory.mktemp("tmp_git_dir")) |
| 280 | pr_test_report_dir = Path(git.cwd) / "pr-reports" |
| 281 | write_xml_file(pr_test_report_dir, pr_xml_file, pr_xml_content) |
| 282 | main_test_report_dir = Path(git.cwd) / "main-reports" |
| 283 | write_xml_file(main_test_report_dir, main_xml_file, main_xml_content) |
| 284 | with open(Path(git.cwd) / "required_tests_to_run.json", "w") as f: |
| 285 | f.write(additional_tests_to_check) |
| 286 | |
| 287 | pr_data = { |
| 288 | "commits": { |
| 289 | "nodes": [ |
| 290 | { |
| 291 | "commit": { |
| 292 | "oid": commit_sha, |
| 293 | "statusCheckRollup": { |
| 294 | "contexts": { |
| 295 | "nodes": [ |
| 296 | { |
| 297 | "context": "tvm-ci/pr-head", |
| 298 | "targetUrl": target_url, |
| 299 | } |
| 300 | ] |
| 301 | } |
| 302 | }, |
| 303 | } |
| 304 | } |
| 305 | ] |
| 306 | } |
| 307 | } |
| 308 | with caplog.at_level(logging.INFO): |
| 309 | comment = scripts.github.github_skipped_tests_comment.get_skipped_tests_comment( |
| 310 | pr=pr_data, |
nothing calls this directly
no test coverage detected
searching dependent graphs…