[IPython-dev] stdout when running the test suite

Brian Granger ellisonbg at gmail.com
Sun Apr 24 23:50:12 EDT 2011

On Sun, Apr 24, 2011 at 7:22 PM, MinRK <benjaminrk at gmail.com> wrote:
> On Sun, Apr 24, 2011 at 17:16, Robert Kern <robert.kern at gmail.com> wrote:
>> On 4/24/11 3:26 PM, MinRK wrote:
>>> This has been true for a *long* time - at least January 2010.  I did
>>> some checking, and it turns out that it's actually related to io.Term,
>>> so I pushed a fix to PR #397, since that's regarding the same code.
>>> The Term object created with the InteractiveShell latches onto
>>> sys.stdout before nose redirects it (which happens in every test), so
>>> anything printed there would still arrive at stdout.  I've fixed this
>>> in the tests, by creating simple StreamProxy objects that are soft
>>> links to sys.stdout/err, rather than hard ones, so the Capture plugin
>>> should still work with IPython output.
>> For what it's worth, I've had to do a similar thing in a non-test situation. It
>> might be worthwhile to expose such a thing in io itself.
> Good to know.  For that matter, I'm not sure why we have
> io.stdout/stderr (previously io.Term.cout/cerr) at all.
> Under what circumstances do we want streams going to our stdout/stderr
> to be handled *differently* from sys.stdout,stderr, or a logger?

I am not sure how Term came into being.  The only reasons I can think
of to separate sys.stdout/in/err from io.stdout/in/err are:

1) The versions in io handle colors on Windows.
2) The idea of separating user io (sys.stdout/in/err) from IPython

Now 1) we are definitely using and I am not sure we want to run all
user io through that.  While I like the idea of 2), we don't really
take advantage of this separation currently.  Although, I imagine a
frontend could handle that output differently if it wanted to.

In my mind, logging is a completely different issue in terms of
function/content, although we still have to decide which streams to
run logging on.



> -MinRK
>> --
>> 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
>> _______________________________________________
>> IPython-dev mailing list
>> IPython-dev at scipy.org
>> http://mail.scipy.org/mailman/listinfo/ipython-dev
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev

Brian E. Granger
Cal Poly State University, San Luis Obispo
bgranger at calpoly.edu and ellisonbg at gmail.com

More information about the IPython-dev mailing list