8000 Remove try except blocks · pyscript/pyscript@a49f90d · GitHub
[go: up one dir, main page]

Skip to content

Commit a49f90d

Browse files
danyeawntoll
authored andcommitted
Remove try except blocks
1 parent ecd0451 commit a49f90d

File tree

1 file changed

+12
-20
lines changed

1 file changed

+12
-20
lines changed

core/tests/python/tests/test_media.py

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -86,20 +86,16 @@ def test_device_getitem():
8686
)
8787
async def test_list_devices():
8888
"""Test that list_devices returns a list of Device objects."""
89-
try:
90-
devices = await media.list_devices()
91-
assert isinstance(devices, list), "list_devices should return a list"
92-
93-
# We don't assert on the number of devices since that's environment-dependent
94-
if devices:
95-
device = devices[0]
96-
assert hasattr(device, "id"), "Device should have id property"
97-
assert hasattr(device, "group"), "Device should have group property"
98-
assert hasattr(device, "kind"), "Device should have kind property"
99-
assert hasattr(device, "label"), "Device should have label property"
100-
except Exception as e:
101-
# Ensure test passes even if there's a permission issue
102-
assert True, f"list_devices failed but test passes: {str(e)}"
89+
devices = await media.list_devices()
90+
assert isinstance(devices, list), "list_devices should return a list"
91+
92+
# We don't assert on the number of devices since that's environment-dependent
93+
if devices:
94+
device = devices[0]
95+
assert hasattr(device, "id"), "Device should have id property"
96+
assert hasattr(device, "group"), "Device should have group property"
97+
assert hasattr(device, "kind"), "Device should have kind property"
98+
assert hasattr(device, "label"), "Device should have label property"
10399

104100

105101
@upytest.skip(
@@ -108,12 +104,8 @@ async def test_list_devices():
108104
)
109105
async def test_device_load():
110106
"""Test that Device.load returns a media stream."""
111-
try:
112-
stream = await media.Device.load(video=True)
113-
assert hasattr(stream, "active"), "Stream should have active property"
114-
except Exception as e:
115-
# Ensure test passes even if there's a permission issue
116-
assert True, f"Device.load failed but test passes: {str(e)}"
107+
stream = await media.Device.load(video=True)
108+
assert hasattr(stream, "active"), "Stream should have active property"
117109

118110

119111
@upytest.skip(

0 commit comments

Comments
 (0)
0