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.
Note:
See TracTickets
for help on using tickets.
Sounds good. I also think the
AnimalTestCaseexample 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 thatTestCaseis a lightweight subclass ofunittest.TestCase, and we'd be immediately showing a custom method, but we should be able to clarify that with some appropriate wording.