[openstack-dev] Testtools usage?
mordred at inaugust.com
Thu Jan 24 23:54:12 UTC 2013
On 01/25/2013 09:49 AM, Joshua Harlow wrote:
> Ok, so would just having testtools use unittest2 work better?
Ah. Hrm. Looping in Robert.
> Or have it at least optionally use? Then u can just use the method which
> exists in 2.7 assertDictEquals() (not another method/matcher?).
> I believe what happened in keystone client is that they started using
> testtools, but didn't use said matcher, and then somehow the py2.6 ci
> passed (unsure how that happened) and then code landed that had
> Perhaps at least there can be a twiki or 'proxy methods' that explains
> what to do for these kinds of things for testtools?
We should definitely have a wiki page...
> I can just see people using the built-in methods, assuming they are there
> (they are there in 2.7), then realizing that said method doesn't work on
> py 2.6.
> On 1/24/13 1:39 PM, "Monty Taylor" <mordred at inaugust.com> wrote:
>> On 01/25/2013 08:17 AM, Joshua Harlow wrote:
>>> Hi all,
>>> Just was investigating some odd test failures,
>>> Looking at some of the other components code (keystone) it uses
>>> unittest2 to take the py2.7 backport and import it as 'unittest' (a
>>> confusing rename).
>>> It seems like there is a move to testtools, but testtools.TestCase
>>> doesn't seem to derive from unittest2 (it uses unittest.TestCase) so
>>> this means that functions that previously existed before the switch to
>>> testtools won't exist in python 2.6, have other openstack sub-projects
>>> that have been moving to testtools fixed this, or perhaps there should
>>> be a upstream fix for testtools to attempt to derive its testcase class
>>> from unittest2?
>> Yup. Keystone was actually next on my list to port to testtools. :)
>>> Wondering how others py2.6 support hasn't been busted.
>> In porting nova, I made use of the testtools matchers functionality and
>> self.assertThat. testtools.matchers.MatchesDict is, I believe, equiv to
>> unittest2's assertDictEqual. Additionally, in nova we made a DictEqual
>> matcher (crappy name, sorry) which does a deep match. We should probably
>> port that up into testtools itself.
>> OpenStack-dev mailing list
>> OpenStack-dev at lists.openstack.org
More information about the OpenStack-dev