udev: correctly re-raise access exception

This commit is contained in:
Peter F. Patel-Schneider 2025-10-10 19:45:51 -04:00
parent 0335dd003c
commit 07a6923bd5
4 changed files with 6 additions and 6 deletions

View File

@ -323,7 +323,7 @@ def open_path(device_path):
if e.errno == errno.EACCES:
sleep(0.1)
else:
raise
raise e
def close(device_handle) -> None:

View File

@ -87,10 +87,10 @@ def create_device(low_level: LowLevelInterface, device_info, setting_callback=No
except OSError as e:
logger.exception("open %s", device_info)
if e.errno == errno.EACCES:
raise
except Exception:
raise e
except Exception as e:
logger.exception("open %s", device_info)
raise
raise e
class Device:

View File

@ -599,6 +599,6 @@ def create_receiver(low_level: LowLevelInterface, device_info, setting_callback=
except OSError as e:
logger.exception("open %s", device_info)
if e.errno == errno.EACCES:
raise
raise e
except Exception:
logger.exception("open %s", device_info)

View File

@ -86,7 +86,7 @@ def test_create_device(device_info, responses, expected_success):
with pytest.raises(PermissionError):
device.create_device(low_level_mock, device_info)
elif not expected_success:
with pytest.raises(TypeError):
with pytest.raises(Exception): # noqa: B017
device.create_device(low_level_mock, device_info)
else:
test_device = device.create_device(low_level_mock, device_info)