|
5 | 5 | from optparse import OptionParser
|
6 | 6 | from datetime import datetime
|
7 | 7 |
|
8 |
| -__version__ = '2.40' |
| 8 | +__version__ = '2.41.1' |
9 | 9 |
|
10 | 10 | FORMAT = "%(message)s"
|
11 | 11 | logging.basicConfig(format=FORMAT)
|
@@ -426,7 +426,7 @@ def set_project_framework(self, project_id, frameworkId):
|
426 | 426 |
|
427 | 427 | """ Start a test run on a device group
|
428 | 428 | """
|
429 |
| - def start_test_run(self, project_id, device_group_id=None, device_model_ids=None, name=None): |
| 429 | + def start_test_run(self, project_id, device_group_id=None, device_model_ids=None, name=None, additional_params={}): |
430 | 430 | me = self.get_me()
|
431 | 431 | payload={} if name is None else {'name':name}
|
432 | 432 | project = self.get_project(project_id)
|
@@ -461,6 +461,7 @@ def start_test_run(self, project_id, device_group_id=None, device_model_ids=None
|
461 | 461 |
|
462 | 462 | # Start run
|
463 | 463 | path = "/users/%s/projects/%s/runs" % ( me['id'], project_id )
|
| 464 | + payload.update(additional_params) |
464 | 465 | reply = self.post(path=path, payload=payload)
|
465 | 466 | print "Test run id: %s" % reply['id']
|
466 | 467 | print "Name: %s" % reply['displayName']
|
@@ -488,13 +489,14 @@ def wait_test_run(self, project_id, test_run_id):
|
488 | 489 | print "Awaiting completion of test run with id %s. Will wait forever polling every %smins." % (test_run_id, Testdroid.polling_interval_mins)
|
489 | 490 | while True:
|
490 | 491 | 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 |
| 492 | + if not self.api_key: |
| 493 | + self.access_token = None #WORKAROUND: access token thinks it's still valid, |
| 494 | + # > token valid for another 633.357925177 |
| 495 | + #whilst this happens: |
| 496 | + # > Couldn't establish the state of the test run with id: 72593732. Aborting |
| 497 | + # > {u'error_description': u'Invalid access token: b3e62604-9d2a-49dc-88f5-89786ff5a6b6', u'error': u'invalid_token'} |
| 498 | + |
| 499 | + self.get_token() #in case it expired |
498 | 500 | testRunStatus = self.get_test_run(project_id, test_run_id)
|
499 | 501 | if testRunStatus and testRunStatus.has_key('state'):
|
500 | 502 | if testRunStatus['state'] == "FINISHED":
|
|
0 commit comments