[IronPython] About Python TextTestRunner

Orestis Markou orestis at resolversystems.com
Fri Dec 5 14:22:51 CET 2008


You can either use pipe the stdout through tee to save it in a file too,
or in a more pythonic way define a file-like object that prints to 
stdout as you write to it:

import sys
class PrintStream(object):
     def __init__(self, file):
         self.out = file
     def write(self, b):
         self.out.write(b)
         sys.stdout.write(b)


unittest.TextTestRunner(PrintStream(file),verbosity=2).run(suite)

Hope that helped,
Orestis


Deepali Abhyankar wrote:
> Hi
> 
> I used following code to write result on different media.
> 
> unittest.TextTestRunner(verbosity=2).run(suite) : Writes result to StdOutput
> unittest.TextTestRunner(file,verbosity=2).run(suite) : Writes result to file
> 
> 
> But what should I do to write test result on file as well as StdOutput, on
> single go?
> Is there any other method to do this?
> 
> Regards
> Deepali
> 
> 
> -----Original Message-----
> From: users-bounces at lists.ironpython.com
> [mailto:users-bounces at lists.ironpython.com] On Behalf Of Jeff Hardy
> Sent: Friday, December 05, 2008 7:27 AM
> To: Discussion of IronPython; web-sig at python.org
> Subject: [IronPython] NWSGI 0.7 released
> 
> NWSGI 0.7 is now available. This version adds support for ASP.NET
> sessions, fixes Unicode handling, and adds support for wildcard
> mappings. It is available at
> http://www.codeplex.com/NWSGI/Release/ProjectReleases.aspx?ReleaseId=20189.
> 
> What is NWSGI?
> NWSGI is an ASP.NET HttpHandler that implements the Python WSGI spec
> (PEP 333 - http://www.python.org/dev/peps/pep-0333/) for interfacing
> web servers and web frameworks using IronPython. There are still some
> IronPYthon bugs that prevent everything from working, but some things
> do.
> 
> For more details on this release, see
> http://jdhardy.blogspot.com/2008/12/nwsgi-07-released.html.
> 
> - Jeff
> _______________________________________________
> Users mailing list
> Users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
> 
> 
> DISCLAIMER
> ==========
> This e-mail may contain privileged and confidential information which is the property of Persistent Systems Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Ltd. does not accept any liability for virus infected mails.
> _______________________________________________
> Users mailing list
> Users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

-- 
Orestis Markou
Software Engineer,
Resolver Systems Ltd.
orestis at resolversystems.com
+44 (0) 20 7253 6372




More information about the Ironpython-users mailing list