tests/run-multitests.py: Read IP address from boot nic if available.

This works if your network is pre-configured in boot.py as an object called
"nic".  Without this, multitests expects to access the WLAN/LAN class which
isn't always correct.

Signed-off-by: Andrew Leech <andrew@alelec.net>
pull/8724/head
Andrew Leech 2022-04-29 22:47:58 +10:00 zatwierdzone przez Damien George
rodzic 73a1ea8812
commit b7a39ad2d1
1 zmienionych plików z 9 dodań i 6 usunięć

Wyświetl plik

@ -63,13 +63,16 @@ class multitest:
@staticmethod
def get_network_ip():
try:
import network
if hasattr(network, "WLAN"):
ip = network.WLAN().ifconfig()[0]
else:
ip = network.LAN().ifconfig()[0]
ip = nic.ifconfig()[0]
except:
ip = HOST_IP
try:
import network
if hasattr(network, "WLAN"):
ip = network.WLAN().ifconfig()[0]
else:
ip = network.LAN().ifconfig()[0]
except:
ip = HOST_IP
return ip
{}