Help with unittest2

Boris FELD lothiraldan at gmail.com
Thu Dec 13 16:48:13 CET 2012


How are you importing unittest2, do you have something like this ?

try:
  import unittest2 as unittest
except ImportError:
  import unittest

If it's the case, you are maybe using default unittest while you think
you are using unittest2.

2012/12/13 Daniel Laird <daniel.j.laird at googlemail.com>:
> On Thursday, December 13, 2012 3:09:58 PM UTC, Miki Tebeka wrote:
>> On Thursday, December 13, 2012 7:03:27 AM UTC-8, Daniel Laird wrote:
>>
>> > I do am import unittest2 as unittest
>>
>> > NameError: global name 'assertListEqual' is not defined
>>
>> According to the docs (http://docs.python.org/2/library/unittest.html#unittest.TestCase.addTypeEqualityFunc) assertListEqual and friends was added in 2.7.
>>
>>
>>
>> You can use assertEuqal, or if you don't care about order assertEqual(sorted(a), sorted(b)).
>
> Thanks, however I thought by using unittest2 it added the new 2.7 features to 2.6?
> --
> http://mail.python.org/mailman/listinfo/python-list



More information about the Python-list mailing list