Skip to content

Commit

Permalink
Make PRs changing pyproject.toml neutral for breeze tests (#37314)
Browse files Browse the repository at this point in the history
The #37305 optimized CI jobs to limit tests run when pyproject.toml
is changed without impacting dependencies, optional_dependencies and
build-system. However it impacts results of other unit tests as they
were using `HEAD` as commit in selective checks,

Instead of using HEAD, we are using neutral commit (one only changing
INTHEWILD) for all such tests, so that we do not introduce side effects
coming from the incoming PR.
  • Loading branch information
potiuk authored Feb 10, 2024
1 parent 7aa8f46 commit 08e655a
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions dev/breeze/tests/test_selective_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@
ALL_DOCS_SELECTED_FOR_BUILD = ""
ALL_PROVIDERS_AFFECTED = ""

# commit that is neutral - allows to keep pyproject.toml-changing PRS neutral for unit tests
NEUTRAL_COMMIT = "938f0c1f3cc4cbe867123ee8aa9f290f9f18100a"


def escape_ansi_colors(line):
return ANSI_COLORS_MATCHER.sub("", line)
Expand Down Expand Up @@ -587,7 +590,7 @@ def test_expected_output_pull_request_main(
):
stderr = SelectiveChecks(
files=files,
commit_ref="HEAD",
commit_ref=NEUTRAL_COMMIT,
github_event=GithubEvents.PULL_REQUEST,
pr_labels=(),
default_branch="main",
Expand Down Expand Up @@ -687,7 +690,7 @@ def test_full_test_needed_when_scripts_changes(files: tuple[str, ...], expected_
stderr = SelectiveChecks(
files=files,
github_event=GithubEvents.PULL_REQUEST,
commit_ref="HEAD",
commit_ref=NEUTRAL_COMMIT,
default_branch="main",
)
assert_outputs_are_printed(expected_outputs, str(stderr))
Expand Down Expand Up @@ -819,7 +822,7 @@ def test_expected_output_full_tests_needed(
):
stderr = SelectiveChecks(
files=files,
commit_ref="HEAD",
commit_ref=NEUTRAL_COMMIT,
github_event=GithubEvents.PULL_REQUEST,
pr_labels=pr_labels,
default_branch=default_branch,
Expand Down Expand Up @@ -942,7 +945,7 @@ def test_expected_output_pull_request_v2_7(
):
stderr = SelectiveChecks(
files=files,
commit_ref="HEAD",
commit_ref=NEUTRAL_COMMIT,
github_event=GithubEvents.PULL_REQUEST,
pr_labels=(),
default_branch="v2-7-stable",
Expand Down Expand Up @@ -1110,7 +1113,7 @@ def test_expected_output_pull_request_target(
):
stderr = SelectiveChecks(
files=files,
commit_ref="HEAD",
commit_ref=NEUTRAL_COMMIT,
github_event=GithubEvents.PULL_REQUEST_TARGET,
pr_labels=(),
default_branch="main",
Expand Down Expand Up @@ -1199,7 +1202,7 @@ def test_expected_output_push(
):
stderr = SelectiveChecks(
files=files,
commit_ref="HEAD",
commit_ref=NEUTRAL_COMMIT,
github_event=GithubEvents.PUSH,
pr_labels=pr_labels,
default_branch=default_branch,
Expand Down Expand Up @@ -1436,7 +1439,7 @@ def test_upgrade_to_newer_dependencies(
def test_docs_filter(files: tuple[str, ...], expected_outputs: dict[str, str]):
stderr = SelectiveChecks(
files=files,
commit_ref="HEAD",
commit_ref=NEUTRAL_COMMIT,
github_event=GithubEvents.PULL_REQUEST,
pr_labels=(),
default_branch="main",
Expand All @@ -1461,7 +1464,7 @@ def test_docs_filter(files: tuple[str, ...], expected_outputs: dict[str, str]):
def test_helm_tests_trigger_ci_build(files: tuple[str, ...], expected_outputs: dict[str, str]):
stderr = SelectiveChecks(
files=files,
commit_ref="HEAD",
commit_ref=NEUTRAL_COMMIT,
github_event=GithubEvents.PULL_REQUEST,
pr_labels=(),
default_branch="main",
Expand Down Expand Up @@ -1708,7 +1711,7 @@ def test_has_migrations(files: tuple[str, ...], has_migrations: bool):
stderr = str(
SelectiveChecks(
files=files,
commit_ref="HEAD",
commit_ref=NEUTRAL_COMMIT,
github_event=GithubEvents.PULL_REQUEST,
default_branch="main",
)
Expand Down Expand Up @@ -1742,7 +1745,7 @@ def test_has_migrations(files: tuple[str, ...], has_migrations: bool):
def test_provider_compatibility_checks(labels: tuple[str, ...], expected_outputs: dict[str, str]):
stderr = SelectiveChecks(
files=(),
commit_ref="HEAD",
commit_ref=NEUTRAL_COMMIT,
github_event=GithubEvents.PULL_REQUEST,
pr_labels=labels,
default_branch="main",
Expand Down Expand Up @@ -1830,7 +1833,7 @@ def test_mypy_matches(
):
stderr = SelectiveChecks(
files=files,
commit_ref="HEAD",
commit_ref=NEUTRAL_COMMIT,
default_branch=default_branch,
github_event=GithubEvents.PULL_REQUEST,
pr_labels=pr_labels,
Expand Down Expand Up @@ -1878,7 +1881,7 @@ def test_pr_labels(
):
stderr = SelectiveChecks(
files=files,
commit_ref="HEAD",
commit_ref=NEUTRAL_COMMIT,
default_branch="main",
github_actor=github_actor,
github_event=GithubEvents.PULL_REQUEST,
Expand Down

0 comments on commit 08e655a

Please sign in to comment.