From a14bc3b7711b4a291dd5aaaad866f1fcc2239ed4 Mon Sep 17 00:00:00 2001 From: Roman Inflianskas Date: Fri, 5 Jul 2024 21:44:58 +0300 Subject: [PATCH] Add support for Python 3.13 Fixes https://github.com/celery/kombu/issues/2051. --- .github/workflows/linter.yml | 2 +- .github/workflows/python-package.yml | 4 ++-- t/unit/transport/test_redis.py | 15 ++++++++----- tox.ini | 32 +++++++++++++++------------- 4 files changed, 30 insertions(+), 23 deletions(-) diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index 0e145bdfb..f9f77b096 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -17,7 +17,7 @@ jobs: runs-on: blacksmith-4vcpu-ubuntu-2204 strategy: matrix: - python-version: ["3.12"] + python-version: ["3.13"] steps: - name: Install system packages run: sudo apt-get update && sudo apt-get install libssl-dev diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 81e826520..1b73b7fa8 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -33,7 +33,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] + python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13'] os: ["blacksmith-4vcpu-ubuntu-2204"] steps: @@ -74,7 +74,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] + python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13'] toxenv: [ 'py-amqp', 'py-redis', diff --git a/t/unit/transport/test_redis.py b/t/unit/transport/test_redis.py index 2f4d89517..9dd0dd479 100644 --- a/t/unit/transport/test_redis.py +++ b/t/unit/transport/test_redis.py @@ -1326,11 +1326,16 @@ def pipeline(transaction=True, shard_hint=None): channel.qos.restore_by_tag('test-tag') assert mock_execute_command is not None - assert mock_execute_command.mock_calls == [ - call('WATCH', 'foo_unacked'), - call('HGET', 'foo_unacked', 'test-tag'), - call('ZREM', 'foo_unacked_index', 'test-tag'), - call('HDEL', 'foo_unacked', 'test-tag') + # https://github.com/redis/redis-py/pull/3038 (redis>=5.1.0a1) + # adds keyword argument `keys` to redis client. + # To be compatible with all supported redis versions, + # take into account only `call.args`. + call_args = [call.args for call in mock_execute_command.mock_calls] + assert call_args == [ + ('WATCH', 'foo_unacked'), + ('HGET', 'foo_unacked', 'test-tag'), + ('ZREM', 'foo_unacked_index', 'test-tag'), + ('HDEL', 'foo_unacked', 'test-tag') ] diff --git a/tox.ini b/tox.ini index 7b45b9b49..d03e20d8c 100644 --- a/tox.ini +++ b/tox.ini @@ -1,10 +1,10 @@ [tox] envlist = - {pypy3.10,3.8,3.9,3.10,3.11,3.12}-unit - {pypy3.10,3.8,3.9,3.10,3.11,3.12}-linux-integration-py-amqp - {pypy3.10,3.8,3.9,3.10,3.11,3.12}-linux-integration-redis - {pypy3.10,3.8,3.9,3.10,3.11,3.12}-linux-integration-mongodb - {pypy3.10,3.8,3.9,3.10,3.11,3.12}-linux-integration-kafka + {pypy3.10,3.8,3.9,3.10,3.11,3.12,3.13}-unit + {pypy3.10,3.8,3.9,3.10,3.11,3.12,3.13}-linux-integration-py-amqp + {pypy3.10,3.8,3.9,3.10,3.11,3.12,3.13}-linux-integration-redis + {pypy3.10,3.8,3.9,3.10,3.11,3.12,3.13}-linux-integration-mongodb + {pypy3.10,3.8,3.9,3.10,3.11,3.12,3.13}-linux-integration-kafka flake8 apicheck pydocstyle @@ -21,6 +21,7 @@ python = 3.10: py310 3.11: py311 3.12: py312 + 3.13: py313 pypy3: pypy3 [testenv] @@ -32,10 +33,10 @@ passenv = DISTUTILS_USE_SDK deps= -r{toxinidir}/requirements/dev.txt - apicheck,pypy3.10,3.8,3.9,3.10,3.11,3.12: -r{toxinidir}/requirements/default.txt - apicheck,pypy3.10,3.8,3.9,3.10,3.11,3.12: -r{toxinidir}/requirements/test.txt - apicheck,pypy3.10,3.8,3.9,3.10,3.11,3.12: -r{toxinidir}/requirements/test-ci.txt - apicheck,3.8-linux,3.9-linux,3.10-linux,3.11-linux,3.12-linux: -r{toxinidir}/requirements/extras/confluentkafka.txt + apicheck,pypy3.10,3.8,3.9,3.10,3.11,3.12,3.13: -r{toxinidir}/requirements/default.txt + apicheck,pypy3.10,3.8,3.9,3.10,3.11,3.12,3.13: -r{toxinidir}/requirements/test.txt + apicheck,pypy3.10,3.8,3.9,3.10,3.11,3.12,3.13: -r{toxinidir}/requirements/test-ci.txt + apicheck,3.8-linux,3.9-linux,3.10-linux,3.11-linux,3.12-linux,3.13-linux: -r{toxinidir}/requirements/extras/confluentkafka.txt apicheck,linkcheck: -r{toxinidir}/requirements/docs.txt flake8,pydocstyle,mypy: -r{toxinidir}/requirements/pkgutils.txt integration: -r{toxinidir}/requirements/test-integration.txt @@ -54,7 +55,8 @@ basepython = 3.10: python3.10 3.11: python3.11 3.12: python3.12 - apicheck,pydocstyle,flake8,linkcheck,cov,mypy: python3.12 + 3.13: python3.13 + apicheck,pydocstyle,flake8,linkcheck,cov,mypy: python3.13 install_command = python -m pip --disable-pip-version-check install {opts} {packages} @@ -162,9 +164,9 @@ setenv = PYTHONDONTWRITEBYTECODE = 1 commands = tox -e \ - 3.12-unit,\ - 3.12-linux-integration-py-amqp,\ - 3.12-linux-integration-redis,\ - 3.12-linux-integration-mongodb,\ - 3.12-linux-integration-kafka \ + 3.13-unit,\ + 3.13-linux-integration-py-amqp,\ + 3.13-linux-integration-redis,\ + 3.13-linux-integration-mongodb,\ + 3.13-linux-integration-kafka \ -p -o -- --exitfirst {posargs}