#35728: Lazily compute assertion messages
--------------------------------------+------------------------------------
Reporter: Adam Johnson | Owner: (none)
Type: Cleanup/optimization | Status: new
Component: Testing framework | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Natalia Bidart):
* stage: Unreviewed => Accepted
Comment:
Thank you Adam for this ticket and analysis, I agree with your rationale.
I performed a simpler test: I added the proposed testcase in an existing
`tests.py` file, and ran with the usual `python -Wall manage.py test
testapp.tests.ExampleTests`. Then, I replaced `assertContains` with a call
similar to `self.assertIn(text, response.content.decode())`. My timings
are:
* without the replacement, `ExampleTests` runs in about 4 seconds
* with the replacement, `ExampleTests` runs in around a second (0.950s)
Accepting following the above with the note that we should, ideally, be
mindful of potential subclassing of Django's TestCase when designing how
the laziness will be incorported to ensure backwards compatibility.
--
Ticket URL: <https://code.djangoproject.com/ticket/35728#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/01070191b3ac3ffe-1b52896b-bd66-41e3-8813-1b604b7f1625-000000%40eu-central-1.amazonses.com.