diff options
Diffstat (limited to 'silx/test/__init__.py')
-rw-r--r-- | silx/test/__init__.py | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/silx/test/__init__.py b/silx/test/__init__.py index 5175601..5ac3524 100644 --- a/silx/test/__init__.py +++ b/silx/test/__init__.py @@ -1,7 +1,7 @@ # coding: utf-8 # /*########################################################################## # -# Copyright (c) 2015-2017 European Synchrotron Radiation Facility +# Copyright (c) 2015-2018 European Synchrotron Radiation Facility # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -22,8 +22,7 @@ # THE SOFTWARE. # # ###########################################################################*/ -"""Full silx test suite. - +"""This package provides access to the full silx test suite. It is possible to disable tests depending on Qt by setting `silx.test.utils.test_options.WITH_QT_TEST = False` @@ -36,17 +35,35 @@ __date__ = "09/11/2017" import logging -import os import unittest +from silx.test.utils import test_options + logger = logging.getLogger(__name__) def suite(): + # In case Qt tests are not run, do not load sx as it loads Qt + # instead add a skipped test class to the suite + if not test_options.WITH_QT_TEST: + # Explicitly disabled tests + msg = "silx.sx tests disabled %s" % test_options.WITH_QT_TEST_REASON + logger.warning(msg) + + class SkipSXTest(unittest.TestCase): + def runTest(self): + self.skipTest(test_options.WITH_QT_TEST_REASON) + + def test_sx_suite(): + suite = unittest.TestSuite() + suite.addTest(SkipSXTest()) + return suite + else: + from ..sx.test import suite as test_sx_suite + from . import test_version from . import test_resources - from . import test_sx from ..io import test as test_io from ..math import test as test_math from ..image import test as test_image @@ -54,9 +71,10 @@ def suite(): from ..utils import test as test_utils from ..opencl import test as test_ocl from ..app import test as test_app + test_suite = unittest.TestSuite() # test sx first cause qui tests load ipython module - test_suite.addTest(test_sx.suite()) + test_suite.addTest(test_sx_suite()) test_suite.addTest(test_gui.suite()) # then test no-gui tests test_suite.addTest(test_utils.suite()) |