Possible fix for Sauce ConnectionResetError (#13501)

This commit is contained in:
Yevheniia Berdnyk 2022-06-20 18:28:23 +03:00 committed by GitHub
parent 7f8ad610f4
commit e0373146da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 5 deletions

View File

@ -1,3 +1,5 @@
import time
import requests
import pytest
import re
@ -178,11 +180,16 @@ def pytest_configure(config):
response.raise_for_status()
file = BytesIO(response.content)
del response
for _ in range(3):
try:
requests.post('http://saucelabs.com/rest/v1/storage/'
+ sauce_username + '/' + test_suite_data.apk_name + '?overwrite=true',
auth=(sauce_username, sauce_access_key),
data=file,
headers={'Content-Type': 'application/octet-stream'})
break
except ConnectionError:
time.sleep(3)
else:
sauce.storage.upload_file(config.getoption('apk'))