Opened 17 years ago
Last modified 14 years ago
#5624 closed
Add mechanism for associating fixtures with doctests — at Version 1
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | Testing framework | Version: | dev |
Severity: | Keywords: | ||
Cc: | Triage Stage: | Accepted | |
Has patch: | no | Needs documentation: | yes |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
It would be useful to be able to associate fixtures with a doctest without the need to add fixture loading code to the doctest.
Ref #5608 for a previously rejected proposal.
Change History (2)
by , 17 years ago
Attachment: | 0001-Add-pre_test-signal.patch added |
---|
comment:1 by , 17 years ago
Component: | Uncategorized → Unit test system |
---|---|
Description: | modified (diff) |
Patch needs improvement: | set |
Summary: | Add pre_test signal → Add mechanism for associating fixtures with doctests |
Triage Stage: | Unreviewed → Accepted |
The pre-test signal approach in the patch is no better than the appropach proposed in #5608. Test fixtures are applicable on a _per test_ basis.
However, I can accept the general use case you describe. I agree that it would be nice to be able to associate fixtures with a doctest without the need to insert the applicable code at the start of the test. I've modified the summary and description to reflect the underlying feature request, rather than the specific solution.
If you're looking at how to implement this, I would suggest looking at associating a fixtures attribute with the docstring itself, and modifying the Django doctest runner to look for the fixtures attribute.
Add pre_test signal