diff -r 394e6bda5a70 Lib/doctest.py --- a/Lib/doctest.py Sun Jun 29 15:56:21 2014 +0300 +++ b/Lib/doctest.py Thu Jul 03 13:18:22 2014 +0300 @@ -984,7 +984,8 @@ for valname, val in obj.__dict__.items(): valname = '%s.%s' % (name, valname) # Recurse to functions & classes. - if ((inspect.isroutine(val) or inspect.isclass(val)) and + if ((inspect.isroutine(inspect.unwrap(val)) + or inspect.isclass(val)) and self._from_module(module, val)): self._find(tests, val, valname, module, source_lines, globs, seen) diff -r 394e6bda5a70 Lib/test/test_doctest.py --- a/Lib/test/test_doctest.py Sun Jun 29 15:56:21 2014 +0300 +++ b/Lib/test/test_doctest.py Thu Jul 03 13:18:22 2014 +0300 @@ -6,6 +6,7 @@ import doctest import os import sys +import functools # NOTE: There are some additional tests relating to interaction with @@ -434,7 +435,7 @@ >>> tests = finder.find(sample_func) >>> print(tests) # doctest: +ELLIPSIS - [] + [] The exact name depends on how test_doctest was invoked, so allow for leading path components. @@ -2364,6 +2365,22 @@ foo \n """ +class Wrapper: + def __init__(self, func): + self.func = func + functools.update_wrapper(self, func) + + def __call__(self, *args, **kwargs): + self.func(*args, **kwargs) + +@Wrapper +def test_look_in_unwrapped(): + """ + Docstrings in wrapped functions must be detected as well. + + >>> 'one other test' + 'one other test' + """ def test_unittest_reportflags(): """Default unittest reporting flags can be set to control reporting