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

Victor Stinner vstinner at redhat.com
Mon May 16 16:09:40 UTC 2016


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



More information about the OpenStack-dev mailing list