Opened 14 years ago

Closed 12 years ago

#13873 closed New feature (duplicate)

Provide an explicit setting to skip tests for INSTALLED_APPS

Reported by: Lakin Wecker Owned by: nobody
Component: Testing framework Version: dev
Severity: Normal Keywords:
Cc: claude@…, magma.chambers@…, mmitar@…, kitsunde@…, kkumler Triage Stage: Design decision needed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

When developing an application that depends on thirdparty django libraries, be it apps in contrib, or libraries like south or treebeard, you rarely want to run their tests as part of your normal testing routine. The latest treebeard library has somewhere around 600 tests! And although it's great that it has such extensive tests (yay tabo!) - I rarely want to run them as part of my testing routine. Rather than having to explicitly specify all of my apps everytime I test, a setting that explicitly asks for certain apps to be skipped it much nicer.

I'm attaching a patch that implements just such a setting. The patch has an implementation, tests and updates the documentation.

The patch was made against r13409 - although I marked this as part of SVN - it would be awesome to see this released in the current releases - of course, I realize that may not be possible.

Attachments (1)

TEST_SKIP_APP_TESTS.diff (4.1 KB ) - added by Lakin Wecker 14 years ago.
TEST_SKIP_APP_TESTS setting

Download all attachments as: .zip

Change History (16)

by Lakin Wecker, 14 years ago

Attachment: TEST_SKIP_APP_TESTS.diff added

TEST_SKIP_APP_TESTS setting

comment:1 by Łukasz Rekucki, 14 years ago

Triage Stage: UnreviewedDesign decision needed

comment:2 by Piotr Czachur, 14 years ago

I completely agree with lakinwecker - it's a need for every Django project I'm in.

comment:3 by Graham King, 14 years ago

Severity: Normal
Type: New feature

comment:4 by Claude Paroz, 13 years ago

Cc: claude@… added
Easy pickings: unset
UI/UX: unset

+1 for this setting.

I read Luke's post, but I think that running python manage.py test to just test the appropriate apps in your project would be so much appreciated. Having to write wrappers or custom Test runners for all of my apps is just too cumbersome in my opinion. Because of that, my current (bad) practice is to run tests for a specific app only. Too often I find myself forgetting to run some other app's tests.

comment:5 by Julien Phalip, 13 years ago

More than once I've found myself wishing there were an --exclude=<app_name> option to the test command, as it is commonly available to a few other commands like dumpdata (https://docs.djangoproject.com/en/dev/ref/django-admin/#django-admin-option---exclude). Indeed, in many cases I find it's easier to remember the few tests that you want to exclude than the many tests that you want to include. So, I think more versatility for the test command would also be welcome as part of this ticket.

in reply to:  5 comment:6 by Ramiro Morales, 13 years ago

Replying to julien:

More than once I've found myself wishing there were an --exclude=<app_name> option to the test command, as it is commonly available to a few other commands like dumpdata (https://docs.djangoproject.com/en/dev/ref/django-admin/#django-admin-option---exclude). Indeed, in many cases I find it's easier to remember the few tests that you want to exclude than the many tests that you want to include. So, I think more versatility for the test command would also be welcome as part of this ticket.

#8363 is related to that. AFAIK unfortunately this only can be implemented for the runtests.py script, not for the test management command (see ticket:8363#comment:11)

in reply to:  5 comment:7 by Claude Paroz, 13 years ago

Replying to julien:

More than once I've found myself wishing there were an --exclude=<app_name> option to the test command, (...)

Sure, but I still favour the setting, to avoid such things like python manage.py test --exclude "django.contrib.auth" --exclude "django.contrib.contenttypes" --exclude "django.contrib.sessions" --exclude "django.contrib.sites" --exclude "south" --exclude "mptt" ...

comment:8 by Chris Chambers, 13 years ago

Cc: magma.chambers@… added

comment:9 by Chris Chambers, 13 years ago

For anyone needing a temporary workaround for this issue, http://djangosnippets.org/snippets/2211/ is useful (note that the setting for excluding apps is TEST_EXCLUDE = [app1, app2]).

comment:10 by Mitar, 13 years ago

Cc: mmitar@… added

comment:11 by Mitar, 13 years ago

I like the AdvancedTestSuiteRunner approach.

comment:12 by Carl Meyer, 13 years ago

#17365 is related.

comment:13 by Kit Sunde, 13 years ago

Cc: kitsunde@… added

comment:14 by kkumler, 13 years ago

Cc: kkumler added

comment:15 by Aymeric Augustin, 12 years ago

Resolution: duplicate
Status: newclosed

I belive #17365 is the correct answer here, even if it isn't exactly what this ticket asks for.

The long term goal is to deprecate Django's custom test runner, not to extend it.

(Carl, feel free to reopen if you disagree).

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