Skip to content

Commit

Permalink
freaking network, freaking python... when it spazzes out on you, defa…
Browse files Browse the repository at this point in the history
…ults to localhost for the tests
  • Loading branch information
lukeis committed Sep 10, 2014
1 parent 0e4a981 commit ef11b75
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions py/test/selenium/webdriver/common/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ def get_interface_ip(ifname):
)[20:24])

def get_lan_ip():
ip = socket.gethostbyname(socket.gethostname())
try:
ip = socket.gethostbyname(socket.gethostname())
except:
return '0.0.0.0'
if ip.startswith("127.") and os.name != "nt":
interfaces = ["eth0","eth1","eth2","en0","en1","en2","en3","en4","wlan0","wlan1","wifi0","ath0","ath1","ppp0"]
for ifname in interfaces:
Expand All @@ -28,4 +31,4 @@ def get_lan_ip():
break
except IOError:
pass
return ip
return ip

0 comments on commit ef11b75

Please sign in to comment.