Created
December 17, 2015 10:18
-
-
Save Ch00k/03153b45f838e4e13a87 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import urllib | |
import numpy as np | |
from stbt import press, wait_until, match, Region | |
black_rect = np.empty((8, 8, 3), dtype=np.uint8) | |
black_rect.fill(16) | |
region = Region(0, 0, width=8, height=8) | |
def test_motorola(): | |
while True: | |
start = time.time() | |
press('KEY_LEFT') | |
try: | |
assert wait_until(lambda: match(black_rect, region=region)) | |
except AssertionError: | |
send_result(0, 0) | |
else: | |
end = time.time() | |
send_result(start, end) | |
finally: | |
teardown() | |
def send_result(start_time, end_time): | |
urllib.urlopen('http://172.17.80.225:5000?time={0}'.format(end_time - start_time)) | |
def teardown(): | |
press('KEY_RIGHT') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment