[openstack-dev] [all][tests] Fix it friday! [mock failure in CI]
Ihar Hrachyshka
ihrachys at redhat.com
Fri Jul 10 22:14:38 UTC 2015
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
OK, we got 1.1.1 released today, and now gate is broken in some other wa
y:
"ImportError: No module named funcsigs"
Apparently there is a missing dependency, or it fails to apply, in the
package. I see jobs failing with it, as well as my local tox environment
s:
http://logs.openstack.org/54/200654/1/gate/gate-neutron-python27/38a0a2c
/console.html
On 07/10/2015 09: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_eng
ine_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.
>
> We can probably pin mock back to 1.0.1 locally within projects to
> gain breathing room, but given the API improvements in 1.1.0 (see
> below[1] as readthedocs is failing to build it due to having an old
> pip in their virtualenvs :/) - I think we'll be much better off
> adopting it as quickly as we can. NB: with this release we don't
> need to use 'unittest.mock' for Python3.4 - we can just standardise
> on using 'mock' across the board, which is much simpler and easier
> to reason about (same codebase everywhere[2])
>
> [2]: Python 2.6 support was dropped in 1.1.0, so we need to use
> markers to select 1.0.1 for the remaining 2.6 gate jobs. (We
> should kill those of asap). [1]: - Issue #23310: Fix MagicMock's
> initializer to work with __methods__, just like configure_mock().
> Patch by Kasia Jachim.
>
> - Issue #23568: Add rdivmod support to MagicMock() objects. Patch
> by Håkan Lövdahl.
>
> - Issue #23581: Add matmul support to MagicMock. Patch by Håkan
> Lövdahl.
>
> - Issue #23326: Removed __ne__ implementations. Since fixing
> default __ne__ implementation in issue #21408 they are redundant.
> *** NOT BACKPORTED ***
>
> - Issue #21270: We now override tuple methods in mock.call objects
> so that they can be used as normal call attributes.
>
> - Issue #21256: Printout of keyword args should be in deterministic
> order in a mock function call. This will help to write better
> doctests.
>
> - Issue #21262: New method assert_not_called for Mock. It raises
> AssertionError if the mock has been called.
>
> - Issue #21238: New keyword argument `unsafe` to Mock. It raises
> `AttributeError` incase of an attribute startswith assert or
> assret.
>
> - Issue #21239: patch.stopall() didn't work deterministically when
> the same name was patched more than once.
>
> - Issue #21222: Passing name keyword argument to
> mock.create_autospec now works.
>
> - Issue #17826: setting an iterable side_effect on a mock function
> created by create_autospec now works. Patch by Kushal Das.
>
> - Issue #17826: setting an iterable side_effect on a mock function
> created by create_autospec now works. Patch by Kushal Das.
>
> - Issue #20968: unittest.mock.MagicMock now supports division.
> Patch by Johannes Baiter.
>
> - Issue #20189: unittest.mock now no longer assumes that any object
> for which it could get an inspect.Signature is a callable written
> in Python. Fix courtesy of Michael Foord.
>
> - Issue #17467: add readline and readlines support to mock_open in
> unittest.mock.
>
> - Issue #17015: When it has a spec, a Mock object now inspects its
> signature when matching calls, so that arguments can be matched
> positionally or by name.
>
> - Issue #15323: improve failure message of
> Mock.assert_called_once_with
>
> - Issue #14857: fix regression in references to PEP 3135 implicit
> __class__ closure variable (Reopens issue #12370)
>
> - Issue #14295: Add unittest.mock
>
>
> -Rob
>
>
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
iQEcBAEBCAAGBQJVoEPMAAoJEC5aWaUY1u57+2QH/08O3nuWb0KbONPwmNguYOz4
kW0l28snuvVIiUNDR8wZ5y9g2FGJOhZepAfYd+ufdbQJ74qJLRVt5DAcOjditvh7
O/2GMtKUQbRVOr0ktcfGnncN/VMWsd33secuc3Vj1vREaZDIZpoznpXAZ12bRYuP
xiyffLsKnAbWqJWTsVouJ3wVX9Wqmz/87gLIYJBI8mVufN44BE0X1+NqzVcRa2Sg
uSCux08ziI73kWX/Qqt9RMyokHsf2mwclN9lZ6ONEk2vou+o13zyVI3wlzbV+wfc
LXAdBRZQJZ07VntexyOfp+ddEzdmCrU2ZQWzkLedYQjVVfy+R3BxDzpsjBrTCUs=
=RvYx
-----END PGP SIGNATURE-----
More information about the OpenStack-dev
mailing list