diff options
Diffstat (limited to 'src/argaze.test/OpenCVCuda.py')
-rw-r--r-- | src/argaze.test/OpenCVCuda.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/argaze.test/OpenCVCuda.py b/src/argaze.test/OpenCVCuda.py index fd28abf..3b5b657 100644 --- a/src/argaze.test/OpenCVCuda.py +++ b/src/argaze.test/OpenCVCuda.py @@ -9,10 +9,7 @@ import os class cuda_test(unittest.TestCase): """Test Cuda-accelerated OpenCV functions class.""" - def test_setup(self): - - self.assertGreater(cv.cuda.getCudaEnabledDeviceCount(), 0) - + @unittest.skipIf(cv.cuda.getCudaEnabledDeviceCount() == 0, "No cuda device found") def test_cuda_upload_download(self): npMat = (np.random.random((128, 128, 3)) * 255).astype(np.uint8) @@ -21,6 +18,7 @@ class cuda_test(unittest.TestCase): self.assertTrue(np.allclose(cuMat.download(), npMat)) + @unittest.skipIf(cv.cuda.getCudaEnabledDeviceCount() == 0, "No cuda device found") def test_cuda_upload_download_stream(self): stream = cv.cuda_Stream() @@ -32,6 +30,7 @@ class cuda_test(unittest.TestCase): self.assertTrue(np.allclose(npMat2, npMat)) + @unittest.skipIf(cv.cuda.getCudaEnabledDeviceCount() == 0, "No cuda device found") def test_cuda_interop(self): npMat = (np.random.random((128, 128, 3)) * 255).astype(np.uint8) @@ -46,6 +45,7 @@ class cuda_test(unittest.TestCase): asyncstream = cv.cuda_Stream(1) # cudaStreamNonBlocking self.assertTrue(asyncstream.cudaPtr() != 0) + @unittest.skipIf(cv.cuda.getCudaEnabledDeviceCount() == 0, "No cuda device found") def test_cuda_buffer_pool(self): cv.cuda.setBufferPoolUsage(True) @@ -58,6 +58,7 @@ class cuda_test(unittest.TestCase): self.assertEqual(cuMat.size(), (1024, 1024)) self.assertEqual(cuMat.type(), cv.CV_8UC3) + @unittest.skipIf(cv.cuda.getCudaEnabledDeviceCount() == 0, "No cuda device found") def test_cuda_release(self): npMat = (np.random.random((128, 128, 3)) * 255).astype(np.uint8) @@ -69,6 +70,7 @@ class cuda_test(unittest.TestCase): self.assertTrue(cuMat.step == 0) self.assertTrue(cuMat.size() == (0, 0)) + @unittest.skipIf(cv.cuda.getCudaEnabledDeviceCount() == 0, "No cuda device found") def test_cuda_denoising(self): self.assertEqual(True, hasattr(cv.cuda, 'fastNlMeansDenoising')) |