本文整理匯總了Python中pyudev.Device.from_sys_path方法的典型用法代碼示例。如果您正苦於以下問題:Python Device.from_sys_path方法的具體用法?Python Device.from_sys_path怎麽用?Python Device.from_sys_path使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pyudev.Device
的用法示例。
在下文中一共展示了Device.from_sys_path方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_from_sys_path_device_not_found
# 需要導入模塊: from pyudev import Device [as 別名]
# 或者: from pyudev.Device import from_sys_path [as 別名]
def test_from_sys_path_device_not_found(self, context):
sys_path = "there_will_not_be_such_a_device"
with pytest.raises(DeviceNotFoundAtPathError) as exc_info:
Device.from_sys_path(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 Device [as 別名]
# 或者: from pyudev.Device import from_sys_path [as 別名]
def test_from_sys_path(self, context, device_data):
device = Device.from_sys_path(context, device_data.sys_path)
assert device is not None
assert device.sys_path == device_data.sys_path
示例3: test_from_path
# 需要導入模塊: from pyudev import Device [as 別名]
# 或者: from pyudev.Device import from_sys_path [as 別名]
def test_from_path(self, context, device_path, sys_path):
device = Device.from_path(context, device_path)
assert device is not None
assert device == Device.from_sys_path(context, sys_path)
assert device == Device.from_path(context, sys_path)