[Biopython-dev] Failure in test_Phylo; `format_branchlength` parameter to NewickIO writers.

Peter Cock p.j.a.cock at googlemail.com
Fri Jun 17 05:22:02 UTC 2011


On Fri, Jun 17, 2011 at 5:18 AM, Eric Talevich wrote:
> On Thu, Jun 16, 2011 at 3:15 PM, Peter Cock wrote:
>>
>> FAIL: Custom format string for Newick branch length serialization.
>> ----------------------------------------------------------------------
>> Traceback (most recent call last):
>>  File "c:\repositories\BuildBot\win25\build\Tests\test_Phylo.py",
>> line 52, in test_format_branch_length
>>    self.assertEqual(mem_file.getvalue().strip(), 'A:1e-01;')
>> AssertionError: 'A:1e-001;' != 'A:1e-01;'
>>
>> ----------------------------------------------------------------------
>>
>
> Urgh. This is only occurring on Windows in Py2.5, not on 2.6? I suppose
> these platform-specific differences have been ironed out over time in
> Python.

Indeed. Probably something at the C API level from the OS.

> To make the test work on Win+Py2.5, which of these do you prefer?
>
> (a) change the test to
> assert_(memfile.getvalue().lstrip().startswith('A:1e-'))

Well,  use the self.assertTrue(...) method rather than assert_?

> (b) Test for the Python version, and if less than 2.6, do the same test as
> (a), but also include an angry note about Windows compatibility in earlier
> Python versions.

That might be fragile depending on how the Python was compiled -
not everyone uses the supplied binaries from Python.org after all.

How about using this, with a comment to explain the variation:

self.assertTrue(memfile.getvalue().lstrip() in ['A:1e-001;', 'A:1e-01;'])

Note we can't use self.assertIn(a, b) since that requires Python 2.7

>
> Thanks for spotting this,
>

That's what the buildbot is for :)

Peter




More information about the Biopython-dev mailing list