Skip to content

Commit

Permalink
Fixed CI Support with Python 3.12 (celery#8611)
Browse files Browse the repository at this point in the history
* Fixed t/unit/tasks/test_result.py::test_del()

* Skip t/unit/tasks/test_result.py::test_del() if running with PyPy

* Added Python 3.12 to integration tests in the CI
  • Loading branch information
Nusnus authored and Nikita Frolenkov committed Nov 7, 2023
1 parent b466b71 commit 5c78535
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11']
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
toxenv: ['redis', 'rabbitmq', 'rabbitmq_redis']

services:
Expand Down
8 changes: 7 additions & 1 deletion t/unit/tasks/test_result.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import copy
import datetime
import platform
import traceback
from contextlib import contextmanager
from unittest.mock import Mock, call, patch
Expand Down Expand Up @@ -389,12 +390,17 @@ def test_ready(self):

assert not self.app.AsyncResult(uuid()).ready()

@pytest.mark.skipif(
platform.python_implementation() == "PyPy",
reason="Mocking here doesn't play well with PyPy",
)
def test_del(self):
with patch('celery.result.AsyncResult.backend') as backend:
result = self.app.AsyncResult(self.task1['id'])
result.backend = backend
result_clone = copy.copy(result)
del result
assert backend.remove_pending_result.called_once_with(
backend.remove_pending_result.assert_called_once_with(
result_clone
)

Expand Down

0 comments on commit 5c78535

Please sign in to comment.