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 ba352daf416 [TESTENV] Pytest plugin allowing to load custom Airflow 
config (#59389)
ba352daf416 is described below

commit ba352daf41691f365c7422edfc7018d8af14c81d
Author: Judit Novak <[email protected]>
AuthorDate: Thu Apr 2 17:57:05 2026 +0200

    [TESTENV] Pytest plugin allowing to load custom Airflow config (#59389)
---
 devel-common/src/tests_common/pytest_plugin.py | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/devel-common/src/tests_common/pytest_plugin.py 
b/devel-common/src/tests_common/pytest_plugin.py
index 4fc35fe3514..0de0e240e96 100644
--- a/devel-common/src/tests_common/pytest_plugin.py
+++ b/devel-common/src/tests_common/pytest_plugin.py
@@ -380,6 +380,12 @@ def pytest_addoption(parser: pytest.Parser):
         dest="disable_capture_warnings",
         help="Disable internal capture warnings.",
     )
+    group.addoption(
+        "--load-config",
+        action="store",
+        dest="load_config",
+        help="[DANGER] Load an airflow config file instead of test environment 
defaults [DANGER]",
+    )
     group.addoption(
         "--warning-output-path",
         action="store",
@@ -410,6 +416,19 @@ def initialize_airflow_tests(request):
 
     print(f"Home of the user: {home}\nAirflow home {airflow_home}")
 
+    if request.config.option.load_config:
+        from airflow.configuration import AIRFLOW_CONFIG, conf, 
load_standard_airflow_configuration
+
+        saved_af_conf = AIRFLOW_CONFIG
+        AIRFLOW_CONFIG = request.config.option.load_config
+        try:
+            load_standard_airflow_configuration(conf)
+        except:
+            raise
+        finally:
+            AIRFLOW_CONFIG = saved_af_conf
+        conf.validate()
+
     if not skip_db_tests and not request.config.option.no_db_init:
         _initialize_airflow_db(request.config.option.db_init, airflow_home)
 

Reply via email to