This is an automated email from the ASF dual-hosted git repository.
kaxilnaik 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 2403252e422 Fix celery tests with Python 3.13 after 5.5.3 (#56017)
2403252e422 is described below
commit 2403252e42263003654358366b0813652750eff4
Author: Jens Scheffler <[email protected]>
AuthorDate: Wed Sep 24 03:29:42 2025 +0200
Fix celery tests with Python 3.13 after 5.5.3 (#56017)
---
.../tests/unit/celery/cli/test_celery_command.py | 38 ++++++++++++++++------
1 file changed, 28 insertions(+), 10 deletions(-)
diff --git a/providers/celery/tests/unit/celery/cli/test_celery_command.py
b/providers/celery/tests/unit/celery/cli/test_celery_command.py
index f7f786733e5..2bd0755c32c 100644
--- a/providers/celery/tests/unit/celery/cli/test_celery_command.py
+++ b/providers/celery/tests/unit/celery/cli/test_celery_command.py
@@ -21,6 +21,7 @@ import contextlib
import importlib
import json
import os
+import sys
from io import StringIO
from unittest import mock
from unittest.mock import MagicMock, patch
@@ -36,6 +37,8 @@ from airflow.providers.celery.cli.celery_command import
_run_stale_bundle_cleanu
from tests_common.test_utils.config import conf_vars
from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS
+PY313 = sys.version_info >= (3, 13)
+
@pytest.fixture(autouse=False)
def conf_stale_bundle_cleanup_disabled():
@@ -323,16 +326,31 @@ class TestFlowerCommand:
)
]
mock_pid_file.assert_has_calls([mock.call(mock_setup_locations.return_value[0],
-1)])
- assert mock_open.mock_calls == [
- mock.call(mock_setup_locations.return_value[1], "a"),
- mock.call().__enter__(),
- mock.call(mock_setup_locations.return_value[2], "a"),
- mock.call().__enter__(),
- mock.call().truncate(0),
- mock.call().truncate(0),
- mock.call().__exit__(None, None, None),
- mock.call().__exit__(None, None, None),
- ]
+
+ if PY313:
+ assert mock_open.mock_calls == [
+ mock.call(mock_setup_locations.return_value[1], "a"),
+ mock.call().__enter__(),
+ mock.call(mock_setup_locations.return_value[2], "a"),
+ mock.call().__enter__(),
+ mock.call().truncate(0),
+ mock.call().truncate(0),
+ mock.call().__exit__(None, None, None),
+ mock.call().close(),
+ mock.call().__exit__(None, None, None),
+ mock.call().close(),
+ ]
+ else:
+ assert mock_open.mock_calls == [
+ mock.call(mock_setup_locations.return_value[1], "a"),
+ mock.call().__enter__(),
+ mock.call(mock_setup_locations.return_value[2], "a"),
+ mock.call().__enter__(),
+ mock.call().truncate(0),
+ mock.call().truncate(0),
+ mock.call().__exit__(None, None, None),
+ mock.call().__exit__(None, None, None),
+ ]
@pytest.mark.skipif(AIRFLOW_V_3_0_PLUS, reason="Test requires Airflow
3.0-")
@mock.patch("airflow.cli.commands.daemon_utils.TimeoutPIDLockFile")