[openstack-dev] [all][tests] Fix it friday! [mock failure in CI]

Robert Collins robertc at robertcollins.net
Tue Jul 14 19:10:14 UTC 2015


On 13 July 2015 at 13:04, Dave McCowan (dmccowan) <dmccowan at cisco.com> wrote:
> Has anyone else seen this error with the new mock?
>
>     'self' parameter lacking default value
>
>
> My function under test runs correctly, but then Mock throws this TypeError
> when comparing the parameters in assert_calls_with().
>
> I'm seeing this in Barbican.  More info below [1][2].
>
> --Dave
>
> [1] Complete backtrace
> ======================================================================
> FAIL:
> barbican.tests.plugin.test_kmip.WhenTestingKMIPSecretStore.test_store_passp
> hrase_secret_assert_called
> ----------------------------------------------------------------------
> _StringException: Traceback (most recent call last):
>   File "/Users/dmccowan/barbican/barbican/tests/plugin/test_kmip.py", line
> 432, in test_store_passphrase_secret_assert_called
>     credential=self.credential)
>   File
> "/Users/dmccowan/.pyenv/versions/barb278/lib/python2.7/site-packages/mock/m
> ock.py", line 941, in assert_called_once_with
>     return self.assert_called_with(*args, **kwargs)
>   File
> "/Users/dmccowan/.pyenv/versions/barb278/lib/python2.7/site-packages/mock/m
> ock.py", line 930, in assert_called_with
>     six.raise_from(AssertionError(_error_message(cause)), cause)
>   File
> "/Users/dmccowan/.pyenv/versions/barb278/lib/python2.7/site-packages/six.py
> ", line 692, in raise_from
>     raise value
> AssertionError: Expected call: mock(credential=Struct(),
> object_type=<ObjectType.SECRET_DATA: 7>, secret=<ANY>,
> template_attribute=<ANY>)
> Actual call: mock(credential=Struct(),
> object_type=<ObjectType.SECRET_DATA: 7>, secret=Struct(),
> template_attribute=Struct())
> 'self' parameter lacking default value

Please see if this is a problem in python 3.5's unittest.mock. If it
is: file it in the Python bug tracker (and +nosy me there
[rbcollins]). If its not a problem in python 3.5's unittest.mock, then
file it in the mock bug tracker, and I'll figure out why its behaving
differently.

Cheers,
Rob



-- 
Robert Collins <rbtcollins at hp.com>
Distinguished Technologist
HP Converged Cloud



More information about the OpenStack-dev mailing list