Opened 14 years ago
Closed 14 years ago
#14335 closed (wontfix)
add ability to only test specific apps
Reported by: | Anand Kumria | Owned by: | nobody |
---|---|---|---|
Component: | Testing framework | Version: | 1.2 |
Severity: | Keywords: | need_docs | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Hi,
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
Thanks,
Anand
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:
I'm afraid I don't see why this should be a configuration item for the CI tool, rather than the Django app itself.