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

Sean Dague sean at dague.net
Fri Jul 10 10:28:18 UTC 2015

On 07/10/2015 03:45 AM, Robert Collins wrote:
> Good news everybody, mock 1.1.0 is now out. This backports all the
> improvements over the last couple of years, making it fully
> synchronised with cPython master. Yay.
> Bad news. Lots of unit tests jobs have suffered falled from this.
> But - none of the things I've looked into so far are bugs in mock 1.1.0.
> One of the improvements in mock is to fail when a bad method is called.
> Consider this: https://review.openstack.org/#/c/200384/1/taskflow/tests/unit/test_engine_helpers.py
> Note the old method: mock_import.assert_called_onec_with(name)
> That method never existed. onec is a typo :).
> mock 1.0.1 silently accepts that - thats part of its job. But, its a
> very fragile API.
> 1.1.0 makes that an error, for methods with assert prefixes - unless
> unsafe is specifically requested. So a big chunk of the failing tests
> are tests that were not testing anything *at all*.
> One common exampled of that is 'assert_called' - another method that
> never ever existed. All our tests using that were testing nothing at
> all.
> Neutron is failing on a bunch of tests that accessed a private
> function inside mock. I'm surprised reviewers didn't spot this, but
> _patch isn't part of the public API, and never was.
> Tempest seems to be failing due to a different object being returned -
> I haven't dug deep enough to describe the cause in more detail.

The Tempest fix is here - https://review.openstack.org/#/c/200449/ and
was pretty straight forward. It was another one of those assert_*
doesn't exist issues. I just approved it though.


Sean Dague

More information about the OpenStack-dev mailing list