Permalink
Browse files

Fix #76: Made the test runner compatible with Django 1.4

  • Loading branch information...
1 parent 8a5104a commit 7c3951f54fa0961aac97a0860de373f73663d401 @jonashaag jonashaag committed Sep 25, 2011
Showing with 10 additions and 10 deletions.
  1. +2 −2 FAQ
  2. +7 −7 djcelery/contrib/test_runner.py
  3. +1 −1 docs/cookbook/unit-testing.rst
View
4 FAQ
@@ -63,7 +63,7 @@ To use this test runner, add the following to your ``settings.py``:
.. code-block:: python
- TEST_RUNNER = "djcelery.tests.runners.run_tests",
+ TEST_RUNNER = "djcelery.tests.runners.CeleryTestSuiteRunner",
TEST_APPS = (
"app1",
"app2",
@@ -76,6 +76,6 @@ Or, if you just want to skip the celery tests:
.. code-block:: python
INSTALLED_APPS = (.....)
- TEST_RUNNER = "djcelery.tests.runners.run_tests",
+ TEST_RUNNER = "djcelery.tests.runners.CeleryTestSuiteRunner",
TEST_APPS = filter(lambda k: k != "celery", INSTALLED_APPS)
@@ -1,21 +1,21 @@
from django.conf import settings
-from django.test.simple import run_tests as run_tests_orig
+from django.test.simple import DjangoTestSuiteRunner
USAGE = """\
Custom test runner to allow testing of celery delayed tasks.
"""
-
-def run_tests(test_labels, *args, **kwargs):
+class CeleryTestSuiteRunner(DjangoTestSuiteRunner):
"""Django test runner allowing testing of celery delayed tasks.
All tasks are run locally, not in a worker.
To use this runner set ``settings.TEST_RUNNER``::
- TEST_RUNNER = "celery.contrib.test_runner.run_tests"
+ TEST_RUNNER = "celery.contrib.test_runner.CeleryTestSuiteRunner"
"""
- settings.CELERY_ALWAYS_EAGER = True
- settings.CELERY_EAGER_PROPAGATES_EXCEPTIONS = True # Issue #75
- return run_tests_orig(test_labels, *args, **kwargs)
+ def setup_test_environment(self, **kwargs):
+ super(CeleryTestSuiteRunner, self).setup_test_environment(**kwargs)
+ settings.CELERY_ALWAYS_EAGER = True
+ settings.CELERY_EAGER_PROPAGATES_EXCEPTIONS = True # Issue #75
@@ -34,7 +34,7 @@ To enable the test runner, set the following settings:
.. code-block:: python
- TEST_RUNNER = 'djcelery.contrib.test_runner.run_tests'
+ TEST_RUNNER = 'djcelery.contrib.test_runner.CeleryTestSuiteRunner'
Then we can put the tests in a ``tests.py`` somewhere:

0 comments on commit 7c3951f

Please sign in to comment.