Skip to content

Commit bb3ee2c

Browse files
authored
Handle nvml.NotSupportedError on tests (#1487)
1 parent 709c402 commit bb3ee2c

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

cuda_bindings/tests/nvml/test_pynvml.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,13 +136,19 @@ def test_device_get_p2p_status(handles, index):
136136

137137
def test_device_get_power_usage(ngpus, handles):
138138
for i in range(ngpus):
139-
power_mwatts = nvml.device_get_power_usage(handles[i])
139+
try:
140+
power_mwatts = nvml.device_get_power_usage(handles[i])
141+
except nvml.NotSupportedError:
142+
pytest.skip("device_get_power_usage not supported")
140143
assert power_mwatts >= 0.0
141144

142145

143146
def test_device_get_total_energy_consumption(ngpus, handles):
144147
for i in range(ngpus):
145-
energy_mjoules1 = nvml.device_get_total_energy_consumption(handles[i])
148+
try:
149+
energy_mjoules1 = nvml.device_get_total_energy_consumption(handles[i])
150+
except nvml.NotSupportedError:
151+
pytest.skip("device_get_total_energy_consumption not supported")
146152
for j in range(10): # idle for 150 ms
147153
time.sleep(0.015) # and check for increase every 15 ms
148154
energy_mjoules2 = nvml.device_get_total_energy_consumption(handles[i])

0 commit comments

Comments
 (0)