Im experiencing a very strange issue with mock>=1.1 which causes mock call assertion to fail in one of my projects:
1) FAIL: test_map_node_expression (tests.test_mapper.TestMapperBase)
Traceback (most recent call last):
/Volumes/Data/Users/miki725/.virtualenvs/simplepath/lib/python3.4/site-packages/mock/mock.py line 1299 in patched
return func(*args, **keywargs)
tests/test_mapper.py line 365 in test_map_node_expression
context=mock_get_lookup_context.return_value,
/Volumes/Data/Users/miki725/.virtualenvs/simplepath/lib/python3.4/site-packages/mock/mock.py line 942 in assert_called_once_with
return self.assert_called_with(*args, **kwargs)
/Volumes/Data/Users/miki725/.virtualenvs/simplepath/lib/python3.4/site-packages/mock/mock.py line 931 in assert_called_with
six.raise_from(AssertionError(_error_message(cause)), cause)
<string> line 2 in raise_from
AssertionError: Expected call: mock(sentinel.data, context=<MagicMock name='get_lookup_context()' id='4486874112'>, lut=sentinel.lut, super_root=sentinel.root)
Actual call: mock(sentinel.data, context=<MagicMock name='get_lookup_context()' id='4486874112'>, lut=sentinel.lut, super_root=sentinel.root)
If you take a look at the assertion error, both calls are actually identical so the mock somehow cant detect that even though it prints identical mock calls in the assertion message.
Test passes perfectly on mock==1.0.x versions but something in mock>=1.1.x causes the test to fail. I tried to replicate the bug by using a dummy example however so far have not been successful. Due to that I cant produce a simple test case which could be included in mock test suite itself and so Ill try to provide all the information I can here and hopefully somebody can either spot what Im doing wrong or confirm the validity of a bug in mock itself.
In order to illustrate the issue better, I setup two branches (below are links to their PRs) in my project:
lists - my feature branch where mock is pinned to 1.0.1 and all tests pass
mock - branch where I pinned mock to 1.1.3 which causes same tests to fail both locally and in travis.
You can in open mock->lists PR that the only difference is the mock version makes me believe that mock might contain a bug.
Here are corresponding travis jobs for both branches (links to Py3 build however same happens on Py2 as well):
For convenience here are relevant links to code:
Any ideas?
Let me know if you will need any additional information to debug this further.
PS. I had similar results when trying to use Python3 built-in unittest.mock.
Im experiencing a very strange issue with
mock>=1.1which causes mock call assertion to fail in one of my projects:If you take a look at the assertion error, both calls are actually identical so the mock somehow cant detect that even though it prints identical mock calls in the assertion message.
Test passes perfectly on
mock==1.0.xversions but something inmock>=1.1.xcauses the test to fail. I tried to replicate the bug by using a dummy example however so far have not been successful. Due to that I cant produce a simple test case which could be included in mock test suite itself and so Ill try to provide all the information I can here and hopefully somebody can either spot what Im doing wrong or confirm the validity of a bug in mock itself.In order to illustrate the issue better, I setup two branches (below are links to their PRs) in my project:
lists- my feature branch where mock is pinned to1.0.1and all tests passmock- branch where I pinned mock to1.1.3which causes same tests to fail both locally and in travis.You can in open mock->lists PR that the only difference is the mock version makes me believe that mock might contain a bug.
Here are corresponding travis jobs for both branches (links to Py3 build however same happens on Py2 as well):
lists- tests passmock- tests failFor convenience here are relevant links to code:
Any ideas?
Let me know if you will need any additional information to debug this further.
PS. I had similar results when trying to use Python3 built-in
unittest.mock.