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

eladkal 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 9e5ed05c2b Fix `common.io' provider missing in tests package (#35444)
9e5ed05c2b is described below

commit 9e5ed05c2b21a1a1bf1a732cd194248712549616
Author: Jarek Potiuk <[email protected]>
AuthorDate: Sat Nov 4 21:29:28 2023 +0100

    Fix `common.io' provider missing in tests package (#35444)
    
    The common.io provider has been missing from the "tests" folder and
    a side effect of it was that if this was the only provider in
    "Providers[common.io]" the tests were run for absolutely
    everything (but a kitchen sink) - and failed, because we do not
    have working `pytest` without selecting the test suite (tests,
    helm_tests and the like)
    
    This PR fixes it:
    
    * when there is a provider with mising folder, it will fail the
      breeze tests command when specified in "Providers["
    
    * the common.io has now empty test provider package.
---
 dev/breeze/src/airflow_breeze/utils/run_tests.py    |  6 +++++-
 dev/breeze/tests/test_pytest_args_for_test_types.py | 10 ++++++++++
 tests/providers/common/io/__init__.py               | 16 ++++++++++++++++
 3 files changed, 31 insertions(+), 1 deletion(-)

diff --git a/dev/breeze/src/airflow_breeze/utils/run_tests.py 
b/dev/breeze/src/airflow_breeze/utils/run_tests.py
index b531a2f80a..042c578fd9 100644
--- a/dev/breeze/src/airflow_breeze/utils/run_tests.py
+++ b/dev/breeze/src/airflow_breeze/utils/run_tests.py
@@ -253,7 +253,11 @@ def convert_test_type_to_pytest_args(
             if (AIRFLOW_SOURCES_ROOT / provider_path).is_dir():
                 providers_to_test.append(provider_path)
             else:
-                get_console().print(f"[warning]Provider {provider} does not 
exist. Ignoring it.")
+                get_console().print(
+                    f"[error]Provider directory {provider_path} does not exist 
for {provider}. "
+                    f"This is bad. Please add it (all providers should have a 
package in tests)"
+                )
+                sys.exit(1)
         return providers_to_test
     if test_type == "Other":
         return find_all_other_tests()
diff --git a/dev/breeze/tests/test_pytest_args_for_test_types.py 
b/dev/breeze/tests/test_pytest_args_for_test_types.py
index 3b12f01dd1..9b006f4622 100644
--- a/dev/breeze/tests/test_pytest_args_for_test_types.py
+++ b/dev/breeze/tests/test_pytest_args_for_test_types.py
@@ -87,6 +87,11 @@ from airflow_breeze.utils.run_tests import 
convert_parallel_types_to_folders, co
             ["tests/providers/amazon"],
             False,
         ),
+        (
+            "Providers[common.io]",
+            ["tests/providers/common/io"],
+            False,
+        ),
         (
             "Providers[amazon,google,apache.hive]",
             ["tests/providers/amazon", "tests/providers/google", 
"tests/providers/apache/hive"],
@@ -188,6 +193,11 @@ def test_pytest_args_for_regular_test_types(
     )
 
 
+def test_pytest_args_for_missing_provider():
+    with pytest.raises(SystemExit):
+        
convert_test_type_to_pytest_args(test_type="Providers[missing.provider]", 
skip_provider_tests=False)
+
+
 @pytest.mark.parametrize(
     "helm_test_package, pytest_args",
     [
diff --git a/tests/providers/common/io/__init__.py 
b/tests/providers/common/io/__init__.py
new file mode 100644
index 0000000000..13a83393a9
--- /dev/null
+++ b/tests/providers/common/io/__init__.py
@@ -0,0 +1,16 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.

Reply via email to