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

potiuk pushed a commit to branch 
move-use-historical-filename-templates-to-logging
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to 
refs/heads/move-use-historical-filename-templates-to-logging by this push:
     new 93e6bc6d8c0 Add test for deprecated 
core.use_historical_filename_templates
93e6bc6d8c0 is described below

commit 93e6bc6d8c0c4eaa8c5ff887d42d7ef0cc1bc35f
Author: Jarek Potiuk <[email protected]>
AuthorDate: Sat Feb 28 20:27:24 2026 +0100

    Add test for deprecated core.use_historical_filename_templates
    
    Verify that reading from the old [core] section triggers a
    DeprecationWarning, both via environment variable and config file.
    
    Co-Authored-By: Claude Opus 4.6 <[email protected]>
---
 tests/core/test_configuration.py | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/tests/core/test_configuration.py b/tests/core/test_configuration.py
index cceef50a313..1b2d6ffe8c1 100644
--- a/tests/core/test_configuration.py
+++ b/tests/core/test_configuration.py
@@ -1023,6 +1023,42 @@ class TestDeprecatedConf:
             with pytest.warns(DeprecationWarning), conf_vars({("core", 
"logging_level"): "VALUE"}):
                 assert conf.get("logging", "logging_level") == "VALUE"
 
+    @conf_vars(
+        {
+            ("logging", "use_historical_filename_templates"): None,
+            ("core", "use_historical_filename_templates"): None,
+        }
+    )
+    def test_deprecated_use_historical_filename_templates(self):
+        """Test that core.use_historical_filename_templates is deprecated in 
favor of logging section."""
+        with set_deprecated_options(
+            deprecated_options={
+                ("logging", "use_historical_filename_templates"): (
+                    "core",
+                    "use_historical_filename_templates",
+                    "2.11.2",
+                )
+            }
+        ):
+            conf.remove_option("core", "use_historical_filename_templates")
+            conf.remove_option("logging", "use_historical_filename_templates")
+
+            with pytest.warns(DeprecationWarning):
+                with mock.patch.dict("os.environ", 
AIRFLOW__CORE__USE_HISTORICAL_FILENAME_TEMPLATES="True"):
+                    assert conf.get("logging", 
"use_historical_filename_templates") == "True"
+
+            with pytest.warns(
+                DeprecationWarning,
+                match=r"The use_historical_filename_templates option in 
\[core\]",
+            ):
+                with mock.patch.dict("os.environ", 
AIRFLOW__CORE__USE_HISTORICAL_FILENAME_TEMPLATES="True"):
+                    assert conf.get("core", 
"use_historical_filename_templates") == "True"
+
+            with pytest.warns(DeprecationWarning), conf_vars(
+                {("core", "use_historical_filename_templates"): "True"}
+            ):
+                assert conf.get("logging", 
"use_historical_filename_templates") == "True"
+
     @conf_vars(
         {
             ("celery", "result_backend"): None,

Reply via email to