| Submitter | Dirk Wallenstein |
|---|---|
| Date | Feb. 16, 2011, 6:41 p.m. |
| Message ID | <20110216184130.GA15714@zap> |
| Download | mbox | patch |
| Permalink | /patch/83387/ |
| State | Accepted |
| Commit | a58f40ea0478d226df88a68e5fade090842a2663 |
| Headers | show |
Comments
Thanks, Dirk, that works great! On Wed, 2011-02-16 at 19:41 +0100, Dirk Wallenstein wrote: > Django does not use suite() when executing single tests. Importing all > tests directly into __init__.py has the same effect as the replaced > version of suite(). > > Signed-off-by: Dirk Wallenstein <halsmit@t-online.de> > --- > The missing support is in django.test.simple.build_test. I've had this > in my queue but wanted to look for a reason for the missing support. I > think I have read it somewhere, that it is on purpose. > > apps/patchwork/tests/__init__.py | 19 +++++-------------- > 1 files changed, 5 insertions(+), 14 deletions(-) > > diff --git a/apps/patchwork/tests/__init__.py b/apps/patchwork/tests/__init__.py > index 5ec3923..57e15cd 100644 > --- a/apps/patchwork/tests/__init__.py > +++ b/apps/patchwork/tests/__init__.py > @@ -17,17 +17,8 @@ > # along with Patchwork; if not, write to the Free Software > # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA > > -import unittest > -from patchwork.tests import patchparser, encodings, bundles, mboxviews, updates > - > -modules = [patchparser, encodings, bundles, mboxviews, updates] > - > -def suite(): > - suite = unittest.TestSuite() > - loader = unittest.TestLoader() > - > - for module in modules: > - tests = loader.loadTestsFromModule(module) > - suite.addTests(tests) > - > - return suite > +from patchwork.tests.patchparser import * > +from patchwork.tests.encodings import * > +from patchwork.tests.bundles import * > +from patchwork.tests.mboxviews import * > +from patchwork.tests.updates import *
Hi Dirk, > Django does not use suite() when executing single tests. Importing all > tests directly into __init__.py has the same effect as the replaced > version of suite(). Oh awesome, been meaning to do this for ages. Applied. Jeremy
Patch
diff --git a/apps/patchwork/tests/__init__.py b/apps/patchwork/tests/__init__.py index 5ec3923..57e15cd 100644 --- a/apps/patchwork/tests/__init__.py +++ b/apps/patchwork/tests/__init__.py @@ -17,17 +17,8 @@ # along with Patchwork; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -import unittest -from patchwork.tests import patchparser, encodings, bundles, mboxviews, updates - -modules = [patchparser, encodings, bundles, mboxviews, updates] - -def suite(): - suite = unittest.TestSuite() - loader = unittest.TestLoader() - - for module in modules: - tests = loader.loadTestsFromModule(module) - suite.addTests(tests) - - return suite +from patchwork.tests.patchparser import * +from patchwork.tests.encodings import * +from patchwork.tests.bundles import * +from patchwork.tests.mboxviews import * +from patchwork.tests.updates import *
Django does not use suite() when executing single tests. Importing all tests directly into __init__.py has the same effect as the replaced version of suite(). Signed-off-by: Dirk Wallenstein <halsmit@t-online.de> --- The missing support is in django.test.simple.build_test. I've had this in my queue but wanted to look for a reason for the missing support. I think I have read it somewhere, that it is on purpose. apps/patchwork/tests/__init__.py | 19 +++++-------------- 1 files changed, 5 insertions(+), 14 deletions(-)