#NEWLINE# @ pytest . fixture ( scope = 'session' ) #NEWLINE# def worker( request ) : #NEWLINE# #INDENT# worker = SWFWorker ( ) #NEWLINE# @ worker . role ( 'echo' ) #NEWLINE# def echo( msg ) : #NEWLINE# #INDENT# output = subprocess . check_output ( ( 'echo %s' % msg ) , shell = True ) #NEWLINE# print ( output ) #NEWLINE# #UNINDENT# @ worker . role ( 'shell' ) #NEWLINE# def run( cmd ) : #NEWLINE# #INDENT# output = subprocess . check_output ( cmd , shell = True ) #NEWLINE# print ( output ) #NEWLINE# #UNINDENT# p = Process ( target = worker . start , kwargs = { #NEWLINE# #INDENT# 'farm' : { #NEWLINE# #INDENT# 'echo' : 1 , #NEWLINE# 'shell' : 2 , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } ) #NEWLINE# p . start ( ) #NEWLINE# def fin( ) : #NEWLINE# #INDENT# p . terminate ( ) #NEWLINE# p . join ( ) #NEWLINE# #UNINDENT# request . addfinalizer ( fin ) #NEWLINE# return p