#5624: Add mechanism for associating fixtures with doctests
-------------------------------+--------------------------------------------
Reporter: [EMAIL PROTECTED] | Owner: nobody
Status: new | Component: Unit test system
Version: SVN | Resolution:
Keywords: | Stage: Accepted
Has_patch: 1 | Needs_docs: 0
Needs_tests: 0 | Needs_better_patch: 1
-------------------------------+--------------------------------------------
Changes (by russellm):
* needs_better_patch: => 1
* component: Uncategorized => Unit test system
* needs_tests: => 0
* summary: Add pre_test signal => Add mechanism for associating fixtures
with doctests
* needs_docs: => 0
* stage: Unreviewed => Accepted
Old description:
> As #5608 was rejected but in our setup we'd still like to be able to load
> test data in the test database, without polluting the actual doctests
> (which are mostly used for example/documentation purposes), I went
> another route and created a new signal, similar to post_syncdb. It's
> called pre_test and is sent after test database creation, before tests
> are run. This way it is possible to do some pre-test setup in application
> management modules (I eg use it to run call_command to loaddata some
> test_data fixture).
New description:
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.
Comment:
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.
--
Ticket URL: <http://code.djangoproject.com/ticket/5624#comment:1>
Django Code <http://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 post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---