[Python-Dev] Unittest/doctest formatting differences in 2.7a1?

Michael Foord fuzzyman at voidspace.org.uk
Wed Dec 9 19:09:26 CET 2009


On 09/12/2009 18:02, exarkun at twistedmatrix.com wrote:
> On 05:11 pm, lregebro at jarn.com wrote:
>> On Wed, Dec 9, 2009 at 17:34, Michael Foord 
>> <fuzzyman at voidspace.org.uk> wrote:
>>> Can you be more specific?
>>
>> Only with an insane amount of work. I'll hold that off for a while.
>
> I don't know if this is related at all (and I guess we won't until 
> Lennart can be more specific :), but here are some Twisted unit test 
> failures which are probably due to unittest changes in 2.7:
>
> =============================================================================== 
>
> [FAIL]: twisted.trial.test.test_loader.LoaderTest.test_sortCases
>
> Traceback (most recent call last):
>  File 
> "/home/buildslave/pybot/trunk.glass-x86/build/Twisted/twisted/trial/test/test_loader.py", 
> line 167, in test_sortCases
>    [test._testMethodName for test in suite._tests])
> twisted.trial.unittest.FailTest: not equal:
> a = ['test_b', 'test_c', 'test_a']
> b = ['test_c', 'test_b', 'test_a']
>

Is the order significant? Can you just compare sorted versions of the 
lists instead?

If the order *is* significant I would be interested to know which change 
caused this.

> =============================================================================== 
>
> [FAIL]: twisted.trial.test.test_loader.ZipLoadingTest.test_sortCases
>
> Traceback (most recent call last):
>  File 
> "/home/buildslave/pybot/trunk.glass-x86/build/Twisted/twisted/trial/test/test_loader.py", 
> line 167, in test_sortCases
>    [test._testMethodName for test in suite._tests])
> twisted.trial.unittest.FailTest: not equal:
> a = ['test_b', 'test_c', 'test_a']
> b = ['test_c', 'test_b', 'test_a']

Ditto.

>
> =============================================================================== 
>
> [FAIL]: twisted.trial.test.test_tests.TestSkipMethods.test_reasons
>
> Traceback (most recent call last):
>  File 
> "/home/buildslave/pybot/trunk.glass-x86/build/Twisted/twisted/trial/test/test_tests.py", 
> line 143, in test_reasons
>    str(reason))
> twisted.trial.unittest.FailTest: not equal:
> a = 'skip1 (twisted.trial.test.test_tests.SkippingTests)'
> b = 'skip1'
>
> =============================================================================== 
>
> [FAIL]: twisted.trial.test.test_class.AttributeSharing.test_shared
>
> Traceback (most recent call last):
>  File 
> "/home/buildslave/pybot/trunk.glass-x86/build/Twisted/twisted/trial/test/test_class.py", 
> line 131, in test_shared
>    'test_2')
> twisted.trial.unittest.FailTest: not equal:
> a = 'test_2 (twisted.trial.test.test_class.ClassAttributeSharer)'
> b = 'test_2'
>

These two test failures are due to the change in repr of something I 
guess? Is a or b the original output?


> =============================================================================== 
>
>
> I'm not opposed to the improvement of unittest (or any part of 
> Python). Perhaps more of the improvements can be provided in new APIs 
> rather than by changing the behavior of existing APIs, though.

Well, introducing lots of new APIs has its own problems of course. 
Hearing about difficulties changes cause is good though (the reason for 
alphas I guess) and if it is possible to work out why things are broken 
then maybe we can still have the new functionality without the breakage.

The problem with Lennart's report is that it is just "things are broken" 
without much clue. I am sympathetic to this (working out *exactly* what 
is broken in someone else's code can be a painful chore) but I'm not 
sure what can be done about it without more detail.

All the best,

Michael

>
> Jean-Paul


-- 
http://www.ironpythoninaction.com/
http://www.voidspace.org.uk/blog




More information about the Python-Dev mailing list