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

potiuk 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 24995e87c0 Suppress error if no tests collected in pydantic special 
Tests (#38470)
24995e87c0 is described below

commit 24995e87c04f8d8c6bc3891011b16675accfbc8f
Author: Andrey Anshin <[email protected]>
AuthorDate: Tue Mar 26 14:36:01 2024 +0400

    Suppress error if no tests collected in pydantic special Tests (#38470)
    
    * Suppress error if no tests collected
    
    * Add --suppress-no-test-exit-code in case of pydantic tests
    
    * Run only if pydantic != v2 (default)
---
 dev/breeze/src/airflow_breeze/commands/testing_commands.py | 5 +++++
 hatch_build.py                                             | 1 +
 2 files changed, 6 insertions(+)

diff --git a/dev/breeze/src/airflow_breeze/commands/testing_commands.py 
b/dev/breeze/src/airflow_breeze/commands/testing_commands.py
index 6d2508b3fb..5cec4b404d 100644
--- a/dev/breeze/src/airflow_breeze/commands/testing_commands.py
+++ b/dev/breeze/src/airflow_breeze/commands/testing_commands.py
@@ -679,6 +679,11 @@ def _run_test_command(
     fix_ownership_using_docker()
     cleanup_python_generated_files()
     perform_environment_checks()
+    if pydantic != "v2":
+        # Avoid edge cases when there are no available tests, e.g. No-Pydantic 
for Weaviate provider.
+        # https://docs.pytest.org/en/stable/reference/exit-codes.html
+        # https://github.com/apache/airflow/pull/38402#issuecomment-2014938950
+        extra_pytest_args = (*extra_pytest_args, 
"--suppress-no-test-exit-code")
     if run_in_parallel:
         if test_type != "Default":
             get_console().print(
diff --git a/hatch_build.py b/hatch_build.py
index 35608e56e0..ac4b54b185 100644
--- a/hatch_build.py
+++ b/hatch_build.py
@@ -255,6 +255,7 @@ DEVEL_EXTRAS: dict[str, list[str]] = {
         "coverage>=7.4.0",
         "pytest-asyncio>=0.23.3",
         "pytest-cov>=4.1.0",
+        "pytest-custom-exit-code>=0.3.0",
         "pytest-icdiff>=0.9",
         "pytest-instafail>=0.5.0",
         "pytest-mock>=3.12.0",

Reply via email to