@@ -729,3 +729,30 @@ def test_pstates():
729729 assert isinstance (utilization .percentage , int )
730730 assert isinstance (utilization .inc_threshold , int )
731731 assert isinstance (utilization .dec_threshold , int )
732+
733+
734+ @pytest .mark .skipif (helpers .IS_WSL or helpers .IS_WINDOWS , reason = "MIG not supported on WSL or Windows" )
735+ def test_mig ():
736+ for device in system .Device .get_all_devices ():
737+ with unsupported_before (device , DeviceArch .AMPERE ):
738+ mig = device .mig
739+
740+ assert isinstance (mig .is_mig_device , bool )
741+ if mig .is_mig_device :
742+ assert isinstance (mig .mode , bool )
743+ assert isinstance (mig .pending_mode , bool )
744+
745+ device_count = mig .get_device_count ()
746+ assert isinstance (device_count , int )
747+ assert device_count >= 0
748+
749+ for mig_device in mig .get_all_devices ():
750+ assert isinstance (mig_device , system .Device )
751+
752+
753+ def test_uuid_with_prefix ():
754+ for device in system .Device .get_all_devices ():
755+ uuid_with_prefix = device .uuid_with_prefix
756+ assert isinstance (uuid_with_prefix , str )
757+ assert uuid_with_prefix .startswith (("GPU-" , "MIG-" ))
758+ assert uuid_with_prefix [4 :] == device .uuid
0 commit comments