[openstack-dev] [trove] timeouts in gate-trove-python34-db

Amrith Kumar amrith at tesora.com
Mon May 16 16:39:45 UTC 2016



> -----Original Message-----
> From: Victor Stinner [mailto:vstinner at redhat.com]
> Sent: Monday, May 16, 2016 12:10 PM
> To: OpenStack Development Mailing List (not for usage questions)
> <openstack-dev at lists.openstack.org>
> Subject: Re: [openstack-dev] [trove] timeouts in gate-trove-python34-db
> 
> Le 16/05/2016 16:12, Peter Stachowski a écrit :
> > We're aware that there are ways to mock (and un-mock) correctly.
> > We're trying to make sure that all our new test code follows those
> > patterns.  We also decided that it wouldn't make sense to change all
> > the working tests to use the 'right' methods as that could have the
> > short-term effect of destabilizing the tests considerably (plus it
> > would be a fair bit of effort with very little actual gain). As a
> > compromise we added this code to check that things weren't left
> > mocked (just in case someone copy-pasted the old style, did it wrong
> > and no-one noticed - we're still trying to maintain consistency
> > wherever possible).
> 
> Thanks for the explanation. But I don't understand something.
> 
> The purpose of the code detecting dangling mocks is to find bugs in
> "legacy" tests which don't use correctly the mock module. I read the
> code and I saw that it makes the unit test failing in such case. All
> unit tests pass on Python 2. Does it mean that all the legacy code is
> gone and all unit tests use correctly the mock module?
> 
> If I'm wrong, how can we detect remaining "dangling mocks"? Would it be
> possible to fix them at once to be able to remove the code detecting
> dangling mocks?
> 

[amrith] Not being flippant but this is analogous to saying that the tests in python27 now pass, so why not just remove the tests. That'd speed the thing up a lot!

The reason this code remains is that we keep adding tests and from time to time someone adds a test that does something that leaves a dangling mock. And they can find it if they run tox. Even if they don't the gate will. That's the reason we have tests, to ensure that they continue to pass.

> I proposed a patch to remove the code detecting dangling mocks: it makes
> unit tests 13x faster on Python 3 (183.6 sec => 13.8 sec):
> 
>     https://review.openstack.org/#/c/316955/
> 
> Victor
> 
> __________________________________________________________________________
> OpenStack Development Mailing List (not for usage questions)
> Unsubscribe: OpenStack-dev-request at lists.openstack.org?subject:unsubscribe
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev



More information about the OpenStack-dev mailing list