Opened 2 hours ago

Last modified 82 minutes ago

#37128 new Cleanup/optimization

Include setUpTestData as a way to speed up tests

Reported by: Tim Schilling Owned by:
Component: Documentation Version: dev
Severity: Normal Keywords: testing
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

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 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.

Change History (1)

comment:1 by Jacob Walls, 82 minutes ago

Triage Stage: UnreviewedAccepted

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.

Note: See TracTickets for help on using tickets.
Back to Top