Opened 17 years ago

Last modified 14 years ago

#5624 closed

Add mechanism for associating fixtures with doctests — at Version 1

Reported by: eikke@… 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 Russell Keith-Magee)

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 eikke@…, 17 years ago

Add pre_test signal

comment:1 by Russell Keith-Magee, 17 years ago

Component: UncategorizedUnit test system
Description: modified (diff)
Patch needs improvement: set
Summary: Add pre_test signalAdd mechanism for associating fixtures with doctests
Triage Stage: UnreviewedAccepted

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.

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