<s> from multiprocessing import current_process <EOL> try : <EOL> import coverage <EOL> from coverage . monkey import patch_multiprocessing <EOL> except ImportError : <EOL> coverage = None <EOL> class Coverage : <EOL> '''<STR_LIT>''' <EOL> @ property <EOL> def coverage ( self ) : <EOL> return getattr ( current_process ( ) , '<STR_LIT>' , None ) <EOL> def start_coverage ( self ) : <EOL> if self . is_arbiter ( ) and self . cfg . coverage : <EOL> if not coverage : <EOL> self . logger . error ( '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> return <EOL> cov = self . coverage <EOL> if not cov : <EOL> self . logger . warning ( '<STR_LIT>' ) <EOL> p = current_process ( ) <EOL> p . _coverage = coverage . Coverage ( data_suffix = True ) <EOL> patch_multiprocessing ( ) <EOL> p . _coverage . start ( ) <EOL> def stop_coverage ( self ) : <EOL> cov = self . coverage <EOL> if cov and self . is_arbiter ( ) : <EOL> self . logger . warning ( '<STR_LIT>' ) <EOL> cov . stop ( ) <EOL> cov . save ( ) <EOL> c = coverage . Coverage ( ) <EOL> c . combine ( ) <EOL> c . save ( ) <EOL> self . stream . write ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' ) </s>
