def testGPUWaitFail(self): with self.assertRaises(ValueError): wait_for_gpu(2, delay_s=0) with self.assertRaises(ValueError): wait_for_gpu("4", delay_s=0) with self.assertRaises(ValueError): wait_for_gpu(1.23, delay_s=0)
def testDefaultGPU(self): import sys sys.modules["GPUtil"] = GPUUtilMock([0], ["GPU-aaa"]) wait_for_gpu(delay_s=0)
def testGPUWait2(self): wait_for_gpu("1", delay_s=0)
def testGPUWait3(self): wait_for_gpu("GPU-aaa", delay_s=0)
def testGPUWait1(self): wait_for_gpu(0, delay_s=0)