Skip to content

Commit c402669

Browse files
author
Sakari Rautiainen
authored
Merge pull request #71 from bitbar/devel
v2.41.0
2 parents 4f31a9a + 042f05f commit c402669

File tree

3 files changed

+15
-11
lines changed

3 files changed

+15
-11
lines changed

CHANGELOG

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
2.41.0
2+
* Fixed bug with api access using api_key without login/pass
3+
* Fix for download_test_screenshots method to work with version
14
2.40
25
* Fixed download_test_screenshots method to work with 2.39+ version of the Testdroid API
36
2.6.2

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import sys, os
44

55

6-
version = '2.40.0'
6+
version = '2.41.0'
77

88
setup(name='testdroid',
99
version=version,

testdroid/__init__.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from optparse import OptionParser
66
from datetime import datetime
77

8-
__version__ = '2.40'
8+
__version__ = '2.41.0'
99

1010
FORMAT = "%(message)s"
1111
logging.basicConfig(format=FORMAT)
@@ -488,13 +488,14 @@ def wait_test_run(self, project_id, test_run_id):
488488
print "Awaiting completion of test run with id %s. Will wait forever polling every %smins." % (test_run_id, Testdroid.polling_interval_mins)
489489
while True:
490490
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
498499
testRunStatus = self.get_test_run(project_id, test_run_id)
499500
if testRunStatus and testRunStatus.has_key('state'):
500501
if testRunStatus['state'] == "FINISHED":
@@ -606,7 +607,7 @@ def download_test_screenshots(self, project_id, test_run_id):
606607

607608
logger.info("");
608609
for device_run in device_runs['data']:
609-
if device_run['state'] == "SUCCEEDED":
610+
if device_run['state'] in ["SUCCEEDED", "FAILED", "ABORTED", "WARNING", "TIMEOUT"]:
610611
directory = "%s-%s/%d-%s/screenshots" % (test_run['id'], test_run['displayName'], device_run['id'], device_run['device']['displayName'])
611612
screenshots = self.get_device_run_screenshots_list(project_id, test_run_id, device_run['id'])
612613
no_screenshots = True
@@ -638,7 +639,7 @@ def download_test_screenshots(self, project_id, test_run_id):
638639
if no_screenshots:
639640
logger.info("Device %s has no screenshots - skipping" % device_run['device']['displayName'])
640641
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'])
642643

643644
def get_parser(self):
644645
class MyParser(OptionParser):

0 commit comments

Comments
 (0)