Skip to content

Commit 77ed256

Browse files
author
yiwenxiu
committed
ci: change wlan to ethernet
1 parent b2d92fd commit 77ed256

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

examples/pytest_esp_matter_light.py

+17-3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
import netifaces
1010
from typing import Tuple
1111
from pytest_embedded import Dut
12+
import os
13+
import yaml
14+
1215

1316
CURRENT_DIR_LIGHT = str(pathlib.Path(__file__).parent)+'/light'
1417
CHIP_TOOL_EXE = str(pathlib.Path(__file__).parent)+ '/../connectedhomeip/connectedhomeip/out/host/chip-tool'
@@ -137,9 +140,20 @@ def test_matter_commissioning_c6(dut:Dut) -> None:
137140

138141
# get the host interface name
139142
def get_host_interface_name() -> str:
140-
interfaces = netifaces.interfaces()
141-
interface_name = [s for s in interfaces if 'wl' in s][0]
142-
return str(interface_name)
143+
home_dir = os.path.expanduser("~")
144+
config_path = os.path.join(home_dir, "config", "env_config.yml")
145+
if os.path.exists(config_path):
146+
with open(config_path, 'r') as file:
147+
config = yaml.safe_load(file)
148+
interface_name = config.get("interface_name")
149+
if interface_name:
150+
return str(interface_name)
151+
else:
152+
print("Warning: Configuration file found but 'interface_name' is not defined.")
153+
154+
if "eth1" in netifaces.interfaces():
155+
return "eth1"
156+
raise Exception("No valid network interface found. Please ensure 'eth1' exists or configure 'interface_name' in config/env_config file.")
143157

144158

145159
# reset host interface

0 commit comments

Comments
 (0)