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

Peter Stachowski peter at tesora.com
Mon May 16 16:40:50 UTC 2016


Victor,

You're right, all the tests are currently passing the detector.  There is still legacy code that does unmocking the 'old' way and there is a fair bit of it.  Our concern if you remove the detector is that objects that have been mocked might not be unmocked correctly (due to copy/paste) and we might miss it in review.  The detector won't miss it, and so we don't have to worry about it.

We could fix all the old tests, but (as I said) it was agreed upon that that would not be productive and might even destabilize the code base, so it wasn't done.  At the moment the detector is still doing a useful job and I don't think we can get rid of it just yet.

Peter


-----Original Message-----
From: Victor Stinner [mailto:vstinner at redhat.com] 
Sent: May-16-16 12:10 PM
To: OpenStack Development Mailing List (not for usage questions)
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?

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