Opened 5 years ago

Closed 5 years ago

#14335 closed (wontfix)

add ability to only test specific apps

Reported by: wildfire 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: UI/UX:

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:

Change History (1)

comment:1 Changed 5 years ago by russellm

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to wontfix
  • Status changed from new to closed

I'm afraid I don't see why this should be a configuration item for the CI tool, rather than the Django app itself.

Note: See TracTickets for help on using tickets.
Back to Top