From 6c98d15d5071ac2581dfef651d0044ae860aa59f Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Tue, 13 Jan 2026 13:02:05 -0800 Subject: [PATCH] cuda_core/tests/system/test_system_device.py::test_persistence_mode_enabled: xfail nvml.NoPermissionError =================================== FAILURES =================================== ________________________ test_persistence_mode_enabled _________________________ @pytest.mark.skipif(helpers.IS_WSL or helpers.IS_WINDOWS, reason="Persistence mode not supported on WSL or Windows") def test_persistence_mode_enabled(): for device in system.Device.get_all_devices(): is_enabled = device.persistence_mode_enabled assert isinstance(is_enabled, bool) try: > device.persistence_mode_enabled = False ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ device = is_enabled = False tests/system/test_system_device.py:255: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ cuda/core/system/_device.pyx:589: in cuda.core.system._device.Device.persistence_mode_enabled.__set__ nvml.device_set_persistence_mode( cuda/bindings/_nvml.pyx:23818: in cuda.bindings._nvml.device_set_persistence_mode ??? cuda/bindings/_nvml.pyx:23829: in cuda.bindings._nvml.device_set_persistence_mode ??? _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > ??? E cuda.bindings._nvml.NoPermissionError: Insufficient Permissions cuda/bindings/_nvml.pyx:1811: NoPermissionError During handling of the above exception, another exception occurred: @pytest.mark.skipif(helpers.IS_WSL or helpers.IS_WINDOWS, reason="Persistence mode not supported on WSL or Windows") def test_persistence_mode_enabled(): for device in system.Device.get_all_devices(): is_enabled = device.persistence_mode_enabled assert isinstance(is_enabled, bool) try: device.persistence_mode_enabled = False assert device.persistence_mode_enabled is False finally: > device.persistence_mode_enabled = is_enabled ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ device = is_enabled = False tests/system/test_system_device.py:258: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ cuda/core/system/_device.pyx:589: in cuda.core.system._device.Device.persistence_mode_enabled.__set__ nvml.device_set_persistence_mode( cuda/bindings/_nvml.pyx:23818: in cuda.bindings._nvml.device_set_persistence_mode ??? cuda/bindings/_nvml.pyx:23829: in cuda.bindings._nvml.device_set_persistence_mode ??? _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > ??? E cuda.bindings._nvml.NoPermissionError: Insufficient Permissions cuda/bindings/_nvml.pyx:1811: NoPermissionError --- cuda_core/tests/system/test_system_device.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cuda_core/tests/system/test_system_device.py b/cuda_core/tests/system/test_system_device.py index 52c08533ff..422e60a55a 100644 --- a/cuda_core/tests/system/test_system_device.py +++ b/cuda_core/tests/system/test_system_device.py @@ -253,6 +253,9 @@ def test_persistence_mode_enabled(): assert isinstance(is_enabled, bool) try: device.persistence_mode_enabled = False + except nvml.NoPermissionError as e: + pytest.xfail(f"nvml.NoPermissionError: {e}") + try: assert device.persistence_mode_enabled is False finally: device.persistence_mode_enabled = is_enabled