[openstack-dev] [python3][mock] time to deprecate unittest.mock use - use mock directly.

Robert Collins robertc at robertcollins.net
Mon Aug 24 22:57:15 UTC 2015


So earlier on in our porting process folk tried several different ways
to get Mock on Python 3.4:

 - using six.moves (this is in oslo.test)
 - patching sys.modules

But - mock 1.0.1 is actually different enough unittest.mock 3.4 to
cause porting issues. So as part of addressing that we've (upstream
cPython / mock developers) revitalised 'mock' as a rolling backport
from cPython master.

So mock 1.3 runs all our 2.7 tests fine - and is tested to given
consisten behaviour on 3.4 and on 2.7.

Thus: if you run into issues with mock porting projects to 3.4, it
probably means that one of the two behaviours above is being
triggered, and you're actually using the 3.4 'unittest.mock'. Don't do
that :). See https://review.openstack.org/216444 for a case of the
second one we're just unwinding now - there may well be others in your
local projects.

Obviously, if you're *actually* using mock and there is a problem, we
can and should fix it :)

-Rob

-- 
Robert Collins <rbtcollins at hp.com>
Distinguished Technologist
HP Converged Cloud



More information about the OpenStack-dev mailing list