Skip to content

Runaway memory consumption when mock.call in namespace #1217

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jaraco opened this issue Dec 2, 2015 · 4 comments
Closed

Runaway memory consumption when mock.call in namespace #1217

jaraco opened this issue Dec 2, 2015 · 4 comments
Assignees

Comments

@jaraco
Copy link
Contributor

jaraco commented Dec 2, 2015

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.

@The-Compiler
Copy link
Member

FWIW, someone in the #python IRC channel just reported the same, but it only happens when additionally using --cov (pytest-cov) for them.

@pstch
Copy link

pstch commented Feb 18, 2016

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.

@The-Compiler
Copy link
Member

Looks like this is a Python bug: http://bugs.python.org/issue25532

@jaraco
Copy link
Contributor Author

jaraco commented Mar 21, 2018

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

keflavich added a commit to keflavich/spectral-cube that referenced this issue Nov 30, 2018
the internet that claim this was a python-core issue that was (maybe?)
fixed.  However, it is actually impossible for this to be a python issue
alone, it has to be something in py.test also, since we didn't encounter
it at all for years.

pytest-dev/pytest#1217
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants