diff options
Diffstat (limited to 'silx/gui/data/test')
-rw-r--r-- | silx/gui/data/test/test_arraywidget.py | 6 | ||||
-rw-r--r-- | silx/gui/data/test/test_dataviewer.py | 14 | ||||
-rw-r--r-- | silx/gui/data/test/test_numpyaxesselector.py | 7 | ||||
-rw-r--r-- | silx/gui/data/test/test_textformatter.py | 12 |
4 files changed, 11 insertions, 28 deletions
diff --git a/silx/gui/data/test/test_arraywidget.py b/silx/gui/data/test/test_arraywidget.py index 50ffc84..6bcbbd3 100644 --- a/silx/gui/data/test/test_arraywidget.py +++ b/silx/gui/data/test/test_arraywidget.py @@ -36,10 +36,7 @@ from silx.gui import qt from silx.gui.data import ArrayTableWidget from silx.gui.utils.testutils import TestCaseQt -try: - import h5py -except ImportError: - h5py = None +import h5py class TestArrayWidget(TestCaseQt): @@ -190,7 +187,6 @@ class TestArrayWidget(TestCaseQt): self.assertIs(b0, b1) -@unittest.skipIf(h5py is None, "Could not import h5py") class TestH5pyArrayWidget(TestCaseQt): """Basic test for ArrayTableWidget with a dataset. diff --git a/silx/gui/data/test/test_dataviewer.py b/silx/gui/data/test/test_dataviewer.py index a681f33..dc6fee8 100644 --- a/silx/gui/data/test/test_dataviewer.py +++ b/silx/gui/data/test/test_dataviewer.py @@ -24,7 +24,7 @@ # ###########################################################################*/ __authors__ = ["V. Valls"] __license__ = "MIT" -__date__ = "23/04/2018" +__date__ = "19/02/2019" import os import tempfile @@ -42,10 +42,7 @@ from silx.gui.data.DataViewerFrame import DataViewerFrame from silx.gui.utils.testutils import SignalListener from silx.gui.utils.testutils import TestCaseQt -try: - import h5py -except ImportError: - h5py = None +import h5py class _DataViewMock(DataView): @@ -170,8 +167,6 @@ class AbstractDataViewerTests(TestCaseQt): self.assertEqual(DataViews.RAW_MODE, widget.displayedView().modeId()) def test_3d_h5_dataset(self): - if h5py is None: - self.skipTest("h5py library is not available") with self.h5_temporary_file() as h5file: dataset = h5file["data"] widget = self.create_widget() @@ -242,8 +237,9 @@ class AbstractDataViewerTests(TestCaseQt): # replace a view that is a child of a composite view widget = self.create_widget() view = _DataViewMock(widget) - widget.replaceView(DataViews.NXDATA_INVALID_MODE, - view) + replaced = widget.replaceView(DataViews.NXDATA_INVALID_MODE, + view) + self.assertTrue(replaced) nxdata_view = widget.getViewFromModeId(DataViews.NXDATA_MODE) self.assertNotIn(DataViews.NXDATA_INVALID_MODE, [v.modeId() for v in nxdata_view.availableViews()]) diff --git a/silx/gui/data/test/test_numpyaxesselector.py b/silx/gui/data/test/test_numpyaxesselector.py index 6b7b58c..df11c1a 100644 --- a/silx/gui/data/test/test_numpyaxesselector.py +++ b/silx/gui/data/test/test_numpyaxesselector.py @@ -37,10 +37,7 @@ from silx.gui.data.NumpyAxesSelector import NumpyAxesSelector from silx.gui.utils.testutils import SignalListener from silx.gui.utils.testutils import TestCaseQt -try: - import h5py -except ImportError: - h5py = None +import h5py class TestNumpyAxesSelector(TestCaseQt): @@ -121,8 +118,6 @@ class TestNumpyAxesSelector(TestCaseQt): os.unlink(tmp_name) def test_h5py_dataset(self): - if h5py is None: - self.skipTest("h5py library is not available") with self.h5_temporary_file() as h5file: dataset = h5file["data"] expectedResult = dataset[0] diff --git a/silx/gui/data/test/test_textformatter.py b/silx/gui/data/test/test_textformatter.py index 850aa00..935344a 100644 --- a/silx/gui/data/test/test_textformatter.py +++ b/silx/gui/data/test/test_textformatter.py @@ -1,7 +1,7 @@ # coding: utf-8 # /*########################################################################## # -# Copyright (c) 2016-2017 European Synchrotron Radiation Facility +# Copyright (c) 2016-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 @@ -29,17 +29,15 @@ __date__ = "12/12/2017" import unittest import shutil import tempfile + import numpy +import six from silx.gui.utils.testutils import TestCaseQt from silx.gui.utils.testutils import SignalListener from ..TextFormatter import TextFormatter -from silx.third_party import six -try: - import h5py -except ImportError: - h5py = None +import h5py class TestTextFormatter(TestCaseQt): @@ -108,8 +106,6 @@ class TestTextFormatterWithH5py(TestCaseQt): @classmethod def setUpClass(cls): super(TestTextFormatterWithH5py, cls).setUpClass() - if h5py is None: - raise unittest.SkipTest("h5py is not available") cls.tmpDirectory = tempfile.mkdtemp() cls.h5File = h5py.File("%s/formatter.h5" % cls.tmpDirectory, mode="w") |