This is an automated email from the ASF dual-hosted git repository.

husseinawala pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new db767f0091 Fix providers validation in `check_files.py` after switch 
to the hatch builds (#36921)
db767f0091 is described below

commit db767f0091d09d079ff55edd385024cd49a98e52
Author: Andrey Anshin <andrey.ans...@taragol.is>
AuthorDate: Sat Jan 20 03:35:12 2024 +0400

    Fix providers validation in `check_files.py` after switch to the hatch 
builds (#36921)
---
 dev/check_files.py | 46 +++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 45 insertions(+), 1 deletion(-)

diff --git a/dev/check_files.py b/dev/check_files.py
index b73bc64e77..321f646a2c 100644
--- a/dev/check_files.py
+++ b/dev/check_files.py
@@ -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",
             ]
         )
@@ -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",
+    ]

Reply via email to