def test_failure_reasons(self, get_implementation): implementation = mock.Mock() get_implementation.return_value = implementation project = self.create_project() build = self.create_build(project=project) job = self.create_job(build=build) plan = self.create_plan(project) self.create_step(plan, implementation='test', order=0) self.create_job_plan(job, plan) phase = self.create_jobphase(job) step = self.create_jobstep(phase, status=Status.finished, result=Result.passed) db.session.add(FailureReason( step_id=step.id, job_id=job.id, build_id=build.id, project_id=project.id, reason='missing_manifest_json' )) db.session.commit() with mock.patch.object(sync_job_step, 'allow_absent_from_db', True): sync_job_step( step_id=step.id.hex, task_id=step.id.hex, parent_task_id=job.id.hex ) assert step.result == Result.infra_failed
def test_missing_test_results_and_expected(self, get_implementation, queue_delay): # Simulate test type which doesn't interact with artifacts store. responses.add(responses.GET, SyncJobStepTest.ARTIFACTSTORE_REQUEST_RE, body='', status=404) implementation = mock.Mock() get_implementation.return_value = implementation def mark_finished(step): step.status = Status.finished step.result = Result.passed implementation.update_step.side_effect = mark_finished project = self.create_project() build = self.create_build(project=project) job = self.create_job(build=build) plan = self.create_plan(project) self.create_step(plan, implementation='test', order=0) db.session.add( ItemOption(item_id=plan.id, name='build.expect-tests', value='1')) db.session.commit() self.create_job_plan(job, plan) phase = self.create_jobphase( job=job, date_started=datetime(2013, 9, 19, 22, 15, 24), ) step = self.create_jobstep(phase) with mock.patch.object(sync_job_step, 'allow_absent_from_db', True): sync_job_step( step_id=step.id.hex, task_id=step.id.hex, parent_task_id=job.id.hex, ) db.session.expire(step) step = JobStep.query.get(step.id) assert step.status == Status.finished assert step.result == Result.failed stat = ItemStat.query.filter( ItemStat.item_id == step.id, ItemStat.name == 'tests_missing', ).first() assert stat.value == 1 assert FailureReason.query.filter( FailureReason.step_id == step.id, FailureReason.reason == 'missing_tests', )
def test_in_progress(self, get_implementation, queue_delay): # Simulate test which doesn't interact with artifacts store. responses.add(responses.GET, SyncJobStepTest.ARTIFACTSTORE_REQUEST_RE, body='', status=404) implementation = mock.Mock() get_implementation.return_value = implementation def mark_in_progress(step): step.status = Status.in_progress project = self.create_project() build = self.create_build(project=project) job = self.create_job(build=build) plan = self.create_plan(project) self.create_step(plan, implementation='test', order=0) self.create_job_plan(job, plan) phase = self.create_jobphase(job) step = self.create_jobstep(phase) task = self.create_task( parent_id=job.id, task_id=step.id, task_name='sync_job_step', ) db.session.add(ItemStat(item_id=job.id, name='tests_missing', value=1)) db.session.commit() implementation.update_step.side_effect = mark_in_progress sync_job_step( step_id=step.id.hex, task_id=step.id.hex, parent_task_id=job.id.hex, ) implementation.update_step.assert_called_once_with(step=step) db.session.expire(step) db.session.expire(task) step = JobStep.query.get(step.id) assert step.status == Status.in_progress task = Task.query.get(task.id) assert task.status == Status.in_progress queue_delay.assert_any_call('sync_job_step', kwargs={ 'step_id': step.id.hex, 'task_id': step.id.hex, 'parent_task_id': job.id.hex, }, countdown=5)
def test_timed_out(self, get_implementation, mock_has_timed_out): implementation = mock.Mock() get_implementation.return_value = implementation project = self.create_project() build = self.create_build(project=project) job = self.create_job(build=build) plan = self.create_plan() self.create_step(plan, implementation='test', order=0) jobplan = self.create_job_plan(job, plan) phase = self.create_jobphase(job) step = self.create_jobstep(phase, status=Status.in_progress) mock_has_timed_out.return_value = True sync_job_step(step_id=step.id.hex, task_id=step.id.hex, parent_task_id=job.id.hex) mock_has_timed_out.assert_called_once_with(step, jobplan) get_implementation.assert_called_once_with() implementation.cancel_step.assert_called_once_with(step=step, ) assert step.result == Result.failed assert FailureReason.query.filter( FailureReason.step_id == step.id, FailureReason.reason == 'timeout', )
def test_failure_reasons(self, get_implementation): # Simulate test type which doesn't interact with artifacts store. responses.add(responses.GET, SyncJobStepTest.ARTIFACTSTORE_REQUEST_RE, body='', status=404) implementation = mock.Mock() get_implementation.return_value = implementation project = self.create_project() build = self.create_build(project=project) job = self.create_job(build=build) plan = self.create_plan(project) self.create_step(plan, implementation='test', order=0) self.create_job_plan(job, plan) phase = self.create_jobphase(job) step = self.create_jobstep(phase, status=Status.finished, result=Result.passed) db.session.add(FailureReason( step_id=step.id, job_id=job.id, build_id=build.id, project_id=project.id, reason='missing_manifest_json' )) db.session.commit() with mock.patch.object(sync_job_step, 'allow_absent_from_db', True): sync_job_step( step_id=step.id.hex, task_id=step.id.hex, parent_task_id=job.id.hex ) assert step.result == Result.infra_failed
def test_in_progress(self, get_implementation, queue_delay): # Simulate test which doesn't interact with artifacts store. responses.add(responses.GET, SyncJobStepTest.ARTIFACTSTORE_REQUEST_RE, body='', status=404) implementation = mock.Mock() get_implementation.return_value = implementation def mark_in_progress(step): step.status = Status.in_progress project = self.create_project() build = self.create_build(project=project) job = self.create_job(build=build) plan = self.create_plan(project) self.create_step(plan, implementation='test', order=0) self.create_job_plan(job, plan) phase = self.create_jobphase(job) step = self.create_jobstep(phase) task = self.create_task( parent_id=job.id, task_id=step.id, task_name='sync_job_step', ) db.session.add(ItemStat(item_id=job.id, name='tests_missing', value=1)) db.session.commit() implementation.update_step.side_effect = mark_in_progress sync_job_step( step_id=step.id.hex, task_id=step.id.hex, parent_task_id=job.id.hex, ) get_implementation.assert_called_once_with() implementation.update_step.assert_called_once_with( step=step ) db.session.expire(step) db.session.expire(task) step = JobStep.query.get(step.id) assert step.status == Status.in_progress task = Task.query.get(task.id) assert task.status == Status.in_progress queue_delay.assert_any_call('sync_job_step', kwargs={ 'step_id': step.id.hex, 'task_id': step.id.hex, 'parent_task_id': job.id.hex, }, countdown=5)
def test_missing_test_results_and_expected(self, get_implementation, queue_delay): # Simulate test type which doesn't interact with artifacts store. responses.add(responses.GET, SyncJobStepTest.ARTIFACTSTORE_REQUEST_RE, body='', status=404) implementation = mock.Mock() get_implementation.return_value = implementation def mark_finished(step): step.status = Status.finished step.result = Result.passed implementation.update_step.side_effect = mark_finished project = self.create_project() build = self.create_build(project=project) job = self.create_job(build=build) plan = self.create_plan(project) self.create_step(plan, implementation='test', order=0) db.session.add(ItemOption( item_id=plan.id, name='build.expect-tests', value='1' )) db.session.commit() self.create_job_plan(job, plan) phase = self.create_jobphase( job=job, date_started=datetime(2013, 9, 19, 22, 15, 24), ) step = self.create_jobstep(phase) with mock.patch.object(sync_job_step, 'allow_absent_from_db', True): sync_job_step( step_id=step.id.hex, task_id=step.id.hex, parent_task_id=job.id.hex, ) db.session.expire(step) step = JobStep.query.get(step.id) assert step.status == Status.finished assert step.result == Result.failed stat = ItemStat.query.filter( ItemStat.item_id == step.id, ItemStat.name == 'tests_missing', ).first() assert stat.value == 1 assert FailureReason.query.filter( FailureReason.step_id == step.id, FailureReason.reason == 'missing_tests', )
def test_finished(self, get_implementation, queue_delay): implementation = mock.Mock() get_implementation.return_value = implementation def mark_finished(step): step.status = Status.finished step.result = Result.passed implementation.update_step.side_effect = mark_finished build = self.create_build(project=self.project) job = self.create_job(build=build) plan = self.create_plan() self.create_step(plan, implementation='test', order=0) self.create_job_plan(job, plan) phase = self.create_jobphase(job) step = self.create_jobstep(phase) task = self.create_task( parent_id=job.id, task_id=step.id, task_name='sync_job_step', status=Status.finished, ) sync_job_step( step_id=step.id.hex, task_id=step.id.hex, parent_task_id=job.id.hex, ) get_implementation.assert_called_once_with() implementation.update_step.assert_called_once_with( step=step ) db.session.expire(step) db.session.expire(task) step = JobStep.query.get(step.id) assert step.status == Status.finished task = Task.query.get(task.id) assert task.status == Status.finished assert len(queue_delay.mock_calls) == 0 stat = ItemStat.query.filter( ItemStat.item_id == step.id, ItemStat.name == 'tests_missing', ).first() assert stat.value == 0
def test_in_progress(self, get_implementation, queue_delay): implementation = mock.Mock() get_implementation.return_value = implementation def mark_in_progress(step): step.status = Status.in_progress project = self.create_project() build = self.create_build(project=project) job = self.create_job(build=build) plan = self.create_plan() self.create_step(plan, implementation='test', order=0) self.create_job_plan(job, plan) phase = self.create_jobphase(job) step = self.create_jobstep(phase) task = self.create_task( parent_id=job.id, task_id=step.id, task_name='sync_job_step', ) db.session.add(ItemStat(item_id=job.id, name='tests_missing', value=1)) db.session.commit() implementation.update_step.side_effect = mark_in_progress sync_job_step( step_id=step.id.hex, task_id=step.id.hex, parent_task_id=job.id.hex, ) get_implementation.assert_called_once_with() implementation.update_step.assert_called_once_with(step=step) db.session.expire(step) db.session.expire(task) step = JobStep.query.get(step.id) assert step.status == Status.in_progress task = Task.query.get(task.id) assert task.status == Status.in_progress queue_delay.assert_any_call('sync_job_step', kwargs={ 'step_id': step.id.hex, 'task_id': step.id.hex, 'parent_task_id': job.id.hex, }, countdown=5)
def test_missing_test_results_and_expected(self, get_implementation, queue_delay): implementation = mock.Mock() get_implementation.return_value = implementation def mark_finished(step): step.status = Status.finished step.result = Result.passed implementation.update_step.side_effect = mark_finished project = self.create_project() build = self.create_build(project=project) job = self.create_job(build=build) plan = self.create_plan(project) self.create_step(plan, implementation='test', order=0) db.session.add(ItemOption( item_id=plan.id, name='build.expect-tests', value='1' )) db.session.commit() self.create_job_plan(job, plan) phase = self.create_jobphase( job=job, date_started=datetime(2013, 9, 19, 22, 15, 24), ) step = self.create_jobstep(phase) sync_job_step( step_id=step.id.hex, task_id=step.id.hex, parent_task_id=job.id.hex, ) db.session.expire(step) step = JobStep.query.get(step.id) assert step.status == Status.finished assert step.result == Result.failed stat = ItemStat.query.filter( ItemStat.item_id == step.id, ItemStat.name == 'tests_missing', ).first() assert stat.value == 1 assert FailureReason.query.filter( FailureReason.step_id == step.id, FailureReason.reason == 'missing_tests', )
def test_in_progress(self, get_implementation, queue_delay): implementation = mock.Mock() get_implementation.return_value = implementation def mark_in_progress(step): step.status = Status.in_progress build = self.create_build(project=self.project) job = self.create_job(build=build) plan = self.create_plan() self.create_step(plan, implementation='test', order=0) self.create_job_plan(job, plan) phase = self.create_jobphase(job) step = self.create_jobstep(phase) task = self.create_task( parent_id=job.id, task_id=step.id, task_name='sync_job_step', ) db.session.add(ItemStat(item_id=job.id, name='tests_missing', value=1)) db.session.commit() implementation.update_step.side_effect = mark_in_progress sync_job_step( step_id=step.id.hex, task_id=step.id.hex, parent_task_id=job.id.hex, ) get_implementation.assert_called_once_with() implementation.update_step.assert_called_once_with( step=step ) db.session.expire(step) db.session.expire(task) step = JobStep.query.get(step.id) assert step.status == Status.in_progress task = Task.query.get(task.id) assert task.status == Status.in_progress queue_delay.assert_any_call('sync_job_step', kwargs={ 'step_id': step.id.hex, 'task_id': step.id.hex, 'parent_task_id': job.id.hex, }, countdown=5)
def test_finished(self, get_implementation, queue_delay): implementation = mock.Mock() get_implementation.return_value = implementation def mark_finished(step): step.status = Status.finished step.result = Result.passed implementation.update_step.side_effect = mark_finished build = self.create_build(project=self.project) job = self.create_job(build=build) plan = self.create_plan() self.create_step(plan, implementation='test', order=0) self.create_job_plan(job, plan) phase = self.create_jobphase(job) step = self.create_jobstep(phase) task = self.create_task( parent_id=job.id, task_id=step.id, task_name='sync_job_step', status=Status.finished, ) sync_job_step( step_id=step.id.hex, task_id=step.id.hex, parent_task_id=job.id.hex, ) get_implementation.assert_called_once_with() implementation.update_step.assert_called_once_with(step=step) db.session.expire(step) db.session.expire(task) step = JobStep.query.get(step.id) assert step.status == Status.finished task = Task.query.get(task.id) assert task.status == Status.finished assert len(queue_delay.mock_calls) == 0 stat = ItemStat.query.filter( ItemStat.item_id == step.id, ItemStat.name == 'tests_missing', ).first() assert stat.value == 0
def test_no_missing_targets(self, get_implementation, queue_delay): # Simulate test type which doesn't interact with artifacts store. responses.add(responses.GET, SyncJobStepTest.ARTIFACTSTORE_REQUEST_RE, body='', status=404) implementation = mock.Mock() get_implementation.return_value = implementation def mark_finished(step): step.status = Status.finished step.result = Result.passed implementation.update_step.side_effect = mark_finished project = self.create_project() build = self.create_build(project=project) job = self.create_job(build=build) plan = self.create_plan(project) self.create_step(plan, implementation='test', order=0) self.create_job_plan(job, plan) phase = self.create_jobphase( job=job, date_started=datetime(2013, 9, 19, 22, 15, 24), ) step = self.create_jobstep(phase) self.create_target(job, step, status=Status.finished, result=Result.passed) self.create_target(job, step, status=Status.in_progress, result_source=ResultSource.from_parent) with mock.patch.object(sync_job_step, 'allow_absent_from_db', True): sync_job_step( step_id=step.id.hex, task_id=step.id.hex, parent_task_id=job.id.hex, ) db.session.expire(step) step = JobStep.query.get(step.id) assert step.status == Status.finished assert step.result == Result.passed
def test_missing_test_results_and_expected(self, get_implementation, queue_delay): implementation = mock.Mock() get_implementation.return_value = implementation def mark_finished(step): step.status = Status.finished step.result = Result.passed implementation.update_step.side_effect = mark_finished project = self.create_project() build = self.create_build(project=project) job = self.create_job(build=build) plan = self.create_plan() self.create_step(plan, implementation='test', order=0) db.session.add( ItemOption(item_id=plan.id, name='build.expect-tests', value='1')) db.session.commit() self.create_job_plan(job, plan) phase = self.create_jobphase( job=job, date_started=datetime(2013, 9, 19, 22, 15, 24), ) step = self.create_jobstep(phase) sync_job_step( step_id=step.id.hex, task_id=step.id.hex, parent_task_id=job.id.hex, ) db.session.expire(step) step = JobStep.query.get(step.id) assert step.status == Status.finished assert step.result == Result.failed stat = ItemStat.query.filter( ItemStat.item_id == step.id, ItemStat.name == 'tests_missing', ).first() assert stat.value == 1 assert FailureReason.query.filter( FailureReason.step_id == step.id, FailureReason.reason == 'missing_tests', )
def test_timed_out(self, get_implementation, mock_has_timed_out): # Simulate test type which doesn't interact with artifacts store. responses.add(responses.GET, SyncJobStepTest.ARTIFACTSTORE_REQUEST_RE, body='', status=404) implementation = mock.Mock() get_implementation.return_value = implementation project = self.create_project() build = self.create_build(project=project) job = self.create_job(build=build) plan = self.create_plan(project) self.create_step(plan, implementation='test', order=0) jobplan = self.create_job_plan(job, plan) phase = self.create_jobphase(job) step = self.create_jobstep(phase, status=Status.in_progress) mock_has_timed_out.return_value = True current_app.config['DEFAULT_JOB_TIMEOUT_MIN'] = 99 with mock.patch.object(sync_job_step, 'allow_absent_from_db', True): sync_job_step( step_id=step.id.hex, task_id=step.id.hex, parent_task_id=job.id.hex ) mock_has_timed_out.assert_called_once_with(step, jobplan, default_timeout=99) get_implementation.assert_called_once_with() implementation.cancel_step.assert_called_once_with( step=step, ) assert step.result == Result.failed assert step.status == Status.finished assert FailureReason.query.filter( FailureReason.step_id == step.id, FailureReason.reason == 'timeout', )
def test_timed_out(self, get_implementation, mock_has_timed_out): # Simulate test type which doesn't interact with artifacts store. responses.add(responses.GET, SyncJobStepTest.ARTIFACTSTORE_REQUEST_RE, body='', status=404) implementation = mock.Mock() get_implementation.return_value = implementation project = self.create_project() build = self.create_build(project=project) job = self.create_job(build=build) plan = self.create_plan(project) self.create_step(plan, implementation='test', order=0) jobplan = self.create_job_plan(job, plan) phase = self.create_jobphase(job) step = self.create_jobstep(phase, status=Status.in_progress) mock_has_timed_out.return_value = True current_app.config['DEFAULT_JOB_TIMEOUT_MIN'] = 99 with mock.patch.object(sync_job_step, 'allow_absent_from_db', True): sync_job_step(step_id=step.id.hex, task_id=step.id.hex, parent_task_id=job.id.hex) mock_has_timed_out.assert_called_once_with(step, jobplan, default_timeout=99) implementation.cancel_step.assert_called_once_with(step=step, ) assert step.result == Result.failed assert step.status == Status.finished assert FailureReason.query.filter( FailureReason.step_id == step.id, FailureReason.reason == 'timeout', )
def test_timed_out(self, get_implementation, mock_has_timed_out): implementation = mock.Mock() get_implementation.return_value = implementation project = self.create_project() build = self.create_build(project=project) job = self.create_job(build=build) plan = self.create_plan(project) self.create_step(plan, implementation='test', order=0) jobplan = self.create_job_plan(job, plan) phase = self.create_jobphase(job) step = self.create_jobstep(phase, status=Status.in_progress) mock_has_timed_out.return_value = True current_app.config['DEFAULT_JOB_TIMEOUT_MIN'] = 99 with mock.patch.object(sync_job_step, 'allow_absent_from_db', True): sync_job_step( step_id=step.id.hex, task_id=step.id.hex, parent_task_id=job.id.hex ) mock_has_timed_out.assert_called_once_with(step, jobplan, default_timeout=99) get_implementation.assert_called_once_with() implementation.cancel_step.assert_called_once_with( step=step, ) assert step.result == Result.failed assert step.status == Status.finished assert FailureReason.query.filter( FailureReason.step_id == step.id, FailureReason.reason == 'timeout', )
def test_failure_reasons(self, get_implementation): # Simulate test type which doesn't interact with artifacts store. responses.add(responses.GET, SyncJobStepTest.ARTIFACTSTORE_REQUEST_RE, body='', status=404) implementation = mock.Mock() get_implementation.return_value = implementation project = self.create_project() build = self.create_build(project=project) job = self.create_job(build=build) plan = self.create_plan(project) self.create_step(plan, implementation='test', order=0) self.create_job_plan(job, plan) phase = self.create_jobphase(job) step = self.create_jobstep(phase, status=Status.finished, result=Result.passed) db.session.add( FailureReason(step_id=step.id, job_id=job.id, build_id=build.id, project_id=project.id, reason='missing_manifest_json')) db.session.commit() with mock.patch.object(sync_job_step, 'allow_absent_from_db', True): sync_job_step(step_id=step.id.hex, task_id=step.id.hex, parent_task_id=job.id.hex) assert step.result == Result.infra_failed
def test_timed_out(self, get_implementation, mock_has_timed_out): implementation = mock.Mock() get_implementation.return_value = implementation project = self.create_project() build = self.create_build(project=project) job = self.create_job(build=build) plan = self.create_plan(project) self.create_step(plan, implementation='test', order=0) jobplan = self.create_job_plan(job, plan) phase = self.create_jobphase(job) step = self.create_jobstep(phase, status=Status.in_progress) mock_has_timed_out.return_value = True sync_job_step( step_id=step.id.hex, task_id=step.id.hex, parent_task_id=job.id.hex ) mock_has_timed_out.assert_called_once_with(step, jobplan) get_implementation.assert_called_once_with() implementation.cancel_step.assert_called_once_with( step=step, ) assert step.result == Result.failed assert FailureReason.query.filter( FailureReason.step_id == step.id, FailureReason.reason == 'timeout', )
def test_finished(self, get_implementation, queue_delay): implementation = mock.Mock() get_implementation.return_value = implementation def mark_finished(step): step.status = Status.finished step.result = Result.failed implementation.update_step.side_effect = mark_finished project = self.create_project() build = self.create_build(project=project) job = self.create_job(build=build) plan = self.create_plan() self.create_step(plan, implementation='test', order=0) self.create_job_plan(job, plan) phase = self.create_jobphase(job) step = self.create_jobstep(phase) task = self.create_task( parent_id=job.id, task_id=step.id, task_name='sync_job_step', status=Status.finished, ) db.session.add( TestCase( name='test', step_id=step.id, job_id=job.id, project_id=project.id, result=Result.failed, )) db.session.add( FileCoverage( job=job, step=step, project=job.project, filename='foo.py', data='CCCUUUCCCUUNNN', lines_covered=6, lines_uncovered=5, diff_lines_covered=3, diff_lines_uncovered=2, )) db.session.commit() sync_job_step( step_id=step.id.hex, task_id=step.id.hex, parent_task_id=job.id.hex, ) get_implementation.assert_called_once_with() implementation.update_step.assert_called_once_with(step=step) db.session.expire(step) db.session.expire(task) step = JobStep.query.get(step.id) assert step.status == Status.finished task = Task.query.get(task.id) assert task.status == Status.finished assert len(queue_delay.mock_calls) == 0 stat = ItemStat.query.filter( ItemStat.item_id == step.id, ItemStat.name == 'tests_missing', ).first() assert stat.value == 0 stat = ItemStat.query.filter( ItemStat.item_id == step.id, ItemStat.name == 'lines_covered', ).first() assert stat.value == 6 stat = ItemStat.query.filter( ItemStat.item_id == step.id, ItemStat.name == 'lines_uncovered', ).first() assert stat.value == 5 stat = ItemStat.query.filter( ItemStat.item_id == step.id, ItemStat.name == 'diff_lines_covered', ).first() assert stat.value == 3 stat = ItemStat.query.filter( ItemStat.item_id == step.id, ItemStat.name == 'diff_lines_uncovered', ).first() assert stat.value == 2 assert FailureReason.query.filter( FailureReason.step_id == step.id, FailureReason.reason == 'test_failures', )
def test_finished(self, get_implementation, queue_delay): # Simulate test type which doesn't interact with artifacts store. responses.add(responses.GET, SyncJobStepTest.ARTIFACTSTORE_REQUEST_RE, body='', status=404) implementation = mock.Mock() get_implementation.return_value = implementation def mark_finished(step): step.status = Status.finished step.result = Result.failed implementation.update_step.side_effect = mark_finished project = self.create_project() build = self.create_build(project=project) job = self.create_job(build=build) plan = self.create_plan(project) self.create_step(plan, implementation='test', order=0) self.create_job_plan(job, plan) phase = self.create_jobphase(job) step = self.create_jobstep(phase) task = self.create_task( parent_id=job.id, task_id=step.id, task_name='sync_job_step', status=Status.finished, ) db.session.add(TestCase( name='test', step_id=step.id, job_id=job.id, project_id=project.id, result=Result.failed, )) db.session.add(FileCoverage( job=job, step=step, project=job.project, filename='foo.py', data='CCCUUUCCCUUNNN', lines_covered=6, lines_uncovered=5, diff_lines_covered=3, diff_lines_uncovered=2, )) db.session.commit() sync_job_step( step_id=step.id.hex, task_id=step.id.hex, parent_task_id=job.id.hex, ) implementation.update_step.assert_called_once_with( step=step ) db.session.expire(step) db.session.expire(task) step = JobStep.query.get(step.id) assert step.status == Status.finished task = Task.query.get(task.id) assert task.status == Status.finished assert len(queue_delay.mock_calls) == 0 stat = ItemStat.query.filter( ItemStat.item_id == step.id, ItemStat.name == 'tests_missing', ).first() assert stat.value == 0 stat = ItemStat.query.filter( ItemStat.item_id == step.id, ItemStat.name == 'lines_covered', ).first() assert stat.value == 6 stat = ItemStat.query.filter( ItemStat.item_id == step.id, ItemStat.name == 'lines_uncovered', ).first() assert stat.value == 5 stat = ItemStat.query.filter( ItemStat.item_id == step.id, ItemStat.name == 'diff_lines_covered', ).first() assert stat.value == 3 stat = ItemStat.query.filter( ItemStat.item_id == step.id, ItemStat.name == 'diff_lines_uncovered', ).first() assert stat.value == 2 assert FailureReason.query.filter( FailureReason.step_id == step.id, FailureReason.reason == 'test_failures', )