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

amoghdesai 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 3d33d6d6386 Fix test_date_timezone_omitted by patching correct 
timezone attribute (#59698)
3d33d6d6386 is described below

commit 3d33d6d63861ce0536c561dfeecfadb6b5b24efb
Author: Ankit Chaurasia <[email protected]>
AuthorDate: Mon Dec 22 11:12:01 2025 +0545

    Fix test_date_timezone_omitted by patching correct timezone attribute 
(#59698)
    
    The test was failing because it tried to patch a non-existent TIMEZONE
    attribute. The timezone module uses _Timezone.initialized_timezone
    to store the default timezone, which is what the parse function uses
    when parsing timestamps without timezone information.
    
    Fixes failing tests:
    - TestCLIDBClean.test_date_timezone_omitted[UTC]
    - TestCLIDBClean.test_date_timezone_omitted[Europe/Berlin]
    - TestCLIDBClean.test_date_timezone_omitted[America/Los_Angeles]
---
 airflow-core/tests/unit/cli/commands/test_db_command.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/airflow-core/tests/unit/cli/commands/test_db_command.py 
b/airflow-core/tests/unit/cli/commands/test_db_command.py
index 1e56647f042..fcd18c308b1 100644
--- a/airflow-core/tests/unit/cli/commands/test_db_command.py
+++ b/airflow-core/tests/unit/cli/commands/test_db_command.py
@@ -694,7 +694,9 @@ class TestCLIDBClean:
         coerced to tz-aware with default timezone
         """
         timestamp = "2021-01-01 00:00:00"
-        with patch("airflow._shared.timezones.timezone.TIMEZONE", 
pendulum.timezone(timezone)):
+        with patch(
+            
"airflow._shared.timezones.timezone._Timezone.initialized_timezone", 
pendulum.timezone(timezone)
+        ):
             args = self.parser.parse_args(["db", "clean", 
"--clean-before-timestamp", f"{timestamp}", "-y"])
             db_command.cleanup_tables(args)
         run_cleanup_mock.assert_called_once_with(

Reply via email to