[Python-modules-commits] [django-celery-transactions] 02/07: Import django-celery-transactions_0.3.5.orig.tar.gz
Michael Fladischer
fladi at moszumanska.debian.org
Mon Oct 12 10:39:53 UTC 2015
This is an automated email from the git hooks/post-receive script.
fladi pushed a commit to branch master
in repository django-celery-transactions.
commit cbde7d6e772b59087808ca090b68decfd056d524
Author: Michael Fladischer <FladischerMichael at fladi.at>
Date: Mon Oct 12 12:33:11 2015 +0200
Import django-celery-transactions_0.3.5.orig.tar.gz
---
.travis.yml | 6 +++---
CHANGELOG | 43 ++++++++++++++++++++++++++++++---------
djcelery_transactions/__init__.py | 10 +++++++++
setup.py | 2 +-
tests/test/tests.py | 17 ++++++++++++++++
5 files changed, 64 insertions(+), 14 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index 1435174..53e4d21 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -8,9 +8,9 @@ python:
services: mysql
env:
- - DJANGO="django==1.8.2" DB="mysql"
- - DJANGO="django==1.7.8" DB="mysql"
- - DJANGO="django==1.6.10" DB="mysql"
+ - DJANGO="django==1.8.5" DB="mysql"
+ - DJANGO="django==1.7.10" DB="mysql"
+ - DJANGO="django==1.6.11" DB="mysql"
install:
- pip install $DJANGO
diff --git a/CHANGELOG b/CHANGELOG
index a81ad57..bb931db 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,9 +1,41 @@
Changelog
=========
-0.3.2 (unreleased)
+0.3.5 (2015-10-07)
------------------------
+- Handle nested transactions differently to account for tests and live
+ code. [Nicolas Grasset]
+
+0.3.4 (2015-10-07)
+------------------
+
+- Fix nested condition. [Nicolas Grasset]
+
+0.3.3 (2015-10-06)
+------------------
+
+- TestCase support for Django 1.6 and 1.7. [Nicolas Grasset]
+
+- Nested transactions. Django 1.8 TestCase is different. [Nicolas
+ Grasset]
+
+- Check for nested transactions. [Nicolas Grasset]
+
+- Merge pull request #11 from frewsxcv/patch-2. [Nicolas Grasset]
+
+ Update CHANGELOG 0.3.2 release date
+
+- Update CHANGELOG 0.3.2 release date. [Corey Farwell]
+
+0.3.2 (2015-06-03)
+------------------
+
+- Merge pull request #10 from fellowshipofone/django-18. [Nicolas
+ Grasset]
+
+ Django 1.8 support
+
- Drop support for Django 1.5. [Nicolas Grasset]
- Travis test with MySQL backend. Fixes #7. [Nicolas Grasset]
@@ -11,7 +43,6 @@ Changelog
#7 is not “fixed”, but if the tests pass, I’ll need more details about
the issue
-
- Pkg 0.3.2 change log. [Nicolas Grasset]
- Pkg: Drop test support for Django 1.5. [Nicolas Grasset]
@@ -24,7 +55,6 @@ Changelog
cleaner this way, and it is required for new Django 1.8 tests since
they are nested in atomic blocks
-
- Django 1.8 extra not compatible with TransactionTestCase. [Nicolas
Grasset]
@@ -94,19 +124,16 @@ Other
djcelery_transactions/__init__.py
tests/tests.py
-
- Merge remote-tracking branch 'fellowshipofone/master' [Bryce]
Conflicts:
djcelery_transactions/__init__.py
-
- Merge remote-tracking branch '10to8/master' [Bryce]
Conflicts:
djcelery_transactions/__init__.py
-
- Merge remote-tracking branch 'fladi/asyncresult-not-returned' [U
-CircleUp-Alpha\Bryce]
@@ -140,7 +167,6 @@ Other
Conflicts:
djcelery_transactions/__init__.py
-
- Looks like you only need djcelery to run tests, so install it if
you're going to run tests. But I'd rather not have it installed if we
don't need it. [Peter Sheats]
@@ -187,7 +213,6 @@ Other
djcelery_transactions/__init__.py
djcelery_transactions/transaction_signals.py
-
- Adding Batches subclass. [Nils Lundquist]
- Celery 3.1 compatibility. [Jakub Paczkowski]
@@ -232,7 +257,6 @@ Other
If transactions is not mark as dirty in case of rollback, celery queue is still consumed
-
- Get rid of extra argument after_transaction passed to apply_async.
[Nicolas Delaby]
@@ -244,7 +268,6 @@ Other
Make sure we can follow any changes in transaction API
-
- Assign and return in same time. [Nicolas Delaby]
- Push task to broker in the same order they have appeared. [Nicolas
diff --git a/djcelery_transactions/__init__.py b/djcelery_transactions/__init__.py
index 90b1af9..92bf1db 100644
--- a/djcelery_transactions/__init__.py
+++ b/djcelery_transactions/__init__.py
@@ -129,8 +129,18 @@ def _send_tasks(**kwargs):
management block in which no changes were made (effectively a commit).
"""
+ # Detect test mode through CELERY_ALWAYS_EAGER settings
+ # We assume all celery transactions tests on 1.8+ are running with TestCase, otherwise we'd get atomic exceptions
celery_eager = _get_celery_settings('CELERY_ALWAYS_EAGER')
+ # If we detect higher up nested atomic block, continue
+ connection = get_connection()
+ if django.VERSION >= (1, 8):
+ min_number_transactions = 1 if celery_eager else 0
+ if (not celery_eager and connection.in_atomic_block) or len(connection.savepoint_ids) > min_number_transactions:
+ return
+ elif connection.in_atomic_block:
+ return
queue = _get_task_queue()
while queue:
diff --git a/setup.py b/setup.py
index e393e9b..202bae3 100644
--- a/setup.py
+++ b/setup.py
@@ -7,7 +7,7 @@ from setuptools import setup, Command, find_packages
setup(
name="django-celery-transactions",
- version="0.3.2",
+ version="0.3.5",
description="Django transaction support for Celery tasks.",
long_description="See https://github.com/fellowshipofone/django-celery-transactions",
author="Nicolas Grasset",
diff --git a/tests/test/tests.py b/tests/test/tests.py
index d4689d7..d84fe26 100644
--- a/tests/test/tests.py
+++ b/tests/test/tests.py
@@ -124,3 +124,20 @@ class DjangoCeleryTestCase(TestCaseForTests):
self.assertEqual( Plants.objects.count(), 1)
Trees.objects.create(name='Grey Oak', plant=Plants.objects.get(name='Oak'))
+
+ def test_nested_atomic_blocks(self):
+ """Check that task is consumed only after last transaction
+ """
+
+ @atomic
+ def do_something():
+ my_task.delay()
+ self.assertIsNone(cache.get('my_global'))
+
+ @atomic
+ def do_something_outside():
+ do_something()
+ self.assertIsNone(cache.get('my_global'))
+
+ do_something_outside()
+ self.assertEqual(cache.get('my_global'), 42)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/django-celery-transactions.git
More information about the Python-modules-commits
mailing list