Skip to content

Commit 78c2dc9

Browse files
committed
Merge pull request #315 from zpencerq/master
Add testing for Django 1.2, 1.3 and 1.4 with some fixes.
2 parents f31e4cf + cec28d5 commit 78c2dc9

File tree

5 files changed

+39
-19
lines changed

5 files changed

+39
-19
lines changed

djcelery/picklefield.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
"""
1515
from __future__ import absolute_import, unicode_literals
1616

17-
import django
18-
1917
from base64 import b64encode, b64decode
2018
from zlib import compress, decompress
2119

@@ -35,12 +33,12 @@
3533
NO_DECOMPRESS_HEADER = b'\x1e\x00r8d9qwwerwhA@'
3634

3735

38-
if django.VERSION < (1, 3):
39-
BaseField = models.Field
40-
else:
41-
@with_metaclass(models.SubfieldBase)
42-
class BaseField(models.Field):
43-
pass
36+
@with_metaclass(models.SubfieldBase, skip_attrs=set([
37+
'db_type',
38+
'get_db_prep_save'
39+
]))
40+
class BaseField(models.Field):
41+
pass
4442

4543

4644
class PickledObject(str):

djcelery/tests/test_backends/test_cache.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from datetime import timedelta
66

77
from billiard.einfo import ExceptionInfo
8+
import django
89
from django.core.cache.backends.base import InvalidCacheBackendError
910

1011
from celery import result
@@ -103,8 +104,13 @@ def test_custom_cache_backend(self):
103104
from celery import current_app
104105
prev_backend = current_app.conf.CELERY_CACHE_BACKEND
105106
prev_module = sys.modules['djcelery.backends.cache']
106-
current_app.conf.CELERY_CACHE_BACKEND = \
107-
'django.core.cache.backends.dummy.DummyCache'
107+
108+
if django.VERSION >= (1, 3):
109+
current_app.conf.CELERY_CACHE_BACKEND = \
110+
'django.core.cache.backends.dummy.DummyCache'
111+
else:
112+
# Django 1.2 used 'scheme://' style cache backends
113+
current_app.conf.CELERY_CACHE_BACKEND = 'dummy://'
108114
sys.modules.pop('djcelery.backends.cache')
109115
try:
110116
from djcelery.backends.cache import cache

requirements/test.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,5 @@ coverage>=3.0
33
nose
44
nose-cover3
55
mock
6-
django
76
django-nose
87
python-memcached

tests/urls.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1-
from django.conf.urls import (patterns, url, include, # noqa
2-
handler500, handler404)
1+
try:
2+
from django.conf.urls import (patterns, include, url,
3+
handler500, handler404)
4+
except ImportError:
5+
from django.conf.urls.defaults import (patterns, include, url, # noqa
6+
handler500, handler404)
37
from djcelery.views import apply
48

59
# Uncomment the next two lines to enable the admin:

tox.ini

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[tox]
2-
envlist = py25,py26,py27,py27-1.4.X
2+
envlist = py26,py27,py27-1.4.X,py27-1.3.X,py27-1.2.X
33

44
[testenv]
55
distribute = True
@@ -9,30 +9,43 @@ sitepackages = False
99
basepython = python2.7
1010
deps = -r{toxinidir}/requirements/default.txt
1111
-r{toxinidir}/requirements/test.txt
12+
django
1213
commands = {toxinidir}/extra/release/removepyc.sh {toxinidir}
1314
env TOXINIDIR="{toxinidir}" python setup.py citest
1415

1516
[testenv:py26]
1617
basepython = python2.6
1718
deps = -r{toxinidir}/requirements/default.txt
1819
-r{toxinidir}/requirements/test.txt
20+
django
1921
commands = {toxinidir}/extra/release/removepyc.sh {toxinidir}
2022
env TOXINIDIR="{toxinidir}" python setup.py citest
2123

22-
[testenv:py25]
23-
basepython = python2.5
24+
[testenv:py27-1.4.X]
25+
basepython = python2.7
2426
deps = -r{toxinidir}/requirements/default.txt
2527
-r{toxinidir}/requirements/test.txt
28+
https://github.com/celery/kombu/zipball/master
29+
https://github.com/celery/celery/zipball/master
30+
django>=1.4,<1.5
2631
commands = {toxinidir}/extra/release/removepyc.sh {toxinidir}
2732
env TOXINIDIR="{toxinidir}" python setup.py citest
2833

34+
[testenv:py27-1.3.X]
35+
basepython = python2.7
36+
deps = -r{toxinidir}/requirements/default.txt
37+
-r{toxinidir}/requirements/test.txt
38+
https://github.com/celery/kombu/zipball/master
39+
django>=1.3,<1.4
40+
commands = {toxinidir}/extra/release/removepyc.sh {toxinidir}
41+
env TOXINIDIR="{toxinidir}" python setup.py citest
2942

30-
[testenv:py27-1.4.X]
43+
[testenv:py27-1.2.X]
3144
basepython = python2.7
3245
deps = -r{toxinidir}/requirements/default.txt
3346
-r{toxinidir}/requirements/test.txt
3447
https://github.com/celery/kombu/zipball/master
35-
https://github.com/celery/celery/zipball/master
36-
https://github.com/django/django/zipball/master
48+
django>=1.2,<1.3
3749
commands = {toxinidir}/extra/release/removepyc.sh {toxinidir}
3850
env TOXINIDIR="{toxinidir}" python setup.py citest
51+
rm {toxinidir}/tests/test_djcelery-test-db

0 commit comments

Comments
 (0)