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)
Change History (16)
by , 14 years ago
Attachment: | TEST_SKIP_APP_TESTS.diff added |
---|
comment:1 by , 14 years ago
Triage Stage: | Unreviewed → Design decision needed |
---|
This ticket was briefly discussed in this thread: http://groups.google.com/group/django-developers/browse_frm/thread/ad1b508b879c2e68/27ed8a78c0acaf84?#27ed8a78c0acaf84
comment:2 by , 14 years ago
I completely agree with lakinwecker - it's a need for every Django project I'm in.
comment:3 by , 14 years ago
Severity: | → Normal |
---|---|
Type: | → New feature |
comment:4 by , 13 years ago
Cc: | 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.
follow-ups: 6 7 comment:5 by , 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.
comment:6 by , 13 years ago
Replying to julien:
More than once I've found myself wishing there were an
--exclude=<app_name>
option to thetest
command, as it is commonly available to a few other commands likedumpdata
(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 thetest
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 by , 13 years ago
Replying to julien:
More than once I've found myself wishing there were an
--exclude=<app_name>
option to thetest
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 , 13 years ago
Cc: | added |
---|
comment:9 by , 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 , 13 years ago
Cc: | added |
---|
comment:13 by , 13 years ago
Cc: | added |
---|
comment:14 by , 12 years ago
Cc: | added |
---|
comment:15 by , 12 years ago
Resolution: | → duplicate |
---|---|
Status: | new → closed |
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).
TEST_SKIP_APP_TESTS setting