Skip to content

Commit

Permalink
refactor(api): fixup lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
TheKevJames authored and andy-maier committed Dec 23, 2022
1 parent 2dbee19 commit 592da27
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions coveralls/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,18 +215,22 @@ def wear(self, dry_run=False):
response = requests.post(endpoint, files={'json_file': json_string},
verify=verify)

# check and adjust/resubmit if submission looks like it
# failed due to resubmission (non-unique)
# check and adjust/resubmit if submission looks like it failed due to
# resubmission (non-unique)
if response.status_code == 422:
self.config['service_job_id'] = '{}-{}'.format(
# attach a random value to ensure uniqueness
# TODO: an auto-incrementing integer might be easier to reason
# about if we could fetch the previous value
new_id = '{}-{}'.format(
self.config['service_job_id'], random.randint(0, sys.maxsize))
print('resubmitting with id {}'.format(new_id))

# ensure create_report uses updated data
self._data = None
self.config['service_job_id'] = new_id
self._data = None # force create_report to use updated data
json_string = self.create_report()

print('resubmitting with id {}'.format(
self.config['service_job_id']))
response = requests.post(endpoint, files={'json_file': self.create_report()},
response = requests.post(endpoint,
files={'json_file': json_string},
verify=verify)

try:
Expand Down

0 comments on commit 592da27

Please sign in to comment.