def test_celery_task(self): self.calculator.pre_execute() self.job.is_running = True self.job.status = 'executing' self.job.save() patch = helpers.patch( 'openquake.engine.calculators.risk.writers.loss_curve') try: mocked_writer = patch.start() classical.classical(*self.calculator.task_arg_gen().next()) finally: patch.stop() self.assertEqual(1, mocked_writer.call_count)
def test_celery_task(self): self.calculator.pre_execute() self.job.is_running = True self.job.status = 'executing' self.job.save() patch = helpers.patch( 'openquake.engine.calculators.risk.general.write_loss_curve') mocked_writer = patch.start() classical.classical(*self.calculator.task_arg_gen( self.calculator.block_size()).next()) patch.stop() # we expect 1 asset being filtered out by the region # constraint, so there are only two loss curves to be written self.assertEqual(2, mocked_writer.call_count)
def test_celery_task(self): self.calculator.pre_execute() self.job.is_running = True self.job.status = 'executing' self.job.save() patch = helpers.patch( 'openquake.engine.calculators.risk.writers.loss_curve') try: mocked_writer = patch.start() classical.classical(*self.calculator.task_arg_gen( self.calculator.block_size()).next()) finally: patch.stop() self.assertEqual(1, mocked_writer.call_count)