[IPython-dev] Applying prefilter reorg to ipython1

Robert Kern robert.kern at gmail.com
Mon May 7 17:48:59 EDT 2007

Dan Milstein wrote:
> F-
>> In fact, if Dan already wrote the code, his patch will probabl apply
>> to trunk but not quite to ipython1/core1.  I modified the code quite a
>> bit, so it's likely that an as-is patch won't apply anymore.
> This has, in fact, turned out to be true.
> I *think* I see where my code now fits in (in core1/translator.py,  
> essentially), but I have a question:
> One of the main things I've got is a suite of tests which fairly  
> exhaustively exercise the input transformation process.  Currently,  
> they do so by creating an IPython instance, and feeding it various  
> things, ala
> import IPython
> import IPython.ipapi
> IPython.Shell.start()
> ip = IPython.ipapi.get()
> ip.runlines(...)
> What is the equivalent in the new world?  Something like:
> import core1.interpreter
> interp = interpreter.Interpreter()
> interp.execute(...)
> Or am I even vaguely in the right territory?

Yes, but there is still other infrastructure (like magics) that is as-yet
unimplemented in core1, so you won't be able to rely on execution for testing.
Can you write tests that test *just* the translation and don't require
execution? That was one of the reasons we did the refactoring, to have cleanly
separated components that could be used and tested separately.

No one is using core1, yet, so you can check your stuff in there if you like,
and you and I can work together on how best to set up the tests.

Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco

More information about the IPython-dev mailing list