Skip to content

Commit

Permalink
10 tries, not 100
Browse files Browse the repository at this point in the history
  • Loading branch information
Firmware Batman committed Aug 29, 2017
1 parent f7264fc commit c15f713
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions tests/automated/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,17 @@ def _connect_wifi(dongle_id, pw):
os.system("networksetup -setairportnetwork en0 %s %s" % (ssid, pw))
else:
cnt = 0
while 1:
MAX_TRIES = 10
while cnt < MAX_TRIES:
print "WIFI: scanning %d" % cnt
os.system("nmcli device wifi rescan")
wifi_scan = filter(lambda x: ssid in x, subprocess.check_output(["nmcli","dev", "wifi", "list"]).split("\n"))
if len(wifi_scan) != 0:
break
time.sleep(0.1)
# 100 tries, ~10 seconds max
# MAX_TRIES tries, ~10 seconds max
cnt += 1
assert cnt < 100
assert cnt < MAX_TRIES
os.system("nmcli d wifi connect %s password %s" % (ssid, pw))

# TODO: confirm that it's connected to the right panda
Expand Down

0 comments on commit c15f713

Please sign in to comment.