Code

Opened 4 years ago

Closed 13 months ago

#13873 closed New feature (duplicate)

Provide an explicit setting to skip tests for INSTALLED_APPS

Reported by: lakinwecker Owned by: nobody
Component: Testing framework Version: master
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 lakinwecker 4 years ago.
TEST_SKIP_APP_TESTS setting

Download all attachments as: .zip

Change History (16)

Changed 4 years ago by lakinwecker

TEST_SKIP_APP_TESTS setting

comment:1 Changed 4 years ago by lrekucki

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Design decision needed

comment:2 Changed 3 years ago by zimnyx

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

comment:3 Changed 3 years ago by graham_king

  • Severity set to Normal
  • Type set to New feature

comment:4 Changed 3 years ago by claudep

  • 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: Changed 3 years ago by 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.

comment:6 in reply to: ↑ 5 Changed 3 years ago by ramiro

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 3 years ago by claudep

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 3 years ago by chrischambers

  • Cc magma.chambers@… added

comment:9 Changed 3 years ago by chrischambers

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 2 years ago by mitar

  • Cc mmitar@… added

comment:11 Changed 2 years ago by mitar

I like the AdvancedTestSuiteRunner approach.

comment:12 Changed 2 years ago by carljm

#17365 is related.

comment:13 Changed 2 years ago by kitsunde

  • Cc kitsunde@… added

comment:14 Changed 2 years ago by kkumler

  • Cc kkumler added

comment:15 Changed 13 months ago by aaugustin

  • Resolution set to duplicate
  • Status changed from new to 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).

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.