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)
Change History (16)
Changed 13 years ago by
Attachment: | TEST_SKIP_APP_TESTS.diff added |
---|
comment:1 Changed 13 years ago by
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 Changed 13 years ago by
I completely agree with lakinwecker - it's a need for every Django project I'm in.
comment:3 Changed 12 years ago by
Severity: | → Normal |
---|---|
Type: | → New feature |
comment:4 Changed 12 years ago by
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 follow-ups: 6 7 Changed 12 years ago by
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 Changed 12 years ago by
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 Changed 12 years ago by
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 Changed 12 years ago by
Cc: | magma.chambers@… added |
---|
comment:9 Changed 12 years ago by
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
Cc: | mmitar@… added |
---|
comment:13 Changed 12 years ago by
Cc: | kitsunde@… added |
---|
comment:14 Changed 11 years ago by
Cc: | kkumler added |
---|
comment:15 Changed 11 years ago by
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