コード例 #1
0
ファイル: core_test.py プロジェクト: luisera/oq-engine
    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)
コード例 #2
0
ファイル: core_test.py プロジェクト: gvallarelli/oq-engine
    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)
コード例 #3
0
    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)