1

When I have doctest enabled and import call I get this exception:

/usr/lib/python3.6/doctest.py:933: in find
    self._find(tests, obj, name, module, source_lines, globs, {})
/usr/lib/python3.6/doctest.py:992: in _find
    if ((inspect.isroutine(inspect.unwrap(val))
/usr/lib/python3.6/inspect.py:516: in unwrap
    raise ValueError('wrapper loop when unwrapping {!r}'.format(f))
E   ValueError: wrapper loop when unwrapping call

Call imported like this:

from unittest.mock import MagicMock, call

I looked at this question ValueError: wrapper loop when unwrapping. Rewriting __getattr__ does not look like a clean solution for me.

I import and use call differently, as a workaround, which helps:

from unittest import mock

...
mock.call(1)
...

I wonder are there any better/cleaner options to solve the problem?

Alexander Pushkarev
  • 1,075
  • 6
  • 19

0 Answers0