|
5 | 5 | from optparse import OptionParser
|
6 | 6 | from datetime import datetime
|
7 | 7 |
|
8 |
| -__version__ = '2.40' |
| 8 | +__version__ = '2.41.0' |
9 | 9 |
|
10 | 10 | FORMAT = "%(message)s"
|
11 | 11 | logging.basicConfig(format=FORMAT)
|
@@ -488,13 +488,14 @@ def wait_test_run(self, project_id, test_run_id):
|
488 | 488 | print "Awaiting completion of test run with id %s. Will wait forever polling every %smins." % (test_run_id, Testdroid.polling_interval_mins)
|
489 | 489 | while True:
|
490 | 490 | time.sleep(Testdroid.polling_interval_mins*60)
|
491 |
| - self.access_token = None #WORKAROUND: access token thinks it's still valid, |
492 |
| - # > token valid for another 633.357925177 |
493 |
| - #whilst this happens: |
494 |
| - # > Couldn't establish the state of the test run with id: 72593732. Aborting |
495 |
| - # > {u'error_description': u'Invalid access token: b3e62604-9d2a-49dc-88f5-89786ff5a6b6', u'error': u'invalid_token'} |
496 |
| - |
497 |
| - self.get_token() #in case it expired |
| 491 | + if not self.api_key: |
| 492 | + self.access_token = None #WORKAROUND: access token thinks it's still valid, |
| 493 | + # > token valid for another 633.357925177 |
| 494 | + #whilst this happens: |
| 495 | + # > Couldn't establish the state of the test run with id: 72593732. Aborting |
| 496 | + # > {u'error_description': u'Invalid access token: b3e62604-9d2a-49dc-88f5-89786ff5a6b6', u'error': u'invalid_token'} |
| 497 | + |
| 498 | + self.get_token() #in case it expired |
498 | 499 | testRunStatus = self.get_test_run(project_id, test_run_id)
|
499 | 500 | if testRunStatus and testRunStatus.has_key('state'):
|
500 | 501 | if testRunStatus['state'] == "FINISHED":
|
@@ -606,7 +607,7 @@ def download_test_screenshots(self, project_id, test_run_id):
|
606 | 607 |
|
607 | 608 | logger.info("");
|
608 | 609 | for device_run in device_runs['data']:
|
609 |
| - if device_run['state'] == "SUCCEEDED": |
| 610 | + if device_run['state'] in ["SUCCEEDED", "FAILED", "ABORTED", "WARNING", "TIMEOUT"]: |
610 | 611 | directory = "%s-%s/%d-%s/screenshots" % (test_run['id'], test_run['displayName'], device_run['id'], device_run['device']['displayName'])
|
611 | 612 | screenshots = self.get_device_run_screenshots_list(project_id, test_run_id, device_run['id'])
|
612 | 613 | no_screenshots = True
|
@@ -638,7 +639,7 @@ def download_test_screenshots(self, project_id, test_run_id):
|
638 | 639 | if no_screenshots:
|
639 | 640 | logger.info("Device %s has no screenshots - skipping" % device_run['device']['displayName'])
|
640 | 641 | else:
|
641 |
| - logger.info("Device %s has failed or has not finished - skipping" % device_run['device']['displayName']) |
| 642 | + logger.info("Device %s has errored or has not finished - skipping" % device_run['device']['displayName']) |
642 | 643 |
|
643 | 644 | def get_parser(self):
|
644 | 645 | class MyParser(OptionParser):
|
|
0 commit comments