Skip to content

Commit

Permalink
Fix providers validation in check_files.py after switch to the hatc…
Browse files Browse the repository at this point in the history
…h builds (#36921)
  • Loading branch information
Taragolis authored Jan 19, 2024
1 parent cabd768 commit db767f0
Showing 1 changed file with 45 additions and 1 deletion.
46 changes: 45 additions & 1 deletion dev/check_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def check_providers(files: list[str]):
version = strip_rc_suffix(version)
expected_files = expand_name_variations(
[
f"{name}-{version}.tar.gz",
f"{name.replace('-', '_')}-{version}.tar.gz",
f"{name.replace('-', '_')}-{version}-py3-none-any.whl",
]
)
Expand Down Expand Up @@ -275,3 +275,47 @@ def test_check_release_fail():

missing_files = check_release(files, version="2.8.1rc2")
assert missing_files == ["apache_airflow-2.8.1.tar.gz"]


def test_check_providers_pass(monkeypatch, tmp_path):
"""Passes if all present"""
monkeypatch.chdir(tmp_path)
(tmp_path / "packages.txt").write_text(
"https://pypi.org/project/apache-airflow-providers-airbyte/3.1.0rc1/\n"
"https://pypi.org/project/apache-airflow-providers-foo-bar/9.6.42rc2/\n"
)

files = [
"apache_airflow_providers_airbyte-3.1.0.tar.gz",
"apache_airflow_providers_airbyte-3.1.0.tar.gz.asc",
"apache_airflow_providers_airbyte-3.1.0.tar.gz.sha512",
"apache_airflow_providers_airbyte-3.1.0-py3-none-any.whl",
"apache_airflow_providers_airbyte-3.1.0-py3-none-any.whl.asc",
"apache_airflow_providers_airbyte-3.1.0-py3-none-any.whl.sha512",
"apache_airflow_providers_foo_bar-9.6.42.tar.gz",
"apache_airflow_providers_foo_bar-9.6.42.tar.gz.asc",
"apache_airflow_providers_foo_bar-9.6.42.tar.gz.sha512",
"apache_airflow_providers_foo_bar-9.6.42-py3-none-any.whl",
"apache_airflow_providers_foo_bar-9.6.42-py3-none-any.whl.asc",
"apache_airflow_providers_foo_bar-9.6.42-py3-none-any.whl.sha512",
]
assert check_providers(files) == []


def test_check_providers_failure(monkeypatch, tmp_path):
"""Passes if all present"""
monkeypatch.chdir(tmp_path)
(tmp_path / "packages.txt").write_text(
"https://pypi.org/project/apache-airflow-providers-spam-egg/1.2.3rc4/\n"
)

files = [
"apache_airflow_providers_spam_egg-1.2.3.tar.gz",
"apache_airflow_providers_spam_egg-1.2.3.tar.gz.sha512",
"apache_airflow_providers_spam_egg-1.2.3-py3-none-any.whl",
"apache_airflow_providers_spam_egg-1.2.3-py3-none-any.whl.asc",
]
assert sorted(check_providers(files)) == [
"apache_airflow_providers_spam_egg-1.2.3-py3-none-any.whl.sha512",
"apache_airflow_providers_spam_egg-1.2.3.tar.gz.asc",
]

0 comments on commit db767f0

Please sign in to comment.