forked from kiwix/kiwix-android
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtestdroid.py
More file actions
executable file
·30 lines (26 loc) · 802 Bytes
/
testdroid.py
File metadata and controls
executable file
·30 lines (26 loc) · 802 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/env python
import os
import requests
import sys
import time
PROJECT_ID = 116910522
print "Running tests"
sys.stdout.flush()
runID = os.environ['TRAVIS_BUILD_NUMBER']
resultsUrl = os.environ['TESTDROID_RUNNER_RESULTS']
testName = "Auto Test {}".format(runID)
for x in range(0, 200):
r = requests.get(resultsUrl)
result = list(filter(lambda run: run.get("displayName") == testName, r.json().get("data")))
if len(result) > 0 and result[0].get("state") == "FINISHED":
ratio = result[0].get("successRatio")
if ratio == 1.0:
print "All tests passed"
sys.exit(0)
else:
raise AssertionError("Success ratio only: {}".format(ratio))
else:
print "Waiting for results"
sys.stdout.flush()
time.sleep(30)
raise TimeoutError("Test not found/complete")