From 4111c03265b4bb1d87a5f8896da771eec9fb655a Mon Sep 17 00:00:00 2001 From: Phillip Cloud Date: Tue, 7 Jul 2015 16:00:42 -0500 Subject: [PATCH 1/4] Skip h5py 2.5.0 tests for varlen string dtypes on windows --- odo/backends/tests/test_h5py.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/odo/backends/tests/test_h5py.py b/odo/backends/tests/test_h5py.py index e8b3423f..0ba0cdff 100644 --- a/odo/backends/tests/test_h5py.py +++ b/odo/backends/tests/test_h5py.py @@ -1,10 +1,14 @@ from __future__ import absolute_import, division, print_function import pytest -pytest.importorskip('h5py') +h5py = pytest.importorskip('h5py') -import h5py import os +import sys + +from distutils.version import LooseVersion + +import h5py from contextlib import contextmanager from odo.backends.h5py import append, create, resource, discover, convert @@ -74,6 +78,14 @@ def test_discover(): assert str(discover(f)) == str(discover({'data': x})) +two_point_five_and_windows = \ + pytest.mark.skipif(sys.platform == 'win32' and + h5py.__version__ == LooseVersion('2.5.0'), + reason=('h5py 2.5.0 issue with varlen string types: ' + 'https://github.com/h5py/h5py/issues/593')) + + +@two_point_five_and_windows def test_discover_on_data_with_object_in_record_name(): data = np.array([(u'a', 1), (u'b', 2)], dtype=[('lrg_object', unicode_dtype), @@ -208,6 +220,7 @@ def test_resource_with_variable_length(): r.file.close() +@two_point_five_and_windows def test_resource_with_option_types(): with tmpfile('.hdf5') as fn: ds = datashape.dshape('4 * {name: ?string, amount: ?int32}') @@ -236,6 +249,7 @@ def test_copy_with_into(): dset.file.close() +@two_point_five_and_windows def test_varlen_dtypes(): y = np.array([('Alice', 100), ('Bob', 200)], dtype=[('name', 'O'), ('amount', 'i4')]) From 28435f7930b8e86cc7fad58e5c371f673aea0e42 Mon Sep 17 00:00:00 2001 From: Phillip Cloud Date: Tue, 7 Jul 2015 16:09:17 -0500 Subject: [PATCH 2/4] Only skip on python3.4 windows and 2.5.0 --- odo/backends/tests/test_h5py.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/odo/backends/tests/test_h5py.py b/odo/backends/tests/test_h5py.py index 0ba0cdff..d1924a79 100644 --- a/odo/backends/tests/test_h5py.py +++ b/odo/backends/tests/test_h5py.py @@ -80,7 +80,8 @@ def test_discover(): two_point_five_and_windows = \ pytest.mark.skipif(sys.platform == 'win32' and - h5py.__version__ == LooseVersion('2.5.0'), + h5py.__version__ == LooseVersion('2.5.0') and + sys.version[:2] == (3, 4), reason=('h5py 2.5.0 issue with varlen string types: ' 'https://github.com/h5py/h5py/issues/593')) From b50f7cb750834ecf00fe8d03c5557222470c756f Mon Sep 17 00:00:00 2001 From: Phillip Cloud Date: Tue, 7 Jul 2015 16:10:19 -0500 Subject: [PATCH 3/4] Better name for skipping decorator --- odo/backends/tests/test_h5py.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/odo/backends/tests/test_h5py.py b/odo/backends/tests/test_h5py.py index d1924a79..c8307f66 100644 --- a/odo/backends/tests/test_h5py.py +++ b/odo/backends/tests/test_h5py.py @@ -78,7 +78,7 @@ def test_discover(): assert str(discover(f)) == str(discover({'data': x})) -two_point_five_and_windows = \ +two_point_five_and_windows_py34 = \ pytest.mark.skipif(sys.platform == 'win32' and h5py.__version__ == LooseVersion('2.5.0') and sys.version[:2] == (3, 4), @@ -86,7 +86,7 @@ def test_discover(): 'https://github.com/h5py/h5py/issues/593')) -@two_point_five_and_windows +@two_point_five_and_windows_py34 def test_discover_on_data_with_object_in_record_name(): data = np.array([(u'a', 1), (u'b', 2)], dtype=[('lrg_object', unicode_dtype), @@ -221,7 +221,7 @@ def test_resource_with_variable_length(): r.file.close() -@two_point_five_and_windows +@two_point_five_and_windows_py34 def test_resource_with_option_types(): with tmpfile('.hdf5') as fn: ds = datashape.dshape('4 * {name: ?string, amount: ?int32}') @@ -250,7 +250,7 @@ def test_copy_with_into(): dset.file.close() -@two_point_five_and_windows +@two_point_five_and_windows_py34 def test_varlen_dtypes(): y = np.array([('Alice', 100), ('Bob', 200)], dtype=[('name', 'O'), ('amount', 'i4')]) From 05152f9850ec4ab0d93cdb6fbbcee823d91a0506 Mon Sep 17 00:00:00 2001 From: Phillip Cloud Date: Tue, 7 Jul 2015 16:15:08 -0500 Subject: [PATCH 4/4] Use version_info not version --- odo/backends/tests/test_h5py.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/odo/backends/tests/test_h5py.py b/odo/backends/tests/test_h5py.py index c8307f66..ab5a6bd1 100644 --- a/odo/backends/tests/test_h5py.py +++ b/odo/backends/tests/test_h5py.py @@ -81,7 +81,7 @@ def test_discover(): two_point_five_and_windows_py34 = \ pytest.mark.skipif(sys.platform == 'win32' and h5py.__version__ == LooseVersion('2.5.0') and - sys.version[:2] == (3, 4), + sys.version_info[:2] == (3, 4), reason=('h5py 2.5.0 issue with varlen string types: ' 'https://github.com/h5py/h5py/issues/593'))