Message333787
I'm having a problem with mock.call when I import it directly from unittest.mock.
When I do:
from unittest.mock import patch, mock_open, call
mocked_print.assert_has_calls([
call("first print"),
call("second print"),
])
I get:
C:\Program Files (x86)\Python37-64\lib\doctest.py:932: in find
self._find(tests, obj, name, module, source_lines, globs, {})
C:\Program Files (x86)\Python37-64\lib\doctest.py:991: in _find
if ((inspect.isroutine(inspect.unwrap(val))
C:\Program Files (x86)\Python37-64\lib\inspect.py:515: in unwrap
raise ValueError('wrapper loop when unwrapping {!r}'.format(f))
E ValueError: wrapper loop when unwrapping call
collected 1 item / 1 errors
But when I don't import call directly my test runs as expected:
from unittest.mock import patch, mock_open
import unittest.mock
mocked_print.assert_has_calls([
mock.call(),
mock.call(),
])
I have the same issue when using:
assert mocked_print.call_args_list == [call("first print"), call("second print")] <- ValueError
assert mocked_print.call_args_list == [mock.call("first print"), mock.call("second print")] <- Works as expected. |
|
Date |
User |
Action |
Args |
2019-01-16 20:19:10 | toonarmycaptain | set | recipients:
+ toonarmycaptain |
2019-01-16 20:19:08 | toonarmycaptain | set | messageid: <1547669948.02.0.595479199536.issue35753@roundup.psfhosted.org> |
2019-01-16 20:19:08 | toonarmycaptain | link | issue35753 messages |
2019-01-16 20:19:07 | toonarmycaptain | create | |
|