From 0eba07799c43f1e5913a9d1f8516388c5ecde008 Mon Sep 17 00:00:00 2001 From: Thomas Berlok Date: Thu, 29 Feb 2024 10:56:39 +0100 Subject: [PATCH] Skip GPU tests if cupy and numba not installed See issue #50 --- Makefile | 7 +------ tests/cuda-gpu/test_gpu_binary_tree.py | 5 +++++ tests/cuda-gpu/test_gpu_ray_projector.py | 6 ++++++ tests/cuda-gpu/test_gpu_sph_projector.py | 6 ++++++ 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index a6b041e..a950f64 100644 --- a/Makefile +++ b/Makefile @@ -21,6 +21,7 @@ checks: cd tests; pytest comoving cd tests; pytest non-comoving cd tests; pytest general + cd tests; pytest cuda-gpu linting: flake8 ./ @@ -29,9 +30,3 @@ linting: dev_checks: make checks make linting - -# Tests that can only run on some systems -gpu_checks: - cd tests; python cuda-gpu/test_gpu_binary_tree.py - cd tests; python cuda-gpu/test_gpu_ray_projector.py - cd tests; python cuda-gpu/test_gpu_sph_projector.py diff --git a/tests/cuda-gpu/test_gpu_binary_tree.py b/tests/cuda-gpu/test_gpu_binary_tree.py index a6ddfa8..563d202 100644 --- a/tests/cuda-gpu/test_gpu_binary_tree.py +++ b/tests/cuda-gpu/test_gpu_binary_tree.py @@ -1,3 +1,8 @@ +import pytest + +cupy = pytest.importorskip("cupy") +numba = pytest.importorskip("numba") + def test_gpu_binary_tree(): import cupy as cp diff --git a/tests/cuda-gpu/test_gpu_ray_projector.py b/tests/cuda-gpu/test_gpu_ray_projector.py index 31b9246..afb5e50 100644 --- a/tests/cuda-gpu/test_gpu_ray_projector.py +++ b/tests/cuda-gpu/test_gpu_ray_projector.py @@ -1,3 +1,9 @@ +import pytest + +cupy = pytest.importorskip("cupy") +numba = pytest.importorskip("numba") + + def test_gpu_ray_projector(show=False): """ We compare the CPU and GPU implementations of ray-tracing. diff --git a/tests/cuda-gpu/test_gpu_sph_projector.py b/tests/cuda-gpu/test_gpu_sph_projector.py index 952c68c..6c268e7 100644 --- a/tests/cuda-gpu/test_gpu_sph_projector.py +++ b/tests/cuda-gpu/test_gpu_sph_projector.py @@ -1,3 +1,9 @@ +import pytest + +cupy = pytest.importorskip("cupy") +numba = pytest.importorskip("numba") + + def test_gpu_sph_projector(show=False): """ We compare the CPU and GPU implementations of SPH-projection.