Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Harden test and coverage result parsing #80

Merged
merged 1 commit into from
Mar 1, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 18 additions & 6 deletions execute.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,15 @@ def _push_test_results(self):
with open(test_results_file, 'r') as results_file:
test_results = results_file.read()
self.log.debug('Successfully read test results, parsing')
test_results = json.loads(test_results)
test_results['jobId'] = self.job_id
self.shippable_adapter.post_test_results(test_results)
try:
test_results = json.loads(test_results)
test_results['jobId'] = self.job_id
except ValueError as err:
test_results = None
self.log.error(
'Error parsing test results: {0}'.format(str(err)))
if test_results is not None:
self.shippable_adapter.post_test_results(test_results)
else:
self.log.debug('No test results exist, skipping')

Expand All @@ -157,9 +163,15 @@ def _push_coverage_results(self):
coverage_results = results_file.read()

self.log.debug('Successfully read coverage results, parsing')
coverage_results = json.loads(coverage_results)
coverage_results['jobId'] = self.job_id
self.shippable_adapter.post_coverage_results(coverage_results)
try:
coverage_results = json.loads(coverage_results)
coverage_results['jobId'] = self.job_id
except ValueError as err:
coverage_results = None
self.log.error(
'Error parsing coverage results: {0}'.format(str(err)))
if coverage_results is not None:
self.shippable_adapter.post_coverage_results(coverage_results)
else:
self.log.debug('No coverage results exist,skipping')

Expand Down