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.

Author xtreak
Recipients Thomas Hisch, pablogsal, ppperry, toonarmycaptain, xtreak
Date 2019-05-26.17:54:02
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1558893242.33.0.365931968013.issue35753@roundup.psfhosted.org>
In-reply-to
Content
> The actual bug appears to be "doctest can't run on a module that contains un-unwrappable objects"

Is it the below example scenario being discussed in the issue? Since call is imported it's also present in obj.__dict__ and hence trying to unwrap it [0] could cause error.

This is also mentioned in https://bugs.python.org/issue25532#msg253885 against which this issue was closed. 

> This can occur when you use doctest.DocTestSuite to load doc tests from a module where unittest.mock.call has been imported.

# bpo35753.py
from unittest.mock import call

./python.exe -m doctest bpo35753.py
Traceback (most recent call last):
  File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/runpy.py", line 192, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/doctest.py", line 2785, in <module>
    sys.exit(_test())
  File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/doctest.py", line 2775, in _test
    failures, _ = testmod(m, verbose=verbose, optionflags=options)
  File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/doctest.py", line 1947, in testmod
    for test in finder.find(m, name, globs=globs, extraglobs=extraglobs):
  File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/doctest.py", line 932, in find
    self._find(tests, obj, name, module, source_lines, globs, {})
  File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/doctest.py", line 991, in _find
    if ((inspect.isroutine(inspect.unwrap(val))
  File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/inspect.py", line 524, in unwrap
    raise ValueError('wrapper loop when unwrapping {!r}'.format(f))
ValueError: wrapper loop when unwrapping call


[0] https://github.com/python/cpython/blob/aaf47caf35984e614d93bd8bea5227df55e0e3e6/Lib/doctest.py#L991
History
Date User Action Args
2019-05-26 17:54:02xtreaksetrecipients: + xtreak, ppperry, pablogsal, toonarmycaptain, Thomas Hisch
2019-05-26 17:54:02xtreaksetmessageid: <1558893242.33.0.365931968013.issue35753@roundup.psfhosted.org>
2019-05-26 17:54:02xtreaklinkissue35753 messages
2019-05-26 17:54:02xtreakcreate