classification
Title: Allow passing DocTestRunner and DocTestCase in doctest
Type: enhancement Stage: test needed
Components: Library (Lib) Versions: Python 3.4
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: Kostyantyn.Leschenko, asvetlov, chris.jerdonek, collinwinter, freakboy, freakboy3742, jasonamyers
Priority: normal Keywords: easy, patch

Created on 2006-07-12 08:47 by freakboy, last changed 2014-02-03 17:04 by BreamoreBoy.

Files
File name Uploaded Description Edit
doctest-configuration.diff freakboy, 2006-07-12 08:47 Patch to allow extra customization of DocTestSuite
doctest-configuration-1.diff Kostyantyn.Leschenko, 2013-04-07 13:08 review
test.patch jasonamyers, 2013-07-28 02:39
Messages (8)
msg50676 - (view) Author: Russell Keith-Magee (freakboy) Date: 2006-07-12 08:47
DocTestRunner can be modified by end users to override
default testing behaviour when executing doctests. 

Similarly, DocTestCase can be extended to override
default setup/teardown behaviour. 

However, when a DocTestSuite is used to discover
doctests, it is not possible to specify a user-modified
Runner or TestCase.

This patch (against svn revision 46884 of
Lib/doctest.py) enables end users to specify the class
that is used to construct DocTest test cases, and the
runner that is used to run DocTest test cases. 

By default, DocTestSuite will continue to instantiate
DocTestRunner and DocTestCase instances as before. 
msg50677 - (view) Author: Collin Winter (collinwinter) * (Python committer) Date: 2007-03-07 20:08
This looks good to me. Could you add some tests (to Lib/test/test_doctest.py) and update the docs (Doc/lib/libdoctest.tex)?

Thanks for your contribution!
msg116170 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2010-09-12 11:01
The patch appears to be way out of date.  Is there any interest in the concept of this patch, has something similar already been done or what?
msg116222 - (view) Author: Russell Keith-Magee (freakboy3742) Date: 2010-09-12 17:42
It's still a problem AFAICT. Level of interest is a different matter.

Django has needed this since 2006, so we've always shipped a locally modified copy of the doctest module. 

That said, Django is in the process of moving away from using and recommending doctests, so there's a good chance that we'll be deprecating our local copy in the near future. 

There's still value in the idea -- it provides configuration points that are consistent and reasonable -- but Django's need for this set of changes is waning.
msg170529 - (view) Author: Chris Jerdonek (chris.jerdonek) * (Python committer) Date: 2012-09-15 20:00
I think this would be useful as well.  For example, it would let one more easily get finer-grained test result data (e.g. to the level of doctest examples rather than just the TestCase level).  Without this, I needed to monkey patch.

The previously attached patch enhances DocTestSuite.  I think DocFileSuite should receive the same treatment (the case I was more interested in myself -- cf. http://bugs.python.org/issue15629#msg170447 ).
msg186204 - (view) Author: Kostyantyn Leschenko (Kostyantyn.Leschenko) Date: 2013-04-07 13:08
I've updated patch to work with current trunk and added new params to doctest documentation.
msg186577 - (view) Author: Andrew Svetlov (asvetlov) * (Python committer) Date: 2013-04-11 18:43
I like the patch but please add tests also.
We need to put new behavior in stone :)
Take a look on comments to the patch also.
msg193803 - (view) Author: Jason Myers (jasonamyers) Date: 2013-07-28 02:39
The attached file contains a simple test for this code to make sure the test runner is being applied.  I've never submitted anything before, so it might be totally naive.
History
Date User Action Args
2014-02-03 17:04:41BreamoreBoysetnosy: - BreamoreBoy
2013-07-28 02:39:11jasonamyerssetfiles: + test.patch
nosy: + jasonamyers
messages: + msg193803

2013-04-11 18:43:43asvetlovsetmessages: + msg186577
2013-04-07 13:08:01Kostyantyn.Leschenkosetfiles: + doctest-configuration-1.diff
nosy: + Kostyantyn.Leschenko
messages: + msg186204

2013-04-07 10:41:06asvetlovsetnosy: + asvetlov
2012-09-15 20:00:15chris.jerdoneksetnosy: + chris.jerdonek
title: Extra configurability for doctest TestCases -> Allow passing DocTestRunner and DocTestCase in doctest
messages: + msg170529

versions: + Python 3.4, - Python 3.2
2010-09-12 17:42:16freakboy3742setnosy: + freakboy3742
messages: + msg116222
2010-09-12 11:01:53BreamoreBoysetnosy: + BreamoreBoy
messages: + msg116170
2010-08-09 03:35:29terry.reedysetversions: + Python 3.2, - Python 3.1, Python 2.7
2009-03-30 05:05:54ajaksu2setkeywords: + easy
stage: test needed
type: enhancement
versions: + Python 3.1, Python 2.7, - Python 2.5
2006-07-12 08:47:04freakboycreate