[Biopython-dev] Import problems when testing under PyPy 2.2

Peter Cock p.j.a.cock at googlemail.com
Tue Nov 26 17:20:24 UTC 2013


On Thu, Nov 21, 2013 at 5:19 PM, Peter Cock <p.j.a.cock at googlemail.com> wrote:
> Hello all,
> TravisCI is being updated to target PyPy 2.2 any day now,
> http://about.travis-ci.org/blog/2013-11-18-upcoming-build-environment-updates/
>
> Meanwhile in local testing on Mac OS X, Biopython looks fine
> under PyPy 2.2.
>
> However, I'm seeing some oddities with imports failing under
> PyPy 2.2 via run_tests.py on Windows 32 bit & Linux 64 though -
> can anyone reproduce this? e.g.
>
>
> C:\repositories\biopython\Tests>c:\pypy-2.2\pypy test_Nexus.py
> test_NexusTest1 (__main__.NexusTest1)
> Test Nexus module ... ok
> test_TreeTest1 (__main__.NexusTest1)
> Test Tree module. ... ok
> test_WriteToFileName (__main__.NexusTest1)
> Test writing to a given filename. ... ok
> test_internal_node_labels (__main__.NexusTest1)
> Handle text labels on internal nodes. ... ok
>
> ----------------------------------------------------------------------
> Ran 4 tests in 0.125s
>
> OK
>
> i.e. Here test_Nexus.py works fine using the installed Biopython.
> However, via run_tests.py which tries to mess with the Python path
> to use the local not-yet installed Biopython:
>
> C:\repositories\biopython\Tests>c:\pypy-2.2\pypy run_tests.py test_Nexus.py
> Python version: 2.7.3 (2cec7296d7fb, Nov 12 2013, 13:24:40)
> [PyPy 2.2.0 with MSC v.1500 32 bit]
> Operating system: nt win32
> test_Nexus ... ERROR
> ======================================================================
> ERROR: test_Nexus
> ----------------------------------------------------------------------
> Traceback (most recent call last):
>   File "run_tests.py", line 407, in runTest
>     suite = unittest.TestLoader().loadTestsFromName(name)
>   File "c:\pypy-2.2\lib-python\2.7\unittest\loader.py", line 91, in loadTestsFro
> mName
>     module = __import__('.'.join(parts_copy))
>   File "C:\repositories\biopython\Tests\test_Nexus.py", line 13, in <module>
>     from Bio._py3k import StringIO
> ImportError: cannot import name 'StringIO'
> ----------------------------------------------------------------------
> Ran 1 test in 0.016 seconds
>
> FAILED (failures = 1)
>
>
> Note:
>
> C:\repositories\biopython\Tests>
> C:\repositories\biopython\Tests>c:\pypy-2.2\pypy
> Python 2.7.3 (2cec7296d7fb, Nov 12 2013, 13:24:40)
> [PyPy 2.2.0 with MSC v.1500 32 bit] on win32
> Type "help", "copyright", "credits" or "license" for more information.
> And now for something completely different: ``do you know about a toaster with
> 8KB of RAM and 64KB of ROM?''
>>>>> from Bio._py3k import StringIO
>>>>> quit()
>
>
> This seems rather odd...

Solved - I think.

There was something in the old build directory which was
causing this, removing that and reinstalling Biopython under PyPy
made it work. Not yet quite sure what this was though... perhaps
stale compiled Python files from an older PyPy version?

Peter



More information about the Biopython-dev mailing list