summaryrefslogtreecommitdiff
path: root/tests/run-multitests.py
diff options
context:
space:
mode:
authorAndrew Leech <andrew@alelec.net>2022-04-29 22:47:58 +1000
committerDamien George <damien@micropython.org>2022-06-03 14:35:37 +1000
commitb7a39ad2d19a5be4b5a1a16c184e08be0d602b1a (patch)
tree419c4059d3ede32913f14099a51ece118ec10b00 /tests/run-multitests.py
parent73a1ea881231e544ae7bc1f2b56064d61ed296e7 (diff)
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>
Diffstat (limited to 'tests/run-multitests.py')
-rwxr-xr-xtests/run-multitests.py15
1 files changed, 9 insertions, 6 deletions
diff --git a/tests/run-multitests.py b/tests/run-multitests.py
index bb3ef185d..d8a4a48fa 100755
--- a/tests/run-multitests.py
+++ b/tests/run-multitests.py
@@ -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
{}