commit:     919a19fb17521df84f592cf4a7227edf88b2ba76
Author:     Ian Delaney <idella4 <AT> gentoo <DOT> org>
AuthorDate: Tue Oct 27 09:53:43 2015 +0000
Commit:     Ian Delaney <idella4 <AT> gentoo <DOT> org>
CommitDate: Tue Oct 27 09:54:08 2015 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=919a19fb

dev-python/django-celery: patch to fix broken tests

patch from upstream submitted via the gentoo bug and runtested
by 'wraeth', drop py3.3 support, add missed PYTHON_REQ_USE value
for sqlite, set required bordering to django subsequent to
runtesting, fixes the gentoo bug

Gentoo bug: #564250

Package-Manager: portage-2.2.23

 .../django-celery/django-celery-3.1.16.ebuild      | 14 ++++++--
 .../django-celery-3.1.16-py3-test-failures.patch   | 39 ++++++++++++++++++++++
 2 files changed, 50 insertions(+), 3 deletions(-)

diff --git a/dev-python/django-celery/django-celery-3.1.16.ebuild 
b/dev-python/django-celery/django-celery-3.1.16.ebuild
index 44b6fe2..872f74f 100644
--- a/dev-python/django-celery/django-celery-3.1.16.ebuild
+++ b/dev-python/django-celery/django-celery-3.1.16.ebuild
@@ -3,9 +3,10 @@
 # $Id$
 
 EAPI=5
-PYTHON_COMPAT=( python{2_7,3_3,3_4} )
+PYTHON_COMPAT=( python{2_7,3_4} )
+PYTHON_REQ_USE="sqlite(+)"
 
-inherit distutils-r1
+inherit distutils-r1 eutils
 
 DESCRIPTION="Celery Integration for Django"
 HOMEPAGE="http://celeryproject.org/";
@@ -16,9 +17,14 @@ SLOT="0"
 KEYWORDS="amd64 x86"
 IUSE="doc examples test"
 
+# Python testsuite fails when built against dev-python/django-1.8.5
+# with ValueError: save() prohibited to prevent data loss due to
+# unsaved related object 'interval'.
+
 PY2_USEDEP=$(python_gen_usedep python2_7)
 RDEPEND=">=dev-python/celery-3.1.15[${PYTHON_USEDEP}]
-       dev-python/django[${PYTHON_USEDEP}]
+       >dev-python/django-1.4[${PYTHON_USEDEP}]
+       <=dev-python/django-1.7.10[${PYTHON_USEDEP}]
        dev-python/pytz[${PYTHON_USEDEP}]"
 DEPEND="${RDEPEND}
        dev-python/setuptools[${PYTHON_USEDEP}]
@@ -37,6 +43,8 @@ PY27_REQUSE="$(python_gen_useflags 'python2.7')"
 REQUIRED_USE="
        doc? ( ${PY27_REQUSE} )"
 
+PATCHES=( "${FILESDIR}/${P}-py3-test-failures.patch" )
+
 python_compile_all() {
        use doc && emake -C docs html
 }

diff --git 
a/dev-python/django-celery/files/django-celery-3.1.16-py3-test-failures.patch 
b/dev-python/django-celery/files/django-celery-3.1.16-py3-test-failures.patch
new file mode 100644
index 0000000..4b44b66
--- /dev/null
+++ 
b/dev-python/django-celery/files/django-celery-3.1.16-py3-test-failures.patch
@@ -0,0 +1,39 @@
+https://github.com/brianmay/django-celery/commit/8c4449f2a1b65f16eb405ecb3a2ef98ea7a8bf4f
+diff --git a/djcelery/loaders.py b/djcelery/loaders.py
+index c86455a..61c6d04 100644
+--- a/djcelery/loaders.py
++++ b/djcelery/loaders.py
+# Patch to fix failing tests test_list_registered_tasks and
+# test_apply with python3. Patch sourced from upstream
+# https://github.com/celery/django-celery/issues/342
+@@ -201,7 +201,8 @@ def find_related_module(app, related_name):
+         return
+
+     try:
+-        imp.find_module(related_name, app_path)
++        file, _, _ = imp.find_module(related_name, app_path)
++        file.close()
+     except ImportError:
+         return
+
+diff --git a/djcelery/views.py b/djcelery/views.py
+index 34cb307..4d07e0a 100644
+--- a/djcelery/views.py
++++ b/djcelery/views.py
+@@ -34,7 +34,7 @@ def task_view(task):
+         kwargs = kwdict(request.method == 'POST' and
+                         request.POST or request.GET)
+         # no multivalue
+-        kwargs = dict(((k, v) for k, v in kwargs.iteritems()), **options)
++        kwargs = dict(((k, v) for k, v in kwargs.items()), **options)
+         result = task.apply_async(kwargs=kwargs)
+         return JsonResponse({'ok': 'true', 'task_id': result.task_id})
+
+@@ -78,8 +78,8 @@ def task_status(request, task_id):
+
+ def registered_tasks(request):
+     """View returning all defined tasks as a JSON object."""
+-    return JsonResponse({'regular': tasks.regular().keys(),
+-                         'periodic': tasks.periodic().keys()})
++    return JsonResponse({'regular': list(tasks.regular().keys()),
++                         'periodic': list(tasks.periodic().keys())})

Reply via email to