def save(self, test_list): if not test_list: return job = self.job organization_id = job.organization_id project_id = job.project_id # create all test cases for test in test_list: testcase = TestCase( job=job, organization_id=organization_id, project_id=project_id, hash=test.hash, name=test.name, duration=test.duration, message=test.message, result=test.result, ) db.session.add(testcase) if test.artifacts: for ta in test.artifacts: testartifact = Artifact( organization_id=organization_id, project_id=project_id, testcase_id=testcase.id, job_id=job.id, name=ta['name'], # TODO(dcramer): mimetype detection? # type=getattr(Artifactta['type'], ) testartifact.save_base64_content(ta['base64']) db.session.add(testartifact) db.session.commit() try: self._record_test_counts(test_list) self._record_test_failures(test_list) self._record_test_duration(test_list) except Exception: current_app.logger.exception( 'Failed to record aggregate test statistics')
def save(self, test_list): if not test_list: return job = self.job repository_id = job.repository_id # create all test cases for test in test_list: testcase = TestCase( job=job, repository_id=repository_id, hash=test.hash, name=test.name, duration=test.duration, message=test.message, result=test.result, ) db.session.add(testcase) if test.artifacts: for ta in test.artifacts: testartifact = Artifact( repository_id=repository_id, testcase_id=testcase.id, job_id=job.id, name=ta["name"], # TODO(dcramer): mimetype detection? # type=getattr(Artifactta['type'], ) testartifact.save_base64_content(ta["base64"]) db.session.add(testartifact) db.session.flush() try: self._record_test_counts(test_list) self._record_test_failures(test_list) self._record_test_duration(test_list) except Exception: current_app.logger.exception( "Failed to record aggregate test statistics")