Skip to content

Commit 7ccd34e

Browse files
committed
Contain fan-count failures per device
1 parent 35ca799 commit 7ccd34e

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

‎cuda_core/tests/system/test_system_device.py‎

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -640,15 +640,22 @@ def test_clock_event_reasons(subtests):
640640

641641
def test_fan(subtests):
642642
for device in system.Device.get_all_devices():
643+
device_index = device.index
644+
num_fans = None
643645
# The fan APIs are only supported on discrete devices with fans,
644646
# but when they are not available `device.num_fans` returns 0.
645-
if device.num_fans == 0:
646-
with subtests.test(device_index=device.index):
647+
with subtests.test(device_index=device_index, fan_api="get_num_fans"):
648+
value = device.num_fans
649+
assert isinstance(value, int)
650+
assert value >= 0
651+
num_fans = value
652+
if num_fans == 0:
647653
pytest.skip("Device has no fans to test")
654+
if not num_fans:
648655
continue
649656

650-
for fan_idx in range(device.num_fans):
651-
with subtests.test(device_index=device.index, fan_index=fan_idx):
657+
for fan_idx in range(num_fans):
658+
with subtests.test(device_index=device_index, fan_index=fan_idx):
652659
fan_info = device.get_fan(fan_idx)
653660
assert isinstance(fan_info, _device.FanInfo)
654661

0 commit comments

Comments
 (0)