diff -r 2fbba6d68b94 Doc/library/doctest.rst --- a/Doc/library/doctest.rst Tue Apr 01 10:17:08 2014 -0400 +++ b/Doc/library/doctest.rst Tue Apr 01 19:14:19 2014 +0200 @@ -922,7 +922,8 @@ .. function:: run_docstring_examples(f, globs, verbose=False, name="NoName", compileflags=None, optionflags=0) Test examples associated with object *f*; for example, *f* may be a module, - function, or class object. + function, or class object and return a list of + ``TestResults(failed, attempted)`` named tuples. A shallow copy of dictionary argument *globs* is used for the execution context. @@ -938,6 +939,8 @@ Optional argument *optionflags* works as for function :func:`testfile` above. + .. versionchanged:: 3.5 return a list of ``TestResults(failed, attempted)`` + named tuples. .. _doctest-unittest-api: diff -r 2fbba6d68b94 Lib/doctest.py --- a/Lib/doctest.py Tue Apr 01 10:17:08 2014 -0400 +++ b/Lib/doctest.py Tue Apr 01 19:14:19 2014 +0200 @@ -2097,8 +2097,12 @@ # Find, parse, and run all tests in the given module. finder = DocTestFinder(verbose=verbose, recurse=False) runner = DocTestRunner(verbose=verbose, optionflags=optionflags) + results = [] for test in finder.find(f, name, globs=globs): - runner.run(test, compileflags=compileflags) + res = runner.run(test, compileflags=compileflags) + results.append(res) + return results + ###################################################################### ## 7. Unittest Support