[pyresample] 01/03: New patch for fixing tests on big-endian archs

Antonio Valentino a_valentino-guest at moszumanska.debian.org
Sat Dec 23 17:27:29 UTC 2017


This is an automated email from the git hooks/post-receive script.

a_valentino-guest pushed a commit to branch master
in repository pyresample.

commit 89db2c9c1527220e3fe3ee3d9ba44d7a37683b02
Author: Antonio Valentino <antonio.valentino at tiscali.it>
Date:   Sat Dec 23 08:50:59 2017 +0000

    New patch for fixing tests on big-endian archs
---
 debian/changelog                                   |  9 ++++
 ...003-fix-tests-on-big-endian-architectures.patch | 60 ++++++++++++++++++++++
 debian/patches/series                              |  1 +
 3 files changed, 70 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index 0b567bf..a1d58a6 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,12 @@
+pyresample (1.7.1-2) UNRELEASED; urgency=medium
+
+  * debian/patches
+    - new patch 0003-fix-tests-on-big-endian-architectures.patch (see also
+      upstream issues https://github.com/pytroll/pyresample/pull/90 and
+      https://github.com/pytroll/pyresample/pull/91
+
+ -- Antonio Valentino <antonio.valentino at tiscali.it>  Sat, 23 Dec 2017 08:48:36 +0000
+
 pyresample (1.7.1-1) unstable; urgency=medium
 
   * New upstream release
diff --git a/debian/patches/0003-fix-tests-on-big-endian-architectures.patch b/debian/patches/0003-fix-tests-on-big-endian-architectures.patch
new file mode 100644
index 0000000..fbe6d0b
--- /dev/null
+++ b/debian/patches/0003-fix-tests-on-big-endian-architectures.patch
@@ -0,0 +1,60 @@
+From: Antonio Valentino <antonio.valentino at tiscali.it>
+Date: Sat, 23 Dec 2017 09:47:39 +0100
+Subject: fix tests on big-endian architectures
+
+---
+ pyresample/test/test_geometry.py | 34 ++++++++++++++++++++--------------
+ 1 file changed, 20 insertions(+), 14 deletions(-)
+
+diff --git a/pyresample/test/test_geometry.py b/pyresample/test/test_geometry.py
+index e26a26e..4db031f 100644
+--- a/pyresample/test/test_geometry.py
++++ b/pyresample/test/test_geometry.py
+@@ -216,13 +216,24 @@ class Test(unittest.TestCase):
+ 
+     def test_get_array_hashable(self):
+         arr = np.array([1.2, 1.3, 1.4, 1.5])
+-
+-        np.testing.assert_allclose(np.array([ 51,  51,  51,  51,  51,  51, 243,
+-                                           63, 205, 204, 204, 204, 204,
+-                                           204, 244,  63, 102, 102, 102, 102,
+-                                           102, 102, 246,  63,   0,   0,
+-                                           0,   0,   0,   0, 248,  63],
+-                                           dtype=np.uint8),
++        if sys.byteorder == 'little':
++            # arr.view(np.uint8)
++            reference = np.array([ 51,  51,  51,  51,  51,  51, 243,
++                                   63, 205, 204, 204, 204, 204,
++                                   204, 244,  63, 102, 102, 102, 102,
++                                   102, 102, 246,  63,   0,   0,
++                                   0,   0,   0,   0, 248,  63],
++                                   dtype=np.uint8)
++        else:
++            # on le machines use arr.byteswap().view(np.uint8)
++            reference = np.array([ 63, 243,  51,  51,  51,  51,  51,
++                                   51,  63, 244, 204, 204, 204,
++                                   204, 204, 205,  63, 246, 102, 102,
++                                   102, 102, 102, 102,  63, 248,
++                                   0,   0,   0,   0,   0,   0],
++                                   dtype=np.uint8)
++
++        np.testing.assert_allclose(reference,
+                                     geometry.get_array_hashable(arr))
+ 
+         try:
+@@ -231,13 +242,8 @@ class Test(unittest.TestCase):
+             pass
+         else:
+             xrarr = xr.DataArray(arr)
+-            np.testing.assert_allclose(np.array([ 51,  51,  51,  51,  51,  51, 243,
+-                                           63, 205, 204, 204, 204, 204,
+-                                           204, 244,  63, 102, 102, 102, 102,
+-                                           102, 102, 246,  63,   0,   0,
+-                                           0,   0,   0,   0, 248,  63],
+-                                           dtype=np.uint8),
+-                                    geometry.get_array_hashable(arr))
++            np.testing.assert_allclose(reference,
++                                       geometry.get_array_hashable(arr))
+ 
+             xrarr.attrs['hash'] = 42
+             self.assertEqual(geometry.get_array_hashable(xrarr),
diff --git a/debian/patches/series b/debian/patches/series
index b939e25..1947fea 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,2 +1,3 @@
 0001-fix-doc-build.patch
 0002-fix-proj4-initialization.patch
+0003-fix-tests-on-big-endian-architectures.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/pyresample.git



More information about the Pkg-grass-devel mailing list