[Twisted-Python] comments about twisted.trial.unittest

Chris Liechti cliechti at gmx.net
Mon Jun 9 19:49:33 EDT 2003


you claim compatibility with pythons unittest from the stdlib, hm... i 
see some differences ;-)

i like to have a

if __name__ == '__main__':
     unittest.main()

in my test_*.py files, this does not work with twisteds unittest.
i have to use the following snippet:

if __name__ == '__main__':
     import sys
     from twisted.scripts import trial
     sys.argv.extend(['-f', sys.argv[0]])
     trial.run()

sugestion, why not adding the following func (or something better, that 
does not fiddle with sys.argv) to twisted.trial.unittest?

def main():
     import sys
     from twisted.scripts import trial
     sys.argv.extend(['-f', sys.argv[0]])
     trial.run()

also i like to run my tests with "-v" (verbose) but unfortunately does 
twisted output garbage in that case.. (i know, it's ANSI colors but i'm 
on Win32... :-(
either you should check for the terminal capabilities (however that 
works on win32...) or maybe check sys.platform (altough that's bad for 
portability) or easier, exchange the meanings of '-o' and '-v', making 
the bwoutput default for "-v" and use an other option for the nice 
colored output.

chris





More information about the Twisted-Python mailing list