[Biopython-dev] Python 2.7 failure from test_Tutorial.py, was: Compiling Biopython on 64 bit Windows

Peter Cock p.j.a.cock at googlemail.com
Tue Apr 22 12:57:34 UTC 2014


On Tue, Apr 22, 2014 at 9:32 AM, Peter Cock <p.j.a.cock at googlemail.com> wrote:
> On Tue, Apr 22, 2014 at 6:51 AM, Manlio Calvi <manlio.calvi at gmail.com> wrote:
>> Hi Peter,
>> I just run this one from the Tests folder (the tests are there and
>> don'tget moved in the installation)
>
> Sorry, yes - I should have said that.
>
>> I got this:
>>
>> Running Tutorial doctests...
>> **********************************************************************
>> File "Tests/test_Tutorial.py", line 153, in
>> __main__.TutorialDocTestHolder.doctest_test_from_line_04424
>> Failed example:
>>     align_array.shape
>> Expected:
>>     (7, 52)
>> Got:
>>     (7L, 52L)
>> **********************************************************************
>> 1 items had failures:
>>    1 of   7 in __main__.TutorialDocTestHolder.doctest_test_from_line_04424
>> ***Test Failed*** 1 failures.
>> C:\python27\lib\site-packages\Bio\Motif\__init__.py:26:
>> BiopythonDeprecationWarning: The module Bio.Motif has been deprecated
>> and will be removed in a future release of Biopython. Instead please
>> use the new module Bio.motifs instead. Please be aware that though the
>> functionality of Bio.Motif is retained (and extended) in Bio.motifs,
>> usage may be different.
>>   BiopythonDeprecationWarning)
>> Traceback (most recent call last):
>>   File "Tests/test_Tutorial.py", line 185, in <module>
>> RuntimeError: 1/806 tests failed
>>
>>
>> Another Python2/3 compatibility problem...
>
> Well yes, but also a 32 bit versus 64 bit Windows issue.
> Python 3 hides the C level differences between ints and longs,
> while Python 2 can sometimes expose this - odd that this test
> didn't give longs on the other platforms, just 64 bit windows.
>
> I suggest we switch from:
>
> %This example fails under PyPy 2.0, https://bugs.pypy.org/issue1546
> %doctest examples lib:numpy
> \begin{verbatim}
>>>> import numpy as np
>>>> from Bio import AlignIO
>>>> alignment = AlignIO.read("PF05371_seed.
> sth", "stockholm")
>>>> align_array = np.array([list(rec) for rec in alignment], np.character)
>>>> align_array.shape
> (7, 52)
> \end{verbatim}
>
> To:
>
> %This example fails under PyPy 2.0, https://bugs.pypy.org/issue1546
> %doctest examples lib:numpy
> \begin{verbatim}
>>>> import numpy as np
>>>> from Bio import AlignIO
>>>> alignment = AlignIO.read("PF05371_seed.sth", "stockholm")
>>>> align_array = np.array([list(rec) for rec in alignment], np.character)
>>>> print("Array shape %i by %i" % align_array.shape)
> Array shape 7 by 52
> \end{verbatim}
>
> That should be safe :)
>
> Peter

Change applied to git,
https://github.com/biopython/biopython/commit/0e26dfb40ab1ce78319eaf6893e35abda43c8738

Peter



More information about the Biopython-dev mailing list