This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Unsupported provider

classification
Title: change doctest DocTestSuite not to raise ValueError if no docstrings
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.4
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: Glenn.Jones, asvetlov, chris.jerdonek, ezio.melotti, petri.lehtinen, python-dev, r.david.murray, tuukka
Priority: normal Keywords: easy, patch

Created on 2012-09-10 23:54 by chris.jerdonek, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
issue15916.patch tuukka, 2012-10-23 12:04 review
issue15916-no-exception.patch Glenn.Jones, 2014-04-14 18:07 review
issue15916-with-docs.patch Glenn.Jones, 2014-04-14 21:00 review
Messages (8)
msg170250 - (view) Author: Chris Jerdonek (chris.jerdonek) * (Python committer) Date: 2012-09-10 23:54
Currently, calling doctest.DocTestSuite() raises a ValueError if the module passed to it has no docstrings.  This was the subject of issue 14649.

This issue is to discuss and possibly change DocTestSuite's behavior not to raise an exception in that situation.

In the discussion for issue 14649 (in particular with R. David Murray), it was acknowledged that the current behavior probably isn't correct or desirable.  However, treating the behavior as a bug and fixing it in maintenance branches would have been too big of a change.

Thus, if this change is made, it could be slated for the next feature release.
msg173597 - (view) Author: Tuukka Hastrup (tuukka) Date: 2012-10-23 12:04
I'm attaching a patch that changes DocTestSuite's default behaviour as suggested.
msg173632 - (view) Author: Chris Jerdonek (chris.jerdonek) * (Python committer) Date: 2012-10-23 18:53
Hmm.  This patch still raises the "has no docstrings" ValueError if "not tests" is True.  And because the patch changes the default DocTestFinder, it's possible that the patch changes behavior in non-error use cases.

Why not just return an empty TestSuite if not tests is True?  IIRC, this was the conclusion of the issue 14649 discussion.
msg216145 - (view) Author: Glenn Jones (Glenn.Jones) * Date: 2014-04-14 18:07
I've attached a patch that uses the original default DocTestFinder and does not raise an exception when there are no tests.
msg216169 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2014-04-14 18:49
This looks good, however we also need a documentation change indicating the new behavior, including a '.. versionchanged:: 3.5' tag, and an entry in whatsnew/3.5 in the 'other changes' section.
msg216211 - (view) Author: Glenn Jones (Glenn.Jones) * Date: 2014-04-14 21:00
Added docs to patch
msg216255 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014-04-15 00:29
New changeset 57fb5441a4aa by R David Murray in branch 'default':
#15916: if there are no docstrings, make empty suite, not an error.
http://hg.python.org/cpython/rev/57fb5441a4aa
msg216256 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2014-04-15 00:29
Thanks, Glenn.
History
Date User Action Args
2022-04-11 14:57:35adminsetgithub: 60120
2014-04-15 00:29:46r.david.murraysetstatus: open -> closed
resolution: fixed
messages: + msg216256

stage: resolved
2014-04-15 00:29:04python-devsetnosy: + python-dev
messages: + msg216255
2014-04-14 21:00:05Glenn.Jonessetfiles: + issue15916-with-docs.patch

messages: + msg216211
2014-04-14 18:49:51r.david.murraysetmessages: + msg216169
2014-04-14 18:07:20Glenn.Jonessetfiles: + issue15916-no-exception.patch
nosy: + Glenn.Jones
messages: + msg216145

2014-04-14 16:20:36r.david.murraysetmessages: - msg174146
2014-04-14 16:20:27r.david.murraysetmessages: - msg174145
2012-10-29 19:39:20petri.lehtinensetmessages: + msg174146
2012-10-29 19:38:44petri.lehtinensetnosy: + petri.lehtinen
messages: + msg174145
2012-10-24 20:45:36ezio.melottisetnosy: + ezio.melotti
2012-10-23 18:53:57chris.jerdoneksetmessages: + msg173632
2012-10-23 12:04:01tuukkasetfiles: + issue15916.patch

nosy: + tuukka
messages: + msg173597

keywords: + patch
2012-09-10 23:54:54chris.jerdonekcreate