From 91aa96b90e8f7660c57134de3be282e00064a8f8 Mon Sep 17 00:00:00 2001 From: zhuofeng Date: Mon, 3 Jul 2023 16:14:03 +0800 Subject: [PATCH] fix test bug --- ...ises-exceptions-inconsistent-types-f.patch | 63 +++++++++++++++++++ python-h5py.spec | 11 +++- 2 files changed, 72 insertions(+), 2 deletions(-) create mode 100644 Generic-assertRaises-exceptions-inconsistent-types-f.patch diff --git a/Generic-assertRaises-exceptions-inconsistent-types-f.patch b/Generic-assertRaises-exceptions-inconsistent-types-f.patch new file mode 100644 index 0000000..d82cba9 --- /dev/null +++ b/Generic-assertRaises-exceptions-inconsistent-types-f.patch @@ -0,0 +1,63 @@ +From cf5861e48f405ee9d69cac32c35f58edc6f55d25 Mon Sep 17 00:00:00 2001 +From: Pierlauro Sciarelli +Date: Fri, 20 Sep 2019 22:35:04 +0000 +Subject: [PATCH] Generic assertRaises exceptions (inconsistent types for + different HDF5 versions) + +--- + h5py/tests/test_dataset.py | 4 ++-- + h5py/tests/test_dataset_swmr.py | 2 +- + h5py/tests/test_group.py | 4 ++-- + 3 files changed, 5 insertions(+), 5 deletions(-) + +diff --git a/h5py/tests/test_dataset.py b/h5py/tests/test_dataset.py +index b5ba988c5..b44c55480 100644 +--- a/h5py/tests/test_dataset.py ++++ b/h5py/tests/test_dataset.py +@@ -670,9 +670,9 @@ def test_resize(self): + self.assertEqual(dset.shape, (20, 60)) + + def test_resize_over(self): +- """ Resizing past maxshape triggers ValueError """ ++ """ Resizing past maxshape triggers an exception """ + dset = self.f.create_dataset('foo', (20, 30), maxshape=(20, 60)) +- with self.assertRaises(ValueError): ++ with self.assertRaises(Exception): + dset.resize((20, 70)) + + def test_resize_nonchunked(self): +diff --git a/h5py/tests/test_dataset_swmr.py b/h5py/tests/test_dataset_swmr.py +index 208887c3d..d28cb80d2 100644 +--- a/h5py/tests/test_dataset_swmr.py ++++ b/h5py/tests/test_dataset_swmr.py +@@ -71,7 +71,7 @@ def test_refresh(self): + def test_force_swmr_mode_on_raises(self): + """ Verify when reading a file cannot be forcibly switched to swmr mode. + When reading with SWMR the file must be opened with swmr=True.""" +- with self.assertRaises(ValueError): ++ with self.assertRaises(Exception): + self.f.swmr_mode = True + self.assertTrue(self.f.swmr_mode) + +diff --git a/h5py/tests/test_group.py b/h5py/tests/test_group.py +index cd3f3e93c..f813d0150 100644 +--- a/h5py/tests/test_group.py ++++ b/h5py/tests/test_group.py +@@ -240,7 +240,7 @@ def test_reference_numpyobj(self): + self.assertEqual(self.f[data[1]], g) + + def test_invalid_ref(self): +- """ Invalid region references should raise ValueError """ ++ """ Invalid region references should raise an exception """ + + ref = h5py.h5r.Reference() + +@@ -251,7 +251,7 @@ def test_invalid_ref(self): + ref = self.f['x'].ref + del self.f['x'] + +- with self.assertRaises(ValueError): ++ with self.assertRaises(Exception): + self.f[ref] + + # TODO: check that regionrefs also work with __getitem__ diff --git a/python-h5py.spec b/python-h5py.spec index 20f86b4..ce24965 100644 --- a/python-h5py.spec +++ b/python-h5py.spec @@ -3,10 +3,11 @@ Summary: A high- and low-level interface to the HDF5 library from Python Name: python-h5py Version: 2.10.0 -Release: 1 +Release: 2 License: BSD URL: http://www.h5py.org/ Source0: https://files.pythonhosted.org/packages/5f/97/a58afbcf40e8abecededd9512978b4e4915374e5b80049af082f49cebe9a/h5py-2.10.0.tar.gz +Patch0: Generic-assertRaises-exceptions-inconsistent-types-f.patch BuildRequires: gcc BuildRequires: hdf5-devel @@ -33,7 +34,7 @@ Requires: python3-six A high- and low-level interface to the HDF5 library from Python3 %prep -%setup -q -n %{modname}-%{version} +%autosetup -n %{modname}-%{version} -p1 %{__python3} api_gen.py %build @@ -52,5 +53,11 @@ A high- and low-level interface to the HDF5 library from Python3 %{python3_sitearch}/%{modname}-%{version}-*.egg-info %changelog +* Mon Jul 03 2023 zhuofeng - 2.10.0-2 +- Type:bugfix +- CVE:NA +- SUG:NA +- DESC:fix test bug + * Tue Oct 22 2019 openEuler Buildteam - 2.10.0-1 - Package init -- Gitee