From b7a39ad2d19a5be4b5a1a16c184e08be0d602b1a Mon Sep 17 00:00:00 2001 From: Andrew Leech Date: Fri, 29 Apr 2022 22:47:58 +1000 Subject: [PATCH] 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 --- tests/run-multitests.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/tests/run-multitests.py b/tests/run-multitests.py index bb3ef185da..d8a4a48fa7 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 {}