From b2efc79762887a4156b17da945d04db120d8fe23 Mon Sep 17 00:00:00 2001 From: Kyle Edwards Date: Wed, 28 Aug 2024 13:54:34 -0400 Subject: [PATCH] More tests --- .../test_pr_builder.py | 60 ++++++++++++++++++- 1 file changed, 59 insertions(+), 1 deletion(-) diff --git a/test/rapids_pre_commit_hooks/test_pr_builder.py b/test/rapids_pre_commit_hooks/test_pr_builder.py index 950f792..c67a7a6 100644 --- a/test/rapids_pre_commit_hooks/test_pr_builder.py +++ b/test/rapids_pre_commit_hooks/test_pr_builder.py @@ -287,8 +287,66 @@ def test_check_jobs_first_job(content, pr_builder_index, warnings): ), ], ), + ( + dedent( + """\ + jobs: + pr-builder: + needs: + - other-job-1 + - other-job-2 + other-job-1: {} + other-job-2: {} + other-job-3: {} + """ + ), + ["other-job-3"], + [], + ), + ( + dedent( + """\ + jobs: + pr-builder: + needs: + - other-job-1 + - other-job-2 + - other-job-3 + other-job-1: {} + other-job-2: {} + other-job-3: {} + """ + ), + ["other-job-3"], + [ + LintWarning( + (24, 29), + "'pr-builder' job should depend on all other jobs in the order " + "they appear", + notes=[ + Note( + (24, 29), + "to ignore a job dependency, pass it as " + "--ignore-dependency", + ), + ], + replacements=[ + Replacement( + (37, 90), + "- other-job-1\n - other-job-2", + ), + ], + ), + ], + ), + ], + ids=[ + "correct", + "unsorted", + "missing", + "ignore-dependencies-correct", + "ignore-dependencies-extra", ], - ids=["correct", "unsorted", "missing"], ) def test_check_other_jobs(content, ignore_dependencies, warnings): linter = Linter(".github/workflows/pr.yaml", content)