[Biopython-dev] Win7 x64 - python 3.4 - Phylo and searchIO

Wibowo Arindrarto bow at bow.web.id
Wed Apr 23 21:09:27 UTC 2014


Hi Peter, Manlio,

Thanks for looking deeper into the tests :). For the SearchIO issue,
I'm not too fond of relaxing the filter, as that could mean the test
passes even though warnings for this particular case is never raised.

After checking more, I actually found that this isn't due to the
global warning filter settings. Apparently, the 'U' file read mode is
deprecated in Python 3.4[1] and SearchIO is using the 'rU' mode to
open its files. So the number of warnings in Python 3.4 is indeed 2:
the rU DeprecationWarning and the BiopythonParserWarning we are
checking.

Since it looks like we can't remove 'rU' altogether from our codebase,
the more appropriate fix for this case would be to check for len(w) == 2 when
Python version is >= 3.4.

Best,
Bow

[1] https://docs.python.org/3.5/whatsnew/3.4.html#deprecated-3-4

On Wed, Apr 23, 2014 at 6:51 AM, Manlio Calvi <manlio.calvi at gmail.com> wrote:
> Ops a bit of overzealousness here, yesterday night was a bit tired and
> I preferred to be sure than skip an issue.
> However the second one I raised on the first round of my tests  but
> don't get addressed
>
> Manlio
>
> On Tue, Apr 22, 2014 at 11:58 PM, Peter Cock <p.j.a.cock at googlemail.com> wrote:
>> On Tue, Apr 22, 2014 at 10:36 PM, Manlio Calvi <manlio.calvi at gmail.com> wrote:
>>> I got those two new errors:
>>>
>>> ======================================================================
>>> ERROR: test_unicode_exception (test_Phylo.IOTests)
>>> ----------------------------------------------------------------------
>>> Traceback (most recent call last):
>>>   File "C:\Users\Public\BioPython3\biopython\Tests\test_Phylo.py",
>>> line 57, in test_unicode_exception
>>>     tree = Phylo.read(EX_NEWICK_BOM, 'newick')
>>>   File "C:\Users\Public\BioPython3\biopython\build\lib.win-amd64-3.4\Bio\Phylo\_io.py",
>>> line 65, in read
>>>     tree = next(tree_gen)
>>>   File "C:\Users\Public\BioPython3\biopython\build\lib.win-amd64-3.4\Bio\Phylo\_io.py",
>>> line 53, in parse
>>>     for tree in getattr(supported_formats[format], 'parse')(fp, **kwargs):
>>>   File "C:\Users\Public\BioPython3\biopython\build\lib.win-amd64-3.4\Bio\Phylo\NewickIO.py",
>>> line 107, in parse
>>>     for line in self.handle:
>>>   File "C:\Python34\lib\encodings\cp1252.py", line 23, in decode
>>>     return codecs.charmap_decode(input,self.errors,decoding_table)[0]
>>> UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position
>>> 15: character maps to <undefined>
>>>
>>
>> Yep, see https://github.com/biopython/biopython/issues/311
>>
>>> ======================================================================
>>> FAIL: test_xml_2226_blastn_006 (test_SearchIO_blast_xml.BlastXmlSpecialCases)
>>> ----------------------------------------------------------------------
>>> Traceback (most recent call last):
>>>   File "C:\Users\Public\BioPython3\biopython\Tests\test_SearchIO_blast_xml.py",
>>> line 3127, in test_xml_2226_blastn_006
>>>     "Expected one BiopythonParserWarning, got %r" % w)
>>> AssertionError: 2 != 1 : Expected one BiopythonParserWarning, got
>>> [<warnings.WarningMessage object at 0x000000000BD0FE10>,
>>> <warnings.WarningMessage object at 0x000000000C0219B0>]
>>>
>>
>> I suspect I have seen that before... must double check that.
>>
>> @Bow, I think this check needs to be relaxed slightly (e.g. at
>> least one warning?) as it can potentially interact with global
>> warning settings (even though the test framework tries to
>> restore the filters to a known state before each test). Could
>> you take a look?
>>
>> Thanks,
>>
>> Peter



More information about the Biopython-dev mailing list