<s> """<STR_LIT>""" <EOL> from distutils import cmd <EOL> import distutils . errors <EOL> import logging <EOL> import os <EOL> import sys <EOL> logger = logging . getLogger ( __name__ ) <EOL> class TestrReal ( cmd . Command ) : <EOL> description = "<STR_LIT>" <EOL> user_options = [ <EOL> ( '<STR_LIT>' , None , "<STR_LIT>" <EOL> "<STR_LIT>" ) , <EOL> ( '<STR_LIT>' , '<STR_LIT:t>' , "<STR_LIT>" ) , <EOL> ( '<STR_LIT>' , '<STR_LIT:o>' , "<STR_LIT>" ) , <EOL> ( '<STR_LIT>' , None , "<STR_LIT>" ) , <EOL> ( '<STR_LIT>' , None , "<STR_LIT>" ) , <EOL> ( '<STR_LIT>' , None , "<STR_LIT>" ) , <EOL> ( '<STR_LIT>' , '<STR_LIT:l>' , "<STR_LIT>" ) , <EOL> ] <EOL> boolean_options = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> def _run_testr ( self , * args ) : <EOL> logger . debug ( "<STR_LIT>" , args ) <EOL> return commands . run_argv ( [ sys . argv [ <NUM_LIT:0> ] ] + list ( args ) , <EOL> sys . stdin , sys . stdout , sys . stderr ) <EOL> def initialize_options ( self ) : <EOL> self . testr_args = None <EOL> self . coverage = None <EOL> self . omit = "<STR_LIT>" <EOL> self . slowest = None <EOL> self . coverage_package_name = None <EOL> self . no_parallel = None <EOL> self . log_level = '<STR_LIT:info>' <EOL> def finalize_options ( self ) : <EOL> self . log_level = getattr ( <EOL> logging , <EOL> self . log_level . upper ( ) , <EOL> logging . INFO ) <EOL> logging . basicConfig ( level = self . log_level ) <EOL> logger . debug ( "<STR_LIT>" ) <EOL> if self . testr_args is None : <EOL> self . testr_args = [ ] <EOL> else : <EOL> self . testr_args = self . testr_args . split ( ) <EOL> if self . omit : <EOL> self . omit = "<STR_LIT>" % self . omit <EOL> logger . debug ( "<STR_LIT>" , self . __dict__ ) <EOL> def run ( self ) : <EOL> """<STR_LIT>""" <EOL> logger . debug ( "<STR_LIT>" ) <EOL> if not os . path . isdir ( "<STR_LIT>" ) : <EOL> self . _run_testr ( "<STR_LIT>" ) <EOL> if self . coverage : <EOL> self . _coverage_before ( ) <EOL> if not self . no_parallel : <EOL> testr_ret = self . _run_testr ( "<STR_LIT>" , "<STR_LIT>" , * self . testr_args ) <EOL> else : <EOL> testr_ret = self . _run_testr ( "<STR_LIT>" , * self . testr_args ) <EOL> if testr_ret : <EOL> raise distutils . errors . DistutilsError ( <EOL> "<STR_LIT>" % testr_ret ) <EOL> if self . slowest : <EOL> print ( "<STR_LIT>" ) <EOL> self . _run_testr ( "<STR_LIT>" ) <EOL> if self . coverage : <EOL> self . _coverage_after ( ) <EOL> def _coverage_before ( self ) : <EOL> logger . debug ( "<STR_LIT>" ) <EOL> package = self . distribution . get_name ( ) <EOL> if package . startswith ( '<STR_LIT>' ) : <EOL> package = package [ <NUM_LIT:7> : ] <EOL> if self . coverage_package_name : <EOL> package = self . coverage_package_name <EOL> options = "<STR_LIT>" % package <EOL> os . environ [ '<STR_LIT>' ] = ( "<STR_LIT>" % options ) <EOL> logger . debug ( "<STR_LIT>" , os . environ [ '<STR_LIT>' ] ) <EOL> def _coverage_after ( self ) : <EOL> logger . debug ( "<STR_LIT>" ) <EOL> os . system ( "<STR_LIT>" ) <EOL> os . system ( "<STR_LIT>" % self . omit ) <EOL> class TestrFake ( cmd . Command ) : <EOL> description = "<STR_LIT>" <EOL> user_options = [ ] <EOL> def initialize_options ( self ) : <EOL> pass <EOL> def finalize_options ( self ) : <EOL> pass <EOL> def run ( self ) : <EOL> print ( "<STR_LIT>" ) <EOL> try : <EOL> from testrepository import commands <EOL> have_testr = True <EOL> Testr = TestrReal <EOL> except ImportError : <EOL> have_testr = False <EOL> Testr = TestrFake </s>
