Consider this simple test case:
$ cat > test_foo.py
from unittest.mock import call
Then run py.test --doctest-modules and py.test will consume all memory until killed by the OS, but only on Python 3.5. Not importing call into the namespace works around the issue.
This issue was first encountered in pmxbot 42.
FWIW, someone in the #python IRC channel just reported the same, but it only happens when additionally using --cov (pytest-cov) for them.
I'm that guy on the #python IRC channel, and --cov was actually not related, this was a mistake (I thought it was related because I saw long parts of coverage in traceback when I ^C the process).
So I'm hitting the same problem, and am able to reproduce it the same way as OP.
I'd be glad to help, not sure where to start.
Looks like this is a Python bug: http://bugs.python.org/issue25532
Now with the fix in place for Python, this issue produces this error during collection:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ ERROR collecting vr/agent/tests/test_publisher.py โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/doctest.py:932: in find
self._find(tests, obj, name, module, source_lines, globs, {})
/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/doctest.py:991: in _find
if ((inspect.isroutine(inspect.unwrap(val))
/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/inspect.py:515: in unwrap
raise ValueError('wrapper loop when unwrapping {!r}'.format(f))
E ValueError: wrapper loop when unwrapping call
Most helpful comment
Now with the fix in place for Python, this issue produces this error during collection: