def run_dummy_heroku_worker(sandbox, _imminent_shutdown_delay):
 sys.stderr = open(os.path.join(sandbox, u'stderr.log'), u'w')
 class TestHerokuWorker(HerokuWorker, ):
  imminent_shutdown_delay = _imminent_shutdown_delay
  def perform_job(self, job, queue):
   create_file(os.path.join(sandbox, u'started'))
   for i in range(20):
    time.sleep(0.1)
   create_file(os.path.join(sandbox, u'finished'))
 w = TestHerokuWorker(Queue(u'dummy'))
 w.main_work_horse(None, None)

def run_dummy_heroku_worker ( sandbox , _imminent_shutdown_delay ) : sys . stderr = open ( os . path . join ( sandbox , u'stderr.log' ) , u'w' ) class TestHerokuWorker ( HerokuWorker , ) : imminent_shutdown_delay = _imminent_shutdown_delay def perform_job ( self , job , queue ) : create_file ( os . path . join ( sandbox , u'started' ) ) for i in range ( 20 ) : time . sleep ( 0.1 ) create_file ( os . path . join ( sandbox , u'finished' ) ) w = TestHerokuWorker ( Queue ( u'dummy' ) ) w . main_work_horse ( None , None )
run the work horse for a simplified heroku worker where perform_job just creates two sentinel files 2 seconds apart .