add ability to only test specific apps
|Reported by:||wildfire||Owned by:||nobody|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
Some Django applications, e.g. ghettoq, ship with a lot of unittests.
In ghettoq's case, there are a number of backends that can be configured and the tests assume that they all will be.
That is fantastic work on behalf of the ghettoq developers but it can make it hard to integrate into a CI environment.
To overcome this problem, ghetto recommends using a testrunner that they bundle.
In this test runner, the setting TEST_APPS, if found, contains the list of applications to be tested.
Below is a one-liner that allows for this.
It also need an entry in the documentation but I believe this would be a nice win for both Django 1.2 and 1.3
diff --git a/django/test/simple.py b/django/test/simple.py index 9013042..216c85f 100644 --- a/django/test/simple.py +++ b/django/test/simple.py @@ -236,6 +236,8 @@ class DjangoTestSuiteRunner(object): def build_suite(self, test_labels, extra_tests=None, **kwargs): suite = unittest.TestSuite() + test_labels = getattr(settings, "TEST_APPS", test_labels) + if test_labels: for label in test_labels: if '.' in label: