[Django] #37128: Include setUpTestData as a way to speed up tests

8 views
Skip to first unread message

Django

unread,
May 29, 2026, 8:55:47 AM (yesterday) May 29
to django-...@googlegroups.com
#37128: Include setUpTestData as a way to speed up tests
-------------------------------------+-------------------------------------
Reporter: Tim Schilling | Type:
| Cleanup/optimization
Status: new | Component:
| Documentation
Version: dev | Severity: Normal
Keywords: testing | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
In Adam Johnson's book "Speed up your Django Tests", there's a section on
using `setUpTestData` to speed up tests. Since we have a section on
[https://docs.djangoproject.com/en/dev/topics/testing/overview/#speeding-
up-the-tests speeding up tests] already, I think we should add this tip to
it. We also mention in docs/topics/testing/tools.txt, that `setUpTestData`
is faster than using `setUp`.
--
Ticket URL: <https://code.djangoproject.com/ticket/37128>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
May 29, 2026, 9:34:35 AM (yesterday) May 29
to django-...@googlegroups.com
#37128: Include setUpTestData as a way to speed up tests
--------------------------------------+------------------------------------
Reporter: Tim Schilling | Owner: (none)
Type: Cleanup/optimization | Status: new
Component: Documentation | Version: dev
Severity: Normal | Resolution:
Keywords: testing | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Jacob Walls):

* stage: Unreviewed => Accepted

Comment:

Sounds good. I also think the `AnimalTestCase` example at the top of that
page should be updated. It's a little debatable, since part of the point
of that section is to demonstrate that `TestCase` is a lightweight
subclass of `unittest.TestCase`, and we'd be immediately showing a custom
method, but we should be able to clarify that with some appropriate
wording.
--
Ticket URL: <https://code.djangoproject.com/ticket/37128#comment:1>

Django

unread,
May 29, 2026, 3:00:56 PM (yesterday) May 29
to django-...@googlegroups.com
#37128: Include setUpTestData as a way to speed up tests
-------------------------------------+-------------------------------------
Reporter: Tim Schilling | Owner: Tim
Type: | Schilling
Cleanup/optimization | Status: assigned
Component: Documentation | Version: dev
Severity: Normal | Resolution:
Keywords: testing | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Schilling):

* owner: (none) => Tim Schilling
* status: new => assigned

--
Ticket URL: <https://code.djangoproject.com/ticket/37128#comment:2>

Django

unread,
May 29, 2026, 3:45:17 PM (yesterday) May 29
to django-...@googlegroups.com
#37128: Include setUpTestData as a way to speed up tests
-------------------------------------+-------------------------------------
Reporter: Tim Schilling | Owner: Tim
Type: | Schilling
Cleanup/optimization | Status: assigned
Component: Documentation | Version: dev
Severity: Normal | Resolution:
Keywords: testing | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Schilling):

* has_patch: 0 => 1

--
Ticket URL: <https://code.djangoproject.com/ticket/37128#comment:3>
Reply all
Reply to author
Forward
0 new messages