> > I thought I could get away with importing print_function
> > from __future__ ... but my re-pointed print function never gets
> > called.

> -snip-

> >    def __enter__(self):
> >        print = self.printhook

> That redefines the print function local to __enter__.  You need to
> change the global value of print.

Thanks for the clue.  I had actually tried using 'global print' in
the __enter__ function, but it broke my tests even worse so I
figured I must not need it. :-} After your reply, I went back and
discovered that everything was actually working fine with 'global'
in place---except my automated tests break.  So I just have a little
mystery to solve regarding how execution using nose differs from
running the app manually.

> from contextlib import contextmanager

Hey, thanks for that gem!  I didn't know about this clever little
module---really useful!
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to