<s> """<STR_LIT>""" <EOL> import unittest <EOL> from pygr import logger <EOL> try : <EOL> from nose . plugins . skip import SkipTest <EOL> except ImportError : <EOL> class SkipTest ( Exception ) : <EOL> pass <EOL> class PygrTestResult ( unittest . _TextTestResult ) : <EOL> def __init__ ( self , * args , ** kwargs ) : <EOL> unittest . _TextTestResult . __init__ ( self , * args , ** kwargs ) <EOL> self . skipped = [ ] <EOL> verbosity = kwargs . get ( '<STR_LIT>' , <NUM_LIT:0> ) <EOL> show_dots = kwargs . get ( '<STR_LIT>' , <NUM_LIT:1> ) <EOL> if verbosity == <NUM_LIT:0> and show_dots : <EOL> self . dots = <NUM_LIT:1> <EOL> def addError ( self , test , err ) : <EOL> exc_type , val , _ = err <EOL> if issubclass ( exc_type , SkipTest ) : <EOL> self . skipped . append ( ( self , val ) ) <EOL> if self . showAll : <EOL> self . stream . writeln ( "<STR_LIT>" ) <EOL> elif self . dots : <EOL> self . stream . write ( '<STR_LIT:S>' ) <EOL> else : <EOL> unittest . _TextTestResult . addError ( self , test , err ) <EOL> class PygrTestRunner ( unittest . TextTestRunner ) : <EOL> """<STR_LIT>""" <EOL> def _makeResult ( self ) : <EOL> return PygrTestResult ( self . stream , self . descriptions , <EOL> self . verbosity ) <EOL> class PygrTestProgram ( unittest . TestProgram ) : <EOL> def __init__ ( self , ** kwargs ) : <EOL> verbosity = kwargs . pop ( '<STR_LIT>' , <NUM_LIT:1> ) <EOL> if verbosity < <NUM_LIT:1> : <EOL> logger . disable ( '<STR_LIT>' ) <EOL> elif verbosity < <NUM_LIT:2> : <EOL> logger . disable ( '<STR_LIT>' ) <EOL> if kwargs . get ( '<STR_LIT>' ) is None : <EOL> kwargs [ '<STR_LIT>' ] = PygrTestRunner ( verbosity = verbosity ) <EOL> unittest . TestProgram . __init__ ( self , ** kwargs ) </s>
