Opened 13 years ago

Closed 11 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 13 years ago.
TEST_SKIP_APP_TESTS setting

Download all attachments as: .zip

Change History (16)

Changed 13 years ago by Lakin Wecker

Attachment: TEST_SKIP_APP_TESTS.diff added

TEST_SKIP_APP_TESTS setting

comment:1 Changed 13 years ago by Łukasz Rekucki

Triage Stage: UnreviewedDesign decision needed

comment:2 Changed 13 years ago by Piotr Czachur

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

comment:3 Changed 12 years ago by Graham King

Severity: Normal
Type: New feature

comment:4 Changed 12 years ago by Claude Paroz

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 Changed 12 years ago by Julien Phalip

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.

comment:6 in reply to:  5 Changed 12 years ago by Ramiro Morales

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)

comment:7 in reply to:  5 Changed 12 years ago by Claude Paroz

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 Changed 12 years ago by Chris Chambers

Cc: magma.chambers@… added

comment:9 Changed 12 years ago by Chris Chambers

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 Changed 12 years ago by Mitar

Cc: mmitar@… added

comment:11 Changed 12 years ago by Mitar

I like the AdvancedTestSuiteRunner approach.

comment:12 Changed 12 years ago by Carl Meyer

#17365 is related.

comment:13 Changed 12 years ago by Kit Sunde

Cc: kitsunde@… added

comment:14 Changed 11 years ago by kkumler

Cc: kkumler added

comment:15 Changed 11 years ago by Aymeric Augustin

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