File tree Expand file tree Collapse file tree 3 files changed +24
-0
lines changed
Expand file tree Collapse file tree 3 files changed +24
-0
lines changed Original file line number Diff line number Diff line change 2424from protoplaster .tests .pmic .UCD90320U .test import __file__ as UCD90320U_test
2525from protoplaster .tests .thermometer .TMP431 .test import __file__ as TMP431_test
2626from protoplaster .tests .i2c_mux .TCA9548A .test import __file__ as TCA9548A_test
27+ from protoplaster .tests .usb .test import __file__ as usb_test
2728from protoplaster .tests .simple .test import __file__ as simple_test
2829from protoplaster .tests .http_echo .test import __file__ as http_echo_test
2930from protoplaster .tools .tools import pr_err , pr_info , pr_warn
5152 "simple" : simple_test ,
5253 "ti_dac38j8x_eyescan" : ti_dac38j8x_eyescan_test ,
5354 "http_echo" : http_echo_test ,
55+ "usb" : usb_test ,
5456}
5557
5658
Original file line number Diff line number Diff line change 1+ from protoplaster .conf .module import ModuleName
2+ import os
3+
4+
5+ @ModuleName ("usb" )
6+ class TestUsb :
7+
8+ def setup_class (self ):
9+ assert hasattr (self , "device" ), "'device' is an obligatory argument"
10+ self .sysfs_path = f"/sys/bus/usb/devices/{ self .device } "
11+
12+ def test_sysfs_interface (self ):
13+ """
14+ {% macro test_sysfs_interface(device) -%}
15+ check if the sysfs interface exists: `{{ device['sysfs_path'] }}`
16+ {%- endmacro %}
17+ """
18+ assert os .path .exists (
19+ self .sysfs_path ), f"USB interface { self .sysfs_path } doesn't exist"
20+
21+ def name (self ):
22+ return f"usb({ self .device } )"
You can’t perform that action at this time.
0 commit comments