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.

classification
Title: unittest: no way to control verbosity of doctests from cmd
Type: behavior Stage: resolved
Components: Documentation, Tests Versions: Python 3.4, Python 3.5, Python 2.7
process
Status: closed Resolution: duplicate
Dependencies: Superseder: [doc] TextTestRunner documentation improvements
View: 11385
Assigned To: Nosy List: docs@python, michael.foord, techtonik, terry.reedy
Priority: normal Keywords:

Created on 2011-03-03 19:57 by techtonik, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (5)
msg130001 - (view) Author: anatoly techtonik (techtonik) Date: 2011-03-03 19:57
I can't find a way to execute DocTests contained in a separate README.txt file using unittest.main() function. That doesn't allow to control verbosity for debugging.

I am doing it this way in the tests.py

import doctest
import unittest
if __name__ == '__main__':
  runner = unittest.TextTestRunner()
  runner.run(doctest.DocFileSuite('README.txt',
    optionflags=doctest.ELLIPSIS))


I could find a way to subclass TestLoader.loadTestsFromNames() by looking at the source code of undocumented TestProgram. I'd like to see this use case at least covered by documentation if not properly developed for stdlib of Python4.
msg130091 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2011-03-05 00:11
The undocumented verbosity parameter?
msg130092 - (view) Author: Michael Foord (michael.foord) * (Python committer) Date: 2011-03-05 00:15
If the verbosity parameter isn't sufficient (which needs documenting but that is issue 11385) then it would need to be a feature request on DocFileSuite (part of doctest).
msg130178 - (view) Author: anatoly techtonik (techtonik) Date: 2011-03-06 16:26
I need to execute doctests along with unit tests from test suite contained in tests.py file and control verbosity parameter in case something goes wrong.
msg130180 - (view) Author: Michael Foord (michael.foord) * (Python committer) Date: 2011-03-06 16:44
Anatoly, does the verbosity parameter work for you? If not then any feature request / change needs to be for the DocFileSuite as the information is coming from there rather than unittest itself.
History
Date User Action Args
2022-04-11 14:57:13adminsetgithub: 55598
2014-07-02 22:41:57terry.reedysetstatus: open -> closed
superseder: [doc] TextTestRunner documentation improvements
resolution: duplicate
stage: resolved
2014-06-27 20:56:05BreamoreBoysettype: behavior
versions: + Python 2.7, Python 3.4, Python 3.5, - Python 3.3
2011-03-06 16:44:47michael.foordsetassignee: docs@python ->
versions: + Python 3.3
messages: + msg130180
nosy: terry.reedy, techtonik, michael.foord, docs@python
2011-03-06 16:26:35techtoniksetnosy: terry.reedy, techtonik, michael.foord, docs@python
messages: + msg130178
2011-03-05 00:15:35michael.foordsetnosy: terry.reedy, techtonik, michael.foord, docs@python
messages: + msg130092
2011-03-05 00:11:27terry.reedysetnosy: + terry.reedy, michael.foord
messages: + msg130091
2011-03-03 19:57:24techtonikcreate