From a49f90d67f7d677e1ef37e757e903cc60503ff88 Mon Sep 17 00:00:00 2001 From: Dan Yeaw Date: Fri, 28 Feb 2025 13:19:44 -0500 Subject: [PATCH] Remove try except blocks --- core/tests/python/tests/test_media.py | 30 ++++++++++----------------- 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/core/tests/python/tests/test_media.py b/core/tests/python/tests/test_media.py index 2a607749..1cf4faa1 100644 --- a/core/tests/python/tests/test_media.py +++ b/core/tests/python/tests/test_media.py @@ -86,20 +86,16 @@ def test_device_getitem(): ) async def test_list_devices(): """Test that list_devices returns a list of Device objects.""" - try: - devices = await media.list_devices() - assert isinstance(devices, list), "list_devices should return a list" + devices = await media.list_devices() + assert isinstance(devices, list), "list_devices should return a list" - # We don't assert on the number of devices since that's environment-dependent - if devices: - device = devices[0] - assert hasattr(device, "id"), "Device should have id property" - assert hasattr(device, "group"), "Device should have group property" - assert hasattr(device, "kind"), "Device should have kind property" - assert hasattr(device, "label"), "Device should have label property" - except Exception as e: - # Ensure test passes even if there's a permission issue - assert True, f"list_devices failed but test passes: {str(e)}" + # We don't assert on the number of devices since that's environment-dependent + if devices: + device = devices[0] + assert hasattr(device, "id"), "Device should have id property" + assert hasattr(device, "group"), "Device should have group property" + assert hasattr(device, "kind"), "Device should have kind property" + assert hasattr(device, "label"), "Device should have label property" @upytest.skip( @@ -108,12 +104,8 @@ async def test_list_devices(): ) async def test_device_load(): """Test that Device.load returns a media stream.""" - try: - stream = await media.Device.load(video=True) - assert hasattr(stream, "active"), "Stream should have active property" - except Exception as e: - # Ensure test passes even if there's a permission issue - assert True, f"Device.load failed but test passes: {str(e)}" + stream = await media.Device.load(video=True) + assert hasattr(stream, "active"), "Stream should have active property" @upytest.skip(