本文整理汇总了Python中pyudev.Devices.from_sys_path方法的典型用法代码示例。如果您正苦于以下问题:Python Devices.from_sys_path方法的具体用法?Python Devices.from_sys_path怎么用?Python Devices.from_sys_path使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyudev.Devices
的用法示例。
在下文中一共展示了Devices.from_sys_path方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_from_sys_path_device_not_found
# 需要导入模块: from pyudev import Devices [as 别名]
# 或者: from pyudev.Devices import from_sys_path [as 别名]
def test_from_sys_path_device_not_found(self, a_context):
sys_path = 'there_will_not_be_such_a_device'
with pytest.raises(DeviceNotFoundAtPathError) as exc_info:
Devices.from_sys_path(a_context, sys_path)
error = exc_info.value
assert error.sys_path == sys_path
assert str(error) == 'No device at {0!r}'.format(sys_path)
示例2: test_from_sys_path
# 需要导入模块: from pyudev import Devices [as 别名]
# 或者: from pyudev.Devices import from_sys_path [as 别名]
def test_from_sys_path(self, a_context, device_datum):
device = Devices.from_sys_path(a_context, device_datum.sys_path)
assert device is not None
assert device.sys_path == device_datum.sys_path