Skip to content
Merged
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
2.41.0
* Fixed bug with api access using api_key without login/pass
* Fix for download_test_screenshots method to work with version
2.40
* Fixed download_test_screenshots method to work with 2.39+ version of the Testdroid API
2.6.2
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import sys, os


version = '2.40.0'
version = '2.41.0'

setup(name='testdroid',
version=version,
Expand Down
21 changes: 11 additions & 10 deletions testdroid/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from optparse import OptionParser
from datetime import datetime

__version__ = '2.40'
__version__ = '2.41.0'

FORMAT = "%(message)s"
logging.basicConfig(format=FORMAT)
Expand Down Expand Up @@ -488,13 +488,14 @@ def wait_test_run(self, project_id, test_run_id):
print "Awaiting completion of test run with id %s. Will wait forever polling every %smins." % (test_run_id, Testdroid.polling_interval_mins)
while True:
time.sleep(Testdroid.polling_interval_mins*60)
self.access_token = None #WORKAROUND: access token thinks it's still valid,
# > token valid for another 633.357925177
#whilst this happens:
# > Couldn't establish the state of the test run with id: 72593732. Aborting
# > {u'error_description': u'Invalid access token: b3e62604-9d2a-49dc-88f5-89786ff5a6b6', u'error': u'invalid_token'}

self.get_token() #in case it expired
if not self.api_key:
self.access_token = None #WORKAROUND: access token thinks it's still valid,
# > token valid for another 633.357925177
#whilst this happens:
# > Couldn't establish the state of the test run with id: 72593732. Aborting
# > {u'error_description': u'Invalid access token: b3e62604-9d2a-49dc-88f5-89786ff5a6b6', u'error': u'invalid_token'}

self.get_token() #in case it expired
testRunStatus = self.get_test_run(project_id, test_run_id)
if testRunStatus and testRunStatus.has_key('state'):
if testRunStatus['state'] == "FINISHED":
Expand Down Expand Up @@ -606,7 +607,7 @@ def download_test_screenshots(self, project_id, test_run_id):

logger.info("");
for device_run in device_runs['data']:
if device_run['state'] == "SUCCEEDED":
if device_run['state'] in ["SUCCEEDED", "FAILED", "ABORTED", "WARNING", "TIMEOUT"]:
directory = "%s-%s/%d-%s/screenshots" % (test_run['id'], test_run['displayName'], device_run['id'], device_run['device']['displayName'])
screenshots = self.get_device_run_screenshots_list(project_id, test_run_id, device_run['id'])
no_screenshots = True
Expand Down Expand Up @@ -638,7 +639,7 @@ def download_test_screenshots(self, project_id, test_run_id):
if no_screenshots:
logger.info("Device %s has no screenshots - skipping" % device_run['device']['displayName'])
else:
logger.info("Device %s has failed or has not finished - skipping" % device_run['device']['displayName'])
logger.info("Device %s has errored or has not finished - skipping" % device_run['device']['displayName'])

def get_parser(self):
class MyParser(OptionParser):
Expand Down