From f757ae3a98b49b34bbf08ab53e5724d17000e7c9 Mon Sep 17 00:00:00 2001
From: Willem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl>
Date: Tue, 9 Jan 2018 14:37:20 +0100
Subject: Add astra.test/astra_test function

---
 python/astra/__init__.py |  4 ++--
 python/astra/tests.py    | 10 ++++++++++
 2 files changed, 12 insertions(+), 2 deletions(-)

(limited to 'python')

diff --git a/python/astra/__init__.py b/python/astra/__init__.py
index 4675229..e813194 100644
--- a/python/astra/__init__.py
+++ b/python/astra/__init__.py
@@ -27,7 +27,7 @@ from . import matlab as m
 from .creators import astra_dict,create_vol_geom, create_proj_geom, create_backprojection, create_sino, create_reconstruction, create_projector,create_sino3d_gpu, create_backprojection3d_gpu
 from .functions import data_op, add_noise_to_sino, clear, move_vol_geom
 from .extrautils import clipCircle
-from .astra import set_gpu_index, get_gpu_info
+from .astra import set_gpu_index, get_gpu_info, use_cuda
 from . import data2d
 from . import astra
 from . import data3d
@@ -39,7 +39,7 @@ from . import plugin
 from . import plugins
 from . import log
 from .optomo import OpTomo
-from .tests import test_noCUDA, test_CUDA
+from .tests import test, test_noCUDA, test_CUDA
 
 __version__ = '1.9.0dev'
 
diff --git a/python/astra/tests.py b/python/astra/tests.py
index 32afd36..f7c2c04 100644
--- a/python/astra/tests.py
+++ b/python/astra/tests.py
@@ -95,3 +95,13 @@ def test_CUDA():
   ok3 = _basic_par3d_cuda()
   if not (ok1 and ok2 and ok3):
     raise RuntimeError("Test failed")
+
+def test():
+  """Perform a very basic functionality test"""
+
+  import astra
+  if astra.use_cuda():
+    test_CUDA()
+  else:
+    print("No GPU support available")
+    test_noCUDA()
-- 
cgit v1.2.3