[IPython-dev] Status of py3k ipython

Fernando Perez fperez.net at gmail.com
Sun Oct 3 15:28:19 EDT 2010


Hi Thomas,

On Fri, Oct 1, 2010 at 4:46 PM, Thomas Kluyver <takowl at gmail.com> wrote:
> Hi,
>
> An update on where I am with py3k ipython: The frontend/kernel system has
> various external dependencies that don't seem to support python 3 (e.g.
> twisted), along with some that do, but are a hassle to install (PyQT is only
> packaged for Ubuntu for Python 2), so I've not attempted to get that
> working. The core interpreter seems to be working OK, and is now passing

Don't worry about twisted *at all*.  It will be a long time before
they port to py3, and we will move our infrastructure from twisted to
zmq before that.  So feel free to simply ignore twisted.

Pyqt will be important later on, but for now you can focus on the
terminal-based tools.  Hopefully as py3 uptake increases, the qt tools
will be more easily available for py3.

> nearly all of its tests. I wonder if I could get some advice on the last
> couple of tests:
> In the core module, there are two tests to check that the magic %run command
> doesn't change the id of __builtins__. These fail, but when I attempt to
> repeat them in the interpreter, the id seems to stay the same however I try
> to test it. Any bright ideas?
> Also in core.tests.test_run, there's a "Test that object's __del__ methods
> are called on exit." Some code is written to a temporary file and run, where
> it apparently fails to find print (NameError). This is probably to do with
> print becoming a function in Python 3, but I wondered if anyone had a flash
> of inspiration?
>
> Both the errors almost seem as if the test is somehow running them in the
> wrong shell. Is that possible? I'm using a virtualenv, so it should be
> isolated (although it's an unofficial py3k fork of virtualenv, so it could
> be that at fault).

These two little devils are very peculiar and unpleasant.  They are
tests that I managed to write to catch certain obscure edge cases, but
they could probably be better written.

Why don't you do the following:

1. Mark them on py3 as known failures:

from IPython.testing import decorators as dec
skip_known_failure_py3 = skip('This test is known to fail on Python 3
- needs fixing')
if py3:
  badtest = skip_known_failure_py3(badtest)

that is, you make this new decorator for py3-specific known failures,
and apply it manually (since the @ syntax can't be used easily in an
if statement).

3. Make a ticket so I look later into these guys and hopefully can
find a cleaner solution.


That will let you move forward without completely ignoring the problem.

Thanks!

f



More information about the IPython-dev mailing list