From f152291cba0266de57933ed39a596933648310d5 Mon Sep 17 00:00:00 2001 From: Your Name Date: Fri, 3 Dec 2021 09:27:00 +0100 Subject: [PATCH 01/11] update attribute tests --- test/debug/{is_root_element_test.py => is_root_element_ttest.py} | 0 test/debug/{test_attributes.py => ttest_attributes.py} | 0 test/debug/{test_fields.py => ttest_fields.py} | 0 .../{attribute_creation_tests.py => attribute_creation_test.py} | 0 .../{attribute_io_tests.py => attribute_io_test.py} | 0 5 files changed, 0 insertions(+), 0 deletions(-) rename test/debug/{is_root_element_test.py => is_root_element_ttest.py} (100%) rename test/debug/{test_attributes.py => ttest_attributes.py} (100%) rename test/debug/{test_fields.py => ttest_fields.py} (100%) rename test/h5cpp_tests/attribute_tests/{attribute_creation_tests.py => attribute_creation_test.py} (100%) rename test/h5cpp_tests/attribute_tests/{attribute_io_tests.py => attribute_io_test.py} (100%) diff --git a/test/debug/is_root_element_test.py b/test/debug/is_root_element_ttest.py similarity index 100% rename from test/debug/is_root_element_test.py rename to test/debug/is_root_element_ttest.py diff --git a/test/debug/test_attributes.py b/test/debug/ttest_attributes.py similarity index 100% rename from test/debug/test_attributes.py rename to test/debug/ttest_attributes.py diff --git a/test/debug/test_fields.py b/test/debug/ttest_fields.py similarity index 100% rename from test/debug/test_fields.py rename to test/debug/ttest_fields.py diff --git a/test/h5cpp_tests/attribute_tests/attribute_creation_tests.py b/test/h5cpp_tests/attribute_tests/attribute_creation_test.py similarity index 100% rename from test/h5cpp_tests/attribute_tests/attribute_creation_tests.py rename to test/h5cpp_tests/attribute_tests/attribute_creation_test.py diff --git a/test/h5cpp_tests/attribute_tests/attribute_io_tests.py b/test/h5cpp_tests/attribute_tests/attribute_io_test.py similarity index 100% rename from test/h5cpp_tests/attribute_tests/attribute_io_tests.py rename to test/h5cpp_tests/attribute_tests/attribute_io_test.py From e0d7892c48dfab6a06a6f821731b0f68ac37bb63 Mon Sep 17 00:00:00 2001 From: Your Name Date: Fri, 3 Dec 2021 09:28:09 +0100 Subject: [PATCH 02/11] update attribute tests --- test/h5cpp_tests/attribute_tests/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/h5cpp_tests/attribute_tests/__init__.py b/test/h5cpp_tests/attribute_tests/__init__.py index ff834a37..78e21048 100644 --- a/test/h5cpp_tests/attribute_tests/__init__.py +++ b/test/h5cpp_tests/attribute_tests/__init__.py @@ -1,2 +1,2 @@ -from .attribute_creation_tests import * -from .attribute_io_tests import * +from .attribute_creation_test import * +from .attribute_io_test import * From 0a1d91a5ac89f98a7eb583d646d5228bd229e136 Mon Sep 17 00:00:00 2001 From: Your Name Date: Fri, 3 Dec 2021 11:01:10 +0100 Subject: [PATCH 03/11] rename tests --- src/cpp/h5cpp/node/dataset.cpp | 2 +- test/h5cpp_tests/__init__.py | 8 ++++---- test/h5cpp_tests/dataspace_tests/__init__.py | 4 ++-- ...lar_dataspace.py => scalar_dataspace_test.py} | 0 ...ple_dataspace.py => simple_dataspace_test.py} | 0 test/h5cpp_tests/datatype_tests/__init__.py | 2 +- ...ned_type_tests.py => predefined_type_test.py} | 0 .../{file_creation.py => file_creation_test.py} | 0 .../{file_image.py => file_image_test.py} | 0 .../{file_open.py => file_open_test.py} | 0 test/h5cpp_tests/filter_tests/creation_test.py | 16 +++++++++------- test/h5cpp_tests/group_tests/__init__.py | 2 +- ...onstruction.py => group_construction_test.py} | 0 test/h5cpp_tests/node_tests/__init__.py | 2 +- ..._creation_tests.py => group_creation_test.py} | 0 .../node_tests/virtual_dataset_test.py | 3 ++- test/h5cpp_tests/{path_tests.py => path_test.py} | 0 test/h5cpp_tests/property_tests/__init__.py | 8 ++++---- ...ameters.py => chunk_cache_parameters_test.py} | 0 .../{copy_flags.py => copy_flags_test.py} | 0 ...{creation_order.py => creation_order_test.py} | 0 ...ect_copy_list.py => object_copy_list_test.py} | 0 test/nexus_tests/__init__.py | 8 ++++---- .../{factory_tests.py => factory_test.py} | 0 test/nexus_tests/{file_tests.py => file_test.py} | 0 test/nexus_tests/{path_tests.py => path_test.py} | 13 ++++++++++--- test/nexus_tests/{xml_tests.py => xml_test.py} | 0 test/regression_tests/__init__.py | 6 +++--- .../{issue_18.py => issue_18_test.py} | 0 .../{issue_23.py => issue_23_test.py} | 0 .../{issue_5.py => issue_5_test.py} | 0 31 files changed, 42 insertions(+), 32 deletions(-) rename test/h5cpp_tests/dataspace_tests/{scalar_dataspace.py => scalar_dataspace_test.py} (100%) rename test/h5cpp_tests/dataspace_tests/{simple_dataspace.py => simple_dataspace_test.py} (100%) rename test/h5cpp_tests/datatype_tests/{predefined_type_tests.py => predefined_type_test.py} (100%) rename test/h5cpp_tests/{file_creation.py => file_creation_test.py} (100%) rename test/h5cpp_tests/{file_image.py => file_image_test.py} (100%) rename test/h5cpp_tests/{file_open.py => file_open_test.py} (100%) rename test/h5cpp_tests/group_tests/{group_construction.py => group_construction_test.py} (100%) rename test/h5cpp_tests/node_tests/{group_creation_tests.py => group_creation_test.py} (100%) rename test/h5cpp_tests/{path_tests.py => path_test.py} (100%) rename test/h5cpp_tests/property_tests/{chunk_cache_parameters.py => chunk_cache_parameters_test.py} (100%) rename test/h5cpp_tests/property_tests/{copy_flags.py => copy_flags_test.py} (100%) rename test/h5cpp_tests/property_tests/{creation_order.py => creation_order_test.py} (100%) rename test/h5cpp_tests/property_tests/{object_copy_list.py => object_copy_list_test.py} (100%) rename test/nexus_tests/{factory_tests.py => factory_test.py} (100%) rename test/nexus_tests/{file_tests.py => file_test.py} (100%) rename test/nexus_tests/{path_tests.py => path_test.py} (88%) rename test/nexus_tests/{xml_tests.py => xml_test.py} (100%) rename test/regression_tests/{issue_18.py => issue_18_test.py} (100%) rename test/regression_tests/{issue_23.py => issue_23_test.py} (100%) rename test/regression_tests/{issue_5.py => issue_5_test.py} (100%) diff --git a/src/cpp/h5cpp/node/dataset.cpp b/src/cpp/h5cpp/node/dataset.cpp index 37b201e9..1f0c0e3b 100644 --- a/src/cpp/h5cpp/node/dataset.cpp +++ b/src/cpp/h5cpp/node/dataset.cpp @@ -120,7 +120,7 @@ boost::python::object dataset_read(const hdf5::node::Dataset &self, hdf5::datatype::String string_type = self.datatype(); if(!string_type.is_variable_length()) { - std::cout<<"Saving fixed length string array!"<(static_cast(array_adapter)); Py_XINCREF(ptr); diff --git a/test/h5cpp_tests/__init__.py b/test/h5cpp_tests/__init__.py index d857d9c1..c729d3da 100644 --- a/test/h5cpp_tests/__init__.py +++ b/test/h5cpp_tests/__init__.py @@ -1,6 +1,6 @@ -from .file_creation import * -from .file_image import * -from .file_open import * +from .file_creation_test import * +from .file_image_test import * +from .file_open_test import * from .property_tests import * from .group_tests import * from .datatype_tests import * @@ -8,5 +8,5 @@ from .node_tests import * from .filter_tests import * from .dataspace_tests import * -from .path_tests import * +from .path_test import * # from .group_construction import * diff --git a/test/h5cpp_tests/dataspace_tests/__init__.py b/test/h5cpp_tests/dataspace_tests/__init__.py index 9b5e5775..1830adcb 100644 --- a/test/h5cpp_tests/dataspace_tests/__init__.py +++ b/test/h5cpp_tests/dataspace_tests/__init__.py @@ -1,2 +1,2 @@ -from .scalar_dataspace import * -from .simple_dataspace import * +from .scalar_dataspace_test import * +from .simple_dataspace_test import * diff --git a/test/h5cpp_tests/dataspace_tests/scalar_dataspace.py b/test/h5cpp_tests/dataspace_tests/scalar_dataspace_test.py similarity index 100% rename from test/h5cpp_tests/dataspace_tests/scalar_dataspace.py rename to test/h5cpp_tests/dataspace_tests/scalar_dataspace_test.py diff --git a/test/h5cpp_tests/dataspace_tests/simple_dataspace.py b/test/h5cpp_tests/dataspace_tests/simple_dataspace_test.py similarity index 100% rename from test/h5cpp_tests/dataspace_tests/simple_dataspace.py rename to test/h5cpp_tests/dataspace_tests/simple_dataspace_test.py diff --git a/test/h5cpp_tests/datatype_tests/__init__.py b/test/h5cpp_tests/datatype_tests/__init__.py index 79215197..32999647 100644 --- a/test/h5cpp_tests/datatype_tests/__init__.py +++ b/test/h5cpp_tests/datatype_tests/__init__.py @@ -1 +1 @@ -from .predefined_type_tests import * +from .predefined_type_test import * diff --git a/test/h5cpp_tests/datatype_tests/predefined_type_tests.py b/test/h5cpp_tests/datatype_tests/predefined_type_test.py similarity index 100% rename from test/h5cpp_tests/datatype_tests/predefined_type_tests.py rename to test/h5cpp_tests/datatype_tests/predefined_type_test.py diff --git a/test/h5cpp_tests/file_creation.py b/test/h5cpp_tests/file_creation_test.py similarity index 100% rename from test/h5cpp_tests/file_creation.py rename to test/h5cpp_tests/file_creation_test.py diff --git a/test/h5cpp_tests/file_image.py b/test/h5cpp_tests/file_image_test.py similarity index 100% rename from test/h5cpp_tests/file_image.py rename to test/h5cpp_tests/file_image_test.py diff --git a/test/h5cpp_tests/file_open.py b/test/h5cpp_tests/file_open_test.py similarity index 100% rename from test/h5cpp_tests/file_open.py rename to test/h5cpp_tests/file_open_test.py diff --git a/test/h5cpp_tests/filter_tests/creation_test.py b/test/h5cpp_tests/filter_tests/creation_test.py index d7f0e3aa..62dfc7f9 100644 --- a/test/h5cpp_tests/filter_tests/creation_test.py +++ b/test/h5cpp_tests/filter_tests/creation_test.py @@ -136,17 +136,17 @@ def testSZip(self): def testScaleOffset(self): - filter = ScaleOffset(SOScaleType.INT, 2) - filter(self.dcpl) + sfilter = ScaleOffset(SOScaleType.INT, 2) + sfilter(self.dcpl) hdf5.node.Dataset(self.root, hdf5.Path("ScaleOffset"), self.datatype, self.dataspace, self.lcpl, self.dcpl) self.assertEqual(self.dcpl.nfilters, 1) - self.assertTrue(filter.is_encoding_enabled()) - self.assertTrue(filter.is_decoding_enabled()) - self.assertEqual(filter.id, 6) + self.assertTrue(sfilter.is_encoding_enabled()) + self.assertTrue(sfilter.is_decoding_enabled()) + self.assertEqual(sfilter.id, 6) filters = ExternalFilters() self.assertEqual(len(filters), 0) flags = filters.fill(self.dcpl) @@ -237,7 +237,8 @@ def testExternalFilter2(self): except RuntimeError: error = True if not error: - print("filter with 32008 id created") + pass + # print("filter with 32008 id created") # for newer versions of hdf5 you can constuct the object # on nonexisting filter # self.assertTrue(error) @@ -261,7 +262,8 @@ def testNonExistingExternalFilter(self): except RuntimeError: error = True if not error: - print("filter with 31999 id created") + pass + # print("filter with 31999 id created") # for newer versions of hdf5 you can constuct the object # on nonexisting filter # self.assertTrue(error) diff --git a/test/h5cpp_tests/group_tests/__init__.py b/test/h5cpp_tests/group_tests/__init__.py index c017e724..1d551ce5 100644 --- a/test/h5cpp_tests/group_tests/__init__.py +++ b/test/h5cpp_tests/group_tests/__init__.py @@ -1 +1 @@ -from .group_construction import * +from .group_construction_test import * diff --git a/test/h5cpp_tests/group_tests/group_construction.py b/test/h5cpp_tests/group_tests/group_construction_test.py similarity index 100% rename from test/h5cpp_tests/group_tests/group_construction.py rename to test/h5cpp_tests/group_tests/group_construction_test.py diff --git a/test/h5cpp_tests/node_tests/__init__.py b/test/h5cpp_tests/node_tests/__init__.py index 55d6030e..6d3d0871 100644 --- a/test/h5cpp_tests/node_tests/__init__.py +++ b/test/h5cpp_tests/node_tests/__init__.py @@ -1,7 +1,7 @@ from .dataset_io_test import * from .dataset_partial_io_test import * from .dataset_direct_chunk_test import * -from .group_creation_tests import * +from .group_creation_test import * from .dataset_extent_test import * from .h5py_compat_test import * from .copy_tests import * diff --git a/test/h5cpp_tests/node_tests/group_creation_tests.py b/test/h5cpp_tests/node_tests/group_creation_test.py similarity index 100% rename from test/h5cpp_tests/node_tests/group_creation_tests.py rename to test/h5cpp_tests/node_tests/group_creation_test.py diff --git a/test/h5cpp_tests/node_tests/virtual_dataset_test.py b/test/h5cpp_tests/node_tests/virtual_dataset_test.py index b966e5c0..9d8f55b7 100644 --- a/test/h5cpp_tests/node_tests/virtual_dataset_test.py +++ b/test/h5cpp_tests/node_tests/virtual_dataset_test.py @@ -268,9 +268,10 @@ def testInterleaving(self): self.assertEqual(dataset.dataspace.size, 90) allmod = dataset.read() - print(allmod) + refdata = numpy.array([1, 2, 3]) for offset in range(0, kmodulesize * 3, 3): selection = Hyperslab(offset=(0,), block=(3,)) mod1 = dataset.read(selection=selection) npt.assert_array_equal(mod1, refdata) + npt.assert_array_equal(mod1, allmod[offset: (offset+3)]) diff --git a/test/h5cpp_tests/path_tests.py b/test/h5cpp_tests/path_test.py similarity index 100% rename from test/h5cpp_tests/path_tests.py rename to test/h5cpp_tests/path_test.py diff --git a/test/h5cpp_tests/property_tests/__init__.py b/test/h5cpp_tests/property_tests/__init__.py index 8ece6eab..292b3e62 100644 --- a/test/h5cpp_tests/property_tests/__init__.py +++ b/test/h5cpp_tests/property_tests/__init__.py @@ -1,4 +1,4 @@ -from .object_copy_list import * -from .copy_flags import * -from .chunk_cache_parameters import * -from .creation_order import * +from .object_copy_list_test import * +from .copy_flags_test import * +from .chunk_cache_parameters_test import * +from .creation_order_test import * diff --git a/test/h5cpp_tests/property_tests/chunk_cache_parameters.py b/test/h5cpp_tests/property_tests/chunk_cache_parameters_test.py similarity index 100% rename from test/h5cpp_tests/property_tests/chunk_cache_parameters.py rename to test/h5cpp_tests/property_tests/chunk_cache_parameters_test.py diff --git a/test/h5cpp_tests/property_tests/copy_flags.py b/test/h5cpp_tests/property_tests/copy_flags_test.py similarity index 100% rename from test/h5cpp_tests/property_tests/copy_flags.py rename to test/h5cpp_tests/property_tests/copy_flags_test.py diff --git a/test/h5cpp_tests/property_tests/creation_order.py b/test/h5cpp_tests/property_tests/creation_order_test.py similarity index 100% rename from test/h5cpp_tests/property_tests/creation_order.py rename to test/h5cpp_tests/property_tests/creation_order_test.py diff --git a/test/h5cpp_tests/property_tests/object_copy_list.py b/test/h5cpp_tests/property_tests/object_copy_list_test.py similarity index 100% rename from test/h5cpp_tests/property_tests/object_copy_list.py rename to test/h5cpp_tests/property_tests/object_copy_list_test.py diff --git a/test/nexus_tests/__init__.py b/test/nexus_tests/__init__.py index 68e30439..83af1d91 100644 --- a/test/nexus_tests/__init__.py +++ b/test/nexus_tests/__init__.py @@ -1,4 +1,4 @@ -from .file_tests import * -from .factory_tests import * -from .xml_tests import * -from .path_tests import * +from .file_test import * +from .factory_test import * +from .xml_test import * +from .path_test import * diff --git a/test/nexus_tests/factory_tests.py b/test/nexus_tests/factory_test.py similarity index 100% rename from test/nexus_tests/factory_tests.py rename to test/nexus_tests/factory_test.py diff --git a/test/nexus_tests/file_tests.py b/test/nexus_tests/file_test.py similarity index 100% rename from test/nexus_tests/file_tests.py rename to test/nexus_tests/file_test.py diff --git a/test/nexus_tests/path_tests.py b/test/nexus_tests/path_test.py similarity index 88% rename from test/nexus_tests/path_tests.py rename to test/nexus_tests/path_test.py index 504278e8..44922fd4 100644 --- a/test/nexus_tests/path_tests.py +++ b/test/nexus_tests/path_test.py @@ -94,9 +94,16 @@ def test_get_path_for_detector(self): nexus.Path.to_string(p), "{filename}://scan_001:NXentry/instrument:NXinstrument/" "detector_01:NXdetector".format(filename=self.filename)) - - for element in p: - print(element) + res = [ + {'name': '/', 'base_class': 'NXroot'}, + {'name': 'scan_001', 'base_class': 'NXentry'}, + {'name': 'instrument', 'base_class': 'NXinstrument'}, + {'name': 'detector_01', 'base_class': 'NXdetector'} + ] + for i, element in enumerate(p): + self.assertEqual(type(element), dict) + self.assertEqual(element['name'], res[i]['name']) + self.assertEqual(element['base_class'], res[i]['base_class']) def test_get_path(self): diff --git a/test/nexus_tests/xml_tests.py b/test/nexus_tests/xml_test.py similarity index 100% rename from test/nexus_tests/xml_tests.py rename to test/nexus_tests/xml_test.py diff --git a/test/regression_tests/__init__.py b/test/regression_tests/__init__.py index f4de31cd..02fa0a74 100644 --- a/test/regression_tests/__init__.py +++ b/test/regression_tests/__init__.py @@ -1,3 +1,3 @@ -from .issue_23 import * -from .issue_18 import * -from .issue_5 import * +from .issue_23_test import * +from .issue_18_test import * +from .issue_5_test import * diff --git a/test/regression_tests/issue_18.py b/test/regression_tests/issue_18_test.py similarity index 100% rename from test/regression_tests/issue_18.py rename to test/regression_tests/issue_18_test.py diff --git a/test/regression_tests/issue_23.py b/test/regression_tests/issue_23_test.py similarity index 100% rename from test/regression_tests/issue_23.py rename to test/regression_tests/issue_23_test.py diff --git a/test/regression_tests/issue_5.py b/test/regression_tests/issue_5_test.py similarity index 100% rename from test/regression_tests/issue_5.py rename to test/regression_tests/issue_5_test.py From ec0764348b8572ddd01ab52cb272dee31a8884b8 Mon Sep 17 00:00:00 2001 From: Your Name Date: Fri, 3 Dec 2021 11:24:10 +0100 Subject: [PATCH 04/11] rename copy tests --- test/h5cpp_tests/node_tests/__init__.py | 2 +- test/h5cpp_tests/node_tests/{copy_tests.py => copy_test.py} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename test/h5cpp_tests/node_tests/{copy_tests.py => copy_test.py} (100%) diff --git a/test/h5cpp_tests/node_tests/__init__.py b/test/h5cpp_tests/node_tests/__init__.py index 6d3d0871..b247a72f 100644 --- a/test/h5cpp_tests/node_tests/__init__.py +++ b/test/h5cpp_tests/node_tests/__init__.py @@ -4,7 +4,7 @@ from .group_creation_test import * from .dataset_extent_test import * from .h5py_compat_test import * -from .copy_tests import * +from .copy_test import * from .link_iteration_test import * from .node_iterator_test import * from .virtual_dataset_test import * diff --git a/test/h5cpp_tests/node_tests/copy_tests.py b/test/h5cpp_tests/node_tests/copy_test.py similarity index 100% rename from test/h5cpp_tests/node_tests/copy_tests.py rename to test/h5cpp_tests/node_tests/copy_test.py From 7f5fa69558b3c9ee72318f81b3e58cdc357c5d57 Mon Sep 17 00:00:00 2001 From: Your Name Date: Fri, 3 Dec 2021 11:33:18 +0100 Subject: [PATCH 05/11] uncomment VDS tests --- test/h5cpp_tests/node_tests/__init__.py | 6 +++--- test/h5cpp_tests/node_tests/virtual_dataset_test.py | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/test/h5cpp_tests/node_tests/__init__.py b/test/h5cpp_tests/node_tests/__init__.py index b247a72f..1f8c293e 100644 --- a/test/h5cpp_tests/node_tests/__init__.py +++ b/test/h5cpp_tests/node_tests/__init__.py @@ -1,10 +1,10 @@ +from .copy_test import * +from .dataset_direct_chunk_test import * +from .dataset_extent_test import * from .dataset_io_test import * from .dataset_partial_io_test import * -from .dataset_direct_chunk_test import * from .group_creation_test import * -from .dataset_extent_test import * from .h5py_compat_test import * -from .copy_test import * from .link_iteration_test import * from .node_iterator_test import * from .virtual_dataset_test import * diff --git a/test/h5cpp_tests/node_tests/virtual_dataset_test.py b/test/h5cpp_tests/node_tests/virtual_dataset_test.py index 9d8f55b7..cd79ef60 100644 --- a/test/h5cpp_tests/node_tests/virtual_dataset_test.py +++ b/test/h5cpp_tests/node_tests/virtual_dataset_test.py @@ -52,7 +52,7 @@ if VDSAvailable: - class DatasetPartialIOTests(unittest.TestCase): + class VDSDatasetPartialIOTests(unittest.TestCase): filename = os.path.join(module_path, "VirtualDatasetTests.h5") filename2 = os.path.join(module_path, "VirtualDatasetTests_inter.h5") @@ -62,7 +62,7 @@ class DatasetPartialIOTests(unittest.TestCase): @classmethod def setUpClass(cls): - super(DatasetPartialIOTests, cls).setUpClass() + super(VDSDatasetPartialIOTests, cls).setUpClass() h5cpp.file.create(cls.filename, AccessFlags.TRUNCATE) h5cpp.file.create(cls.filename2, AccessFlags.TRUNCATE) From 0fc073a2b944f08118d09052bc7d89052824aaef Mon Sep 17 00:00:00 2001 From: Your Name Date: Fri, 3 Dec 2021 13:33:19 +0100 Subject: [PATCH 06/11] change py3 tests to pytest --- .ci/debian10_py3/Dockerfile | 2 +- .ci/debian11_py3/Dockerfile | 2 +- .ci/run.sh | 10 ++--- .ci/ubuntu20.04_py3/Dockerfile | 2 +- .ci/ubuntu21.10_py3/Dockerfile | 2 +- setup.py | 1 - test/h5cpp_tests/__init__.py | 3 +- .../datatype_tests/predefined_type_test.py | 40 ++++++++++--------- .../node_tests/virtual_dataset_test.py | 4 +- 9 files changed, 33 insertions(+), 33 deletions(-) diff --git a/.ci/debian10_py3/Dockerfile b/.ci/debian10_py3/Dockerfile index 7bbd2190..38dedff6 100644 --- a/.ci/debian10_py3/Dockerfile +++ b/.ci/debian10_py3/Dockerfile @@ -11,7 +11,7 @@ RUN chmod 644 /etc/apt/trusted.gpg.d/debian-hdri-repo.gpg RUN add-apt-repository "deb http://repos.pni-hdri.de/apt/debian buster main" -y RUN apt-get -qq update && apt-get -qq -y dist-upgrade RUN apt-get -qq update && apt-get -qq install -y python3-sphinx apt-utils net-tools -RUN apt-get -qq install -y libpninexus2.0.0-dev libpninexus2.0.0 libh5cpp0.4.1-dev libh5cpp0.4.1 python3-numpy libhdf5-dev libboost-regex-dev libboost-program-options-dev libboost-system-dev libboost-date-time-dev libboost-filesystem-dev libblas-dev libatlas-base-dev cython3 python3-setuptools libboost-python-dev python3-numpy-abi9 g++ python3-h5py hdf5-plugin-bshuf hdf5-plugin-bz2 hdf5-plugin-lz4 +RUN apt-get -qq install -y libpninexus2.0.0-dev libpninexus2.0.0 libh5cpp0.4.1-dev libh5cpp0.4.1 python3-numpy libhdf5-dev libboost-regex-dev libboost-program-options-dev libboost-system-dev libboost-date-time-dev libboost-filesystem-dev libblas-dev libatlas-base-dev cython3 python3-setuptools libboost-python-dev python3-numpy-abi9 g++ python3-h5py hdf5-plugin-bshuf hdf5-plugin-bz2 hdf5-plugin-lz4 python3-pytest RUN useradd -ms /bin/bash tango RUN apt-get -qq install -y adduser RUN /bin/bash -c 'sleep 10' diff --git a/.ci/debian11_py3/Dockerfile b/.ci/debian11_py3/Dockerfile index c097bf59..0fd2ae95 100644 --- a/.ci/debian11_py3/Dockerfile +++ b/.ci/debian11_py3/Dockerfile @@ -12,7 +12,7 @@ RUN chmod 644 /etc/apt/trusted.gpg.d/debian-hdri-repo.gpg RUN add-apt-repository "deb http://repos.pni-hdri.de/apt/debian bullseye main" -y # RUN apt-get -qq update && apt-get -qq -y dist-upgrade RUN apt-get -qq update && apt-get -qq install -y python3-sphinx apt-utils net-tools -RUN apt-get install -y libpninexus2.0.0-dev libpninexus2.0.0 libh5cpp0.4.1-dev libh5cpp0.4.1 python3-numpy libhdf5-dev libboost-regex-dev libboost-program-options-dev libboost-system-dev libboost-date-time-dev libboost-filesystem-dev libblas-dev libatlas-base-dev cython3 python3-setuptools libboost-python-dev python3-numpy-abi9 g++ python3-h5py hdf5-plugin-bshuf hdf5-plugin-bz2 hdf5-plugin-lz4 git +RUN apt-get install -y libpninexus2.0.0-dev libpninexus2.0.0 libh5cpp0.4.1-dev libh5cpp0.4.1 python3-numpy libhdf5-dev libboost-regex-dev libboost-program-options-dev libboost-system-dev libboost-date-time-dev libboost-filesystem-dev libblas-dev libatlas-base-dev cython3 python3-setuptools libboost-python-dev python3-numpy-abi9 g++ python3-h5py hdf5-plugin-bshuf hdf5-plugin-bz2 hdf5-plugin-lz4 git python3-pytest RUN useradd -ms /bin/bash tango RUN apt-get -qq install -y adduser RUN /bin/bash -c 'sleep 10' diff --git a/.ci/run.sh b/.ci/run.sh index 79a9c1c4..b9d9ce41 100755 --- a/.ci/run.sh +++ b/.ci/run.sh @@ -1,12 +1,10 @@ #!/usr/bin/env bash if [ "$1" = "2" ]; then - echo "run python-pninexus" - docker exec --user root ndts python setup.py test - # docker exec -it ndts python setup.py test + echo "run python-pninexus tests" + docker exec ndts python test else - echo "run python3-pninexus" - docker exec --user root ndts python3 setup.py test - # docker exec -it ndts python3 setup.py test + echo "run python3-pninexus tests" + docker exec ndts python3 -m pytest fi if [ "$?" != "0" ]; then exit 255; fi diff --git a/.ci/ubuntu20.04_py3/Dockerfile b/.ci/ubuntu20.04_py3/Dockerfile index c5fadc18..434bf096 100644 --- a/.ci/ubuntu20.04_py3/Dockerfile +++ b/.ci/ubuntu20.04_py3/Dockerfile @@ -12,7 +12,7 @@ RUN add-apt-repository "deb http://repos.pni-hdri.de/apt/debian focal main" -y RUN apt-get -qq update && export DEBIAN_FRONTEND=noninteractive && apt-get -qq dist-upgrade RUN apt-get -qq update && export DEBIAN_FRONTEND=noninteractive && apt-get -qq install -y python3-sphinx apt-utils net-tools RUN apt-get -qq install -y libpninexus2.0.0-dev libpninexus2.0.0 libh5cpp0.4.1-dev libh5cpp0.4.1 python3-numpy libhdf5-dev libboost-regex-dev libboost-program-options-dev libboost-system-dev libboost-date-time-dev libboost-filesystem-dev libblas-dev libatlas-base-dev cython3 python3-setuptools libboost-python-dev python3-numpy-abi9 g++ python3-h5py -RUN apt-get -qq install -y hdf5-plugin-bshuf hdf5-plugin-bz2 hdf5-plugin-lz4 +RUN apt-get -qq install -y hdf5-plugin-bshuf hdf5-plugin-bz2 hdf5-plugin-lz4 python3-pytest RUN useradd -ms /bin/bash tango ENV PKG_CONFIG_PATH=/home/tango/lib/pkgconfig diff --git a/.ci/ubuntu21.10_py3/Dockerfile b/.ci/ubuntu21.10_py3/Dockerfile index 2a84f63e..8051cc04 100644 --- a/.ci/ubuntu21.10_py3/Dockerfile +++ b/.ci/ubuntu21.10_py3/Dockerfile @@ -12,7 +12,7 @@ RUN add-apt-repository "deb http://repos.pni-hdri.de/apt/debian impish main" -y RUN apt-get -qq update && export DEBIAN_FRONTEND=noninteractive && apt-get -qq dist-upgrade RUN apt-get -qq update && export DEBIAN_FRONTEND=noninteractive && apt-get -qq install -y python3-sphinx apt-utils net-tools RUN apt-get -qq install -y libpninexus2.0.0-dev libpninexus2.0.0 libh5cpp0.4.1-dev libh5cpp0.4.1 python3-numpy libhdf5-dev libboost-regex-dev libboost-program-options-dev libboost-system-dev libboost-date-time-dev libboost-filesystem-dev libblas-dev libatlas-base-dev cython3 python3-setuptools libboost-python-dev python3-numpy-abi9 g++ python3-h5py -RUN apt-get -qq install -y hdf5-plugin-bshuf hdf5-plugin-bz2 hdf5-plugin-lz4 +RUN apt-get -qq install -y hdf5-plugin-bshuf hdf5-plugin-bz2 hdf5-plugin-lz4 python3-pytest RUN useradd -ms /bin/bash tango ENV PKG_CONFIG_PATH=/home/tango/lib/pkgconfig diff --git a/setup.py b/setup.py index de4f5678..ce019530 100644 --- a/setup.py +++ b/setup.py @@ -19,7 +19,6 @@ # release = "2.0.0" release = "2.0" - if release.count(".") == 1: docs_release = '(latest)' else: diff --git a/test/h5cpp_tests/__init__.py b/test/h5cpp_tests/__init__.py index c729d3da..909bc236 100644 --- a/test/h5cpp_tests/__init__.py +++ b/test/h5cpp_tests/__init__.py @@ -1,3 +1,4 @@ +from .node_tests import * from .file_creation_test import * from .file_image_test import * from .file_open_test import * @@ -5,8 +6,6 @@ from .group_tests import * from .datatype_tests import * from .attribute_tests import * -from .node_tests import * from .filter_tests import * from .dataspace_tests import * from .path_test import * -# from .group_construction import * diff --git a/test/h5cpp_tests/datatype_tests/predefined_type_test.py b/test/h5cpp_tests/datatype_tests/predefined_type_test.py index e853906c..1906c8a9 100644 --- a/test/h5cpp_tests/datatype_tests/predefined_type_test.py +++ b/test/h5cpp_tests/datatype_tests/predefined_type_test.py @@ -37,13 +37,15 @@ class PredefinedTypeTests(unittest.TestCase): def testUInt8(self): - dtype = h5cpp.datatype.kUInt8 + dtype = h5cpp.datatype.Integer(h5cpp.datatype.kUInt8) self.assertTrue(isinstance(dtype, self.int_types)) self.assertEqual(dtype.size, 1) self.assertEqual(dtype.is_signed(), False) dtype.make_signed(True) self.assertEqual(dtype.is_signed(), True) + dtype.make_signed(False) + self.assertEqual(dtype.is_signed(), False) self.assertEqual(dtype.precision, 8) dtype.precision = 16 @@ -79,12 +81,14 @@ def testUInt8(self): def testInt8(self): - dtype = h5cpp.datatype.kInt8 + dtype = h5cpp.datatype.Integer(h5cpp.datatype.kInt8) self.assertTrue(isinstance(dtype, self.int_types)) self.assertEqual(dtype.is_signed(), True) dtype.make_signed(False) self.assertEqual(dtype.is_signed(), False) + dtype.make_signed(True) + self.assertEqual(dtype.is_signed(), True) self.assertEqual(dtype.precision, 8) dtype.precision = 16 @@ -120,7 +124,7 @@ def testInt8(self): def testUInt16(self): - dtype = h5cpp.datatype.kUInt16 + dtype = h5cpp.datatype.Integer(h5cpp.datatype.kUInt16) self.assertTrue(isinstance(dtype, self.int_types)) self.assertEqual(dtype.size, 2) self.assertEqual(dtype.is_signed(), False) @@ -162,7 +166,7 @@ def testUInt16(self): def testInt16(self): - dtype = h5cpp.datatype.kInt16 + dtype = h5cpp.datatype.Integer(h5cpp.datatype.kInt16) self.assertTrue(isinstance(dtype, self.int_types)) self.assertEqual(dtype.size, 2) self.assertEqual(dtype.is_signed(), True) @@ -204,7 +208,7 @@ def testInt16(self): def testUInt32(self): - dtype = h5cpp.datatype.kUInt32 + dtype = h5cpp.datatype.Integer(h5cpp.datatype.kUInt32) self.assertTrue(isinstance(dtype, self.int_types)) self.assertEqual(dtype.size, 4) self.assertEqual(dtype.is_signed(), False) @@ -246,7 +250,7 @@ def testUInt32(self): def testInt32(self): - dtype = h5cpp.datatype.kInt32 + dtype = h5cpp.datatype.Integer(h5cpp.datatype.kInt32) self.assertTrue(isinstance(dtype, self.int_types)) self.assertEqual(dtype.size, 4) self.assertEqual(dtype.is_signed(), True) @@ -288,7 +292,7 @@ def testInt32(self): def testUInt64(self): - dtype = h5cpp.datatype.kUInt64 + dtype = h5cpp.datatype.Integer(h5cpp.datatype.kUInt64) self.assertTrue(isinstance(dtype, self.int_types)) self.assertEqual(dtype.size, 8) self.assertEqual(dtype.is_signed(), False) @@ -330,7 +334,7 @@ def testUInt64(self): def testInt64(self): - dtype = h5cpp.datatype.kInt64 + dtype = h5cpp.datatype.Integer(h5cpp.datatype.kInt64) self.assertTrue(isinstance(dtype, self.int_types)) self.assertEqual(dtype.size, 8) self.assertEqual(dtype.is_signed(), True) @@ -372,7 +376,7 @@ def testInt64(self): def testFloat32(self): - dtype = h5cpp.datatype.kFloat32 + dtype = h5cpp.datatype.Float(h5cpp.datatype.kFloat32) self.assertTrue(isinstance(dtype, self.float_types)) self.assertEqual(dtype.size, 4) @@ -451,7 +455,7 @@ def testFloat32(self): def testFloat64(self): - dtype = h5cpp.datatype.kFloat64 + dtype = h5cpp.datatype.Float(h5cpp.datatype.kFloat64) self.assertTrue(isinstance(dtype, self.float_types)) self.assertEqual(dtype.size, 8) @@ -527,7 +531,7 @@ def testFloat64(self): def testFloat128(self): - dtype = h5cpp.datatype.kFloat128 + dtype = h5cpp.datatype.Float(h5cpp.datatype.kFloat128) self.assertTrue(isinstance(dtype, self.float_types)) self.assertTrue(dtype.size in [8, 12, 16]) @@ -603,20 +607,20 @@ def testFloat128(self): def testVariableString(self): - dtype = h5cpp.datatype.kVariableString + dtype = h5cpp.datatype.String(h5cpp.datatype.kVariableString) self.assertTrue(isinstance(dtype, self.string_types)) self.assertTrue(dtype.is_variable_length) def testEBool(self): - dtype = h5cpp.datatype.kEBool + dtype = h5cpp.datatype.Enum(h5cpp.datatype.kEBool) self.assertTrue(isinstance(dtype, self.enum_types)) self.assertTrue(h5cpp._datatype.is_bool(dtype)) self.assertEqual(dtype.size, 1) def testFloat16(self): - dtype = h5cpp.datatype.kFloat16 + dtype = h5cpp.datatype.Float(h5cpp.datatype.kFloat16) self.assertTrue(isinstance(dtype, self.float_types)) self.assertEqual(dtype.size, 2) @@ -692,7 +696,7 @@ def testFloat16(self): def testComplex32(self): - dtype = h5cpp.datatype.kComplex32 + dtype = h5cpp.datatype.Compound(h5cpp.datatype.kComplex32) self.assertTrue(isinstance(dtype, self.float_types)) self.assertEqual(dtype.size, 4) self.assertEqual(dtype.number_of_fields, 2) @@ -753,7 +757,7 @@ def testComplex32(self): def testComplex64(self): - dtype = h5cpp.datatype.kComplex64 + dtype = h5cpp.datatype.Compound(h5cpp.datatype.kComplex64) self.assertTrue(isinstance(dtype, self.float_types)) self.assertEqual(dtype.size, 8) self.assertEqual(dtype.number_of_fields, 2) @@ -814,7 +818,7 @@ def testComplex64(self): def testComplex128(self): - dtype = h5cpp.datatype.kComplex128 + dtype = h5cpp.datatype.Compound(h5cpp.datatype.kComplex128) self.assertTrue(isinstance(dtype, self.float_types)) self.assertEqual(dtype.size, 16) self.assertEqual(dtype.number_of_fields, 2) @@ -875,7 +879,7 @@ def testComplex128(self): def testComplex256(self): - dtype = h5cpp.datatype.kComplex256 + dtype = h5cpp.datatype.Compound(h5cpp.datatype.kComplex256) self.assertTrue(isinstance(dtype, self.float_types)) self.assertEqual(dtype.size, 32) self.assertEqual(dtype.number_of_fields, 2) diff --git a/test/h5cpp_tests/node_tests/virtual_dataset_test.py b/test/h5cpp_tests/node_tests/virtual_dataset_test.py index cd79ef60..2be3fc34 100644 --- a/test/h5cpp_tests/node_tests/virtual_dataset_test.py +++ b/test/h5cpp_tests/node_tests/virtual_dataset_test.py @@ -268,10 +268,10 @@ def testInterleaving(self): self.assertEqual(dataset.dataspace.size, 90) allmod = dataset.read() - + refdata = numpy.array([1, 2, 3]) for offset in range(0, kmodulesize * 3, 3): selection = Hyperslab(offset=(0,), block=(3,)) mod1 = dataset.read(selection=selection) npt.assert_array_equal(mod1, refdata) - npt.assert_array_equal(mod1, allmod[offset: (offset+3)]) + npt.assert_array_equal(mod1, allmod[offset: (offset + 3)]) From 5c49bed1212af332a6c24563eb0c68cf46800454 Mon Sep 17 00:00:00 2001 From: Your Name Date: Fri, 3 Dec 2021 13:42:53 +0100 Subject: [PATCH 07/11] update tests --- .ci/run.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.ci/run.sh b/.ci/run.sh index b9d9ce41..f48fb7e5 100755 --- a/.ci/run.sh +++ b/.ci/run.sh @@ -2,9 +2,9 @@ if [ "$1" = "2" ]; then echo "run python-pninexus tests" - docker exec ndts python test + docker exec ndts python setup.py test else echo "run python3-pninexus tests" - docker exec ndts python3 -m pytest + docker exec ndts python3 -m pytest test fi if [ "$?" != "0" ]; then exit 255; fi From 4776560e6f861f31e36cb83d81a031be218f14dc Mon Sep 17 00:00:00 2001 From: Your Name Date: Fri, 3 Dec 2021 13:55:14 +0100 Subject: [PATCH 08/11] add printout --- .ci/run.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.ci/run.sh b/.ci/run.sh index f48fb7e5..3b71d6dd 100755 --- a/.ci/run.sh +++ b/.ci/run.sh @@ -2,7 +2,8 @@ if [ "$1" = "2" ]; then echo "run python-pninexus tests" - docker exec ndts python setup.py test + docker exec ndts bash -c "ls -ltr src" + docker exec --user root ndts python setup.py test else echo "run python3-pninexus tests" docker exec ndts python3 -m pytest test From cf6b847ed6ca8ee67e347ec613b9c48993cd518d Mon Sep 17 00:00:00 2001 From: Your Name Date: Fri, 3 Dec 2021 14:30:34 +0100 Subject: [PATCH 09/11] switch py2 tests to pytest --- .ci/debian10_py2/Dockerfile | 2 +- .ci/run.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.ci/debian10_py2/Dockerfile b/.ci/debian10_py2/Dockerfile index c38b9077..b0494583 100644 --- a/.ci/debian10_py2/Dockerfile +++ b/.ci/debian10_py2/Dockerfile @@ -11,7 +11,7 @@ RUN chmod 644 /etc/apt/trusted.gpg.d/debian-hdri-repo.gpg RUN add-apt-repository "deb http://repos.pni-hdri.de/apt/debian buster main" -y RUN apt-get -qq update && apt-get -qq -y dist-upgrade RUN apt-get -qq update && apt-get -qq install -y python-sphinx apt-utils net-tools -RUN apt-get -qq install -y libpninexus2.0.0-dev libpninexus2.0.0 libh5cpp0.4.1-dev libh5cpp0.4.1 python-numpy libhdf5-dev libboost-regex-dev libboost-program-options-dev libboost-system-dev libboost-date-time-dev libboost-filesystem-dev libblas-dev libatlas-base-dev cython python-setuptools libboost-python-dev python-numpy-abi9 g++ python-h5py hdf5-plugin-bshuf hdf5-plugin-bz2 hdf5-plugin-lz4 +RUN apt-get -qq install -y libpninexus2.0.0-dev libpninexus2.0.0 libh5cpp0.4.1-dev libh5cpp0.4.1 python-numpy libhdf5-dev libboost-regex-dev libboost-program-options-dev libboost-system-dev libboost-date-time-dev libboost-filesystem-dev libblas-dev libatlas-base-dev cython python-setuptools libboost-python-dev python-numpy-abi9 g++ python-h5py hdf5-plugin-bshuf hdf5-plugin-bz2 hdf5-plugin-lz4 python-pytest RUN useradd -ms /bin/bash tango RUN apt-get -qq install -y adduser diff --git a/.ci/run.sh b/.ci/run.sh index 3b71d6dd..20d4d210 100755 --- a/.ci/run.sh +++ b/.ci/run.sh @@ -2,8 +2,8 @@ if [ "$1" = "2" ]; then echo "run python-pninexus tests" - docker exec ndts bash -c "ls -ltr src" docker exec --user root ndts python setup.py test + docker exec ndts python -m pytest test else echo "run python3-pninexus tests" docker exec ndts python3 -m pytest test From f0707c36efc9a8939be703f69db5464170c1a492 Mon Sep 17 00:00:00 2001 From: Your Name Date: Fri, 3 Dec 2021 14:36:58 +0100 Subject: [PATCH 10/11] switch py2 tests to pytest --- .ci/run.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/run.sh b/.ci/run.sh index 20d4d210..f283adc9 100755 --- a/.ci/run.sh +++ b/.ci/run.sh @@ -2,7 +2,7 @@ if [ "$1" = "2" ]; then echo "run python-pninexus tests" - docker exec --user root ndts python setup.py test + # docker exec --user root ndts python setup.py test docker exec ndts python -m pytest test else echo "run python3-pninexus tests" From 3f396c2ae4c6e62e4b959c0f75775136314675a8 Mon Sep 17 00:00:00 2001 From: Your Name Date: Fri, 3 Dec 2021 14:50:08 +0100 Subject: [PATCH 11/11] remove src/pninexus.egg-info with root rights --- .ci/install.sh | 3 +++ .ci/run.sh | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.ci/install.sh b/.ci/install.sh index 4eba4c83..226889ab 100755 --- a/.ci/install.sh +++ b/.ci/install.sh @@ -21,3 +21,6 @@ else docker exec ndts python3 setup.py build_sphinx fi if [ "$?" != "0" ]; then exit 255; fi + +docker exec --user root ndts rm -rf src/pninexus.egg-info +if [ "$?" != "0" ]; then exit 255; fi diff --git a/.ci/run.sh b/.ci/run.sh index f283adc9..2a5e9630 100755 --- a/.ci/run.sh +++ b/.ci/run.sh @@ -2,7 +2,7 @@ if [ "$1" = "2" ]; then echo "run python-pninexus tests" - # docker exec --user root ndts python setup.py test + # docker exec ndts python setup.py test docker exec ndts python -m pytest test else echo "run python3-pninexus tests"