Skip to content

UnicodeDecodeError from Tutorial doctests #669

Open

Description

@sagitter

Hi all,

just 1 test of BioPython-1.66 is failed by running Tests/tests_run.py --offline:

test_doctests (test_Tutorial.TutorialTestCase)
Run tutorial doctests. ... ERROR

======================================================================
ERROR: test_doctests (test_Tutorial.TutorialTestCase)
Run tutorial doctests.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/sagitter/rpmbuild/BUILD/biopython-1.66/Tests/test_Tutorial.py", line 175, in test_doctests
    (len(failures), ", ".join(failures)))
ValueError: 1 Tutorial doctests failed: test_chapter_seqio_line_00888

Activity

  1. peterjc commented on Nov 14, 2015

    @peterjc
    Member

    This was with the Biopython 1.66 release? Under Linux?

    The failing doctest https://github.com/biopython/biopython/blob/master/Doc/Tutorial/chapter_seqio.tex#L888 would be using Bio.SeqIO.index(...) on a BGZF compressed GenBank file.

    See also #211

  2. sagitter commented on Nov 14, 2015

    @sagitter
    ContributorAuthor

    Hi,

    This was with the Biopython 1.66 release? Under Linux?

    Biopython-1.66 on Fedora 23.
    To me, even python run_tests.py doctest fails.

    biopthon-doctest.txt

  3. peterjc commented on Nov 14, 2015

    @peterjc
    Member

    I think part of this is bug #211 about the doctest framework not using the copy of the Python files we want it to, which could explain all the path problems (input test files not being found). Do you have an existing (older) version of Biopython already installed?

    My guess is if you go ahead and install Biopython 1.66, then on rerunning the tests it will be fine.

  4. sagitter commented on Nov 14, 2015

    @sagitter
    ContributorAuthor

    My guess is if you go ahead and install Biopython 1.66, then on rerunning the tests it will be fine.

    Unfortunately, in this case the error will propose itself again at every new Biopython compilation during the RPM packaging (that's what i'm doing).

    Would be acceptable disable only the doctest?

  5. peterjc commented on Nov 15, 2015

    @peterjc
    Member

    Thanks @sagitter - I was assuming this was a routine installation from source and was struggling to understand what might be going wrong.

    Can you clarify if there is an old Biopython install already present or not, which could be confusing the doctests (we know there is some thing happening there which we don't quite understand, see #211)?

    Assuming there is not pre-existing Biopython, then something else is happening. We don't see this failure on our TravisCI setup where a clean VM is used each time. Could you tell us a little more about the RPM packaging process - in particular how are you compiling Biopython (and in which folder) and where are you running the tests from (which folder)? My hunch is you are not running them from the folder we expect, and thus test data files are not being found.

  6. sagitter commented on Nov 15, 2015

    @sagitter
    ContributorAuthor

    Can you clarify if there is an old Biopython install already present or not, which could be confusing the doctests (we know there is some thing happening there which we don't quite understand, see #211)?

    None previous release installed.

    Could you tell us a little more about the RPM packaging process - in particular how are you compiling Biopython (and in which folder) and where are you running the tests from (which folder)? My hunch is you are not running them from the folder we expect, and thus test data files are not being found.

    I'm compiling biopython in a dedicated root for build-process with python2 and python3 (i hope attached build-log can show you all that you need).
    The tests are runned from Tests directory:

    /usr/bin/python2 Tests/run_tests.py doctest

    Early on i chose to run only off-line tests with:

    /usr/bin/python2 Tests/run_tests.py --offline -v obtaining what you see in the first comment.

    biopython_buildlog.txt

    Thank you.

  7. peterjc commented on Nov 15, 2015

    @peterjc
    Member

    I think I understand now. By doing this, you appear to be running the tests from the Biopython source root folder:

    cd /home/sagitter/rpmbuild/BUILD
    cd biopython-1.66
    /usr/bin/python2 Tests/run_tests.py doctest
    

    We expect run_tests.py to be run from the Tests/ folder, e.g.:

    cd /home/sagitter/rpmbuild/BUILD
    cd biopython-1.66/Tests/
    /usr/bin/python2 run_tests.py doctest
    

    Assuming this explains things, we should make run_tests.py detect it is in the wrong working directory, and abort with an explicit error.

  8. sagitter commented on Nov 15, 2015

    @sagitter
    ContributorAuthor

    We expect run_tests.py to be run from the Tests/ folder

    You're right. Now it works.
    But i see other failures with Python3 biopython_buildlog#2.txt with

    cd Tests
    /usr/bin/python3 run_tests.py --offline -v
    
  9. peterjc commented on Nov 15, 2015

    @peterjc
    Member

    Errors from Python 3 included,

    test_doctests (test_Tutorial.TutorialTestCase)
    Run tutorial doctests. ... ERROR
    
    ======================================================================
    ERROR: test_doctests (test_Tutorial.TutorialTestCase)
    Run tutorial doctests.
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File "/home/sagitter/rpmbuild/BUILD/python3-python-biopython-1.66-0.1.fc23/Tests/test_Tutorial.py", line 175, in test_doctests
        (len(failures), ", ".join(failures)))
    ValueError: 1 Tutorial doctests failed: test_chapter_phylo_line_00074
    

    which parsed and drew a Newick tree, and then loads of encoding related ones from NCBIXML.py, PhyloXMLIO.py, and also Nexus.py:

    UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 13090: ordinal not in range(128)
    

    My guess is there is something different about your Python's unicode or the Linux encoding setting, which we're not coping with.

  10. sagitter commented on Nov 16, 2015

    @sagitter
    ContributorAuthor

    Is it a tests problem or does it influence the Biopython functionalities too ?

  11. peterjc commented on Nov 16, 2015

    @peterjc
    Member

    This is unlikely to cause you any problems with using Biopython with strict ASCII text files. These tests have some accented/special characters, and their failure suggest something unexpected with your locale settings, see also this thread with @tiagoantao which we never really resolved:

    http://lists.open-bio.org/pipermail/biopython-dev/2014-May/020541.html

    My Mac and Linux machines give me this (testing with Python 3.3, 3.4 and 3.5):

    $ python3 -c "import locale; print(locale.getlocale())"
    ('en_GB', 'UTF-8')
    

    My Windows XP machine using Python 3.3 and 3.4 says:

    $ C:\python34\python.exe -c "import locale; print(locale.getlocale())"
    (None, None)
    

    What does your Linux machine report?

  12. sagitter commented on Nov 16, 2015

    @sagitter
    ContributorAuthor
    $ python3.4 -c "import locale; print(locale.getlocale())"
    ('en_US', 'UTF-8')
    $ python2 -c "import locale; print(locale.getlocale())"
    (None, None)
    $ python3.5 -c "import locale; print(locale.getlocale())"
    ('en_US', 'UTF-8')
    
  13. changed the title [-]1 Tutorial doctests failed (biopython-1.66)[/-] [+]UnicodeDecodeError from Tutorial doctests[/+] on Apr 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions