[openstack-dev] Please use 'unittest2', not 'unittest' everywhere.
robertc at robertcollins.net
Wed Apr 15 02:03:24 UTC 2015
On 15 April 2015 at 01:11, Sylvain Bauza <sbauza at redhat.com> wrote:
> Le 14/04/2015 14:49, Alexis Lee a écrit :
>> Robert Collins said on Thu, Apr 09, 2015 at 11:26:28AM +1200:
>>> Neutron was using 'unittest', but we depend on the fixes in cPython
>>> 3.5, which are backported in unittest2. We should not use 'unittest'
>>> itself anywhere in OpenStack, only 'unittest2'.
>> Can this be a hacking check or similar, to prevent regression?
> Maybe a stupid question, but why not considering testtools for inheriting ?
This has nothing to do with inheriting - nor with 'TestCase' classes.
The testtools API is not a superset of unittest: its more like a venn
diagram. There are things we add in testtools, things we remove, and
things that we just don't have anything to do with - such as test
discovery, where its all been upstreamed into the cPython stdlib
unittest (and thence from there into unittest2.
Of course, where testtools offers further enhancements on any given
unittest API, we should use them here, as we use it extensively:).
But for the cases where the thing needed isn't part of the testtools
API - (such as direct use of a TestLoader), using 'unittest' is wrong,
'unittest2' is right.
@Joshua - inheriting from testtools.TestCase is entirely appropriate
:). But see above :)
Robert Collins <rbtcollins at hp.com>
HP Converged Cloud
More information about the OpenStack-dev