From ebd7040f1fc48df1d9b19985f4339d9d58ec318e07edda2101aef1fee9f2b51d Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Wed, 12 Sep 2018 09:28:08 +0000 Subject: [PATCH] Add 776d086553bd04630cb1d9e2f429c7bf05b1ca23.patch fixing tests on 32bit archs. See https://github.com/gmr/pamqp/issues/11 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-pamqp?expand=0&rev=6 --- ...086553bd04630cb1d9e2f429c7bf05b1ca23.patch | 79 +++++++++++++++++++ python-pamqp.changes | 6 ++ python-pamqp.spec | 3 + 3 files changed, 88 insertions(+) create mode 100644 776d086553bd04630cb1d9e2f429c7bf05b1ca23.patch diff --git a/776d086553bd04630cb1d9e2f429c7bf05b1ca23.patch b/776d086553bd04630cb1d9e2f429c7bf05b1ca23.patch new file mode 100644 index 0000000..5a96579 --- /dev/null +++ b/776d086553bd04630cb1d9e2f429c7bf05b1ca23.patch @@ -0,0 +1,79 @@ +From 776d086553bd04630cb1d9e2f429c7bf05b1ca23 Mon Sep 17 00:00:00 2001 +From: "Gavin M. Roy" +Date: Tue, 11 Sep 2018 10:55:09 -0400 +Subject: [PATCH] Address testing on 32-bit platforms (#11) + +--- + tests/decoding_tests.py | 22 ++++++++++++++++++++++ + 1 file changed, 22 insertions(+) + +--- a/tests/decoding_tests.py ++++ b/tests/decoding_tests.py +@@ -1,5 +1,6 @@ + # -*- encoding: utf-8 -*- + import decimal ++import struct + import time + try: + import unittest2 as unittest +@@ -14,6 +15,9 @@ if PYTHON3: + unicode = bytes + basestring = bytes + ++PLATFORM_32BIT = (struct.calcsize('P') * 8) == 32 ++PLATFORM_64BIT = (struct.calcsize('P') * 8) == 64 ++ + + def utf8(value): + if PYTHON3: +@@ -145,10 +149,16 @@ class CodecDecodeTests(unittest.TestCase + value = b'\x7f\xff\xff\xff\xff\xff\xff\xf8' + self.assertEqual(decode.long_long_int(value)[0], 8) + ++ @unittest.skipIf(PLATFORM_32BIT, 'Skipped on 32-bit platforms') + def test_decode_long_long_int_data_type(self): + value = b'\x7f\xff\xff\xff\xff\xff\xff\xf8' + self.assertIsInstance(decode.long_long_int(value)[1], int) + ++ @unittest.skipIf(PLATFORM_64BIT, 'Skipped on 64-bit platforms') ++ def test_decode_long_long_int_data_type(self): ++ value = b'\x7f\xff\xff\xff\xff\xff\xff\xf8' ++ self.assertIsInstance(decode.long_long_int(value)[1], long) ++ + def test_decode_long_long_int_invalid_value(self): + self.assertRaises(ValueError, decode.long_long_int, None) + +@@ -358,10 +368,16 @@ class CodecDecodeTests(unittest.TestCase + value = b'\x7f\xff\xff\xff\xff\xff\xff\xf8' + self.assertEqual(decode.by_type(value, 'longlong')[0], 8) + ++ @unittest.skipIf(PLATFORM_32BIT, 'Skipped on 32-bit platforms') + def test_decode_by_type_long_long_data_type(self): + value = b'\x7f\xff\xff\xff\xff\xff\xff\xf8' + self.assertIsInstance(decode.by_type(value, 'longlong')[1], int) + ++ @unittest.skipIf(PLATFORM_64BIT, 'Skipped on 64-bit platforms') ++ def test_decode_by_type_long_long_data_type(self): ++ value = b'\x7f\xff\xff\xff\xff\xff\xff\xf8' ++ self.assertIsInstance(decode.by_type(value, 'longlong')[1], long) ++ + def test_decode_by_type_long_long_invalid_value(self): + self.assertRaises(ValueError, decode.by_type, None, 'longlong') + +@@ -512,10 +528,16 @@ class CodecDecodeTests(unittest.TestCase + value = b'l\x7f\xff\xff\xff\xff\xff\xff\xf8' + self.assertEqual(decode._embedded_value(value)[0], 9) + ++ @unittest.skipIf(PLATFORM_32BIT, 'Skipped on 32-bit platforms') + def test_decode_embedded_value_long_long_data_type(self): + value = b'l\x7f\xff\xff\xff\xff\xff\xff\xf8' + self.assertIsInstance(decode._embedded_value(value)[1], int) + ++ @unittest.skipIf(PLATFORM_64BIT, 'Skipped on 64-bit platforms') ++ def test_decode_embedded_value_long_long_data_type(self): ++ value = b'l\x7f\xff\xff\xff\xff\xff\xff\xf8' ++ self.assertIsInstance(decode._embedded_value(value)[1], long) ++ + def test_decode_embedded_value_long_long_value(self): + value = b'l\x7f\xff\xff\xff\xff\xff\xff\xf8' + self.assertEqual(decode._embedded_value(value)[1], diff --git a/python-pamqp.changes b/python-pamqp.changes index 198f231..582a7b8 100644 --- a/python-pamqp.changes +++ b/python-pamqp.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Wed Sep 12 10:59:50 CEST 2018 - mcepl@suse.com + +- Add 776d086553bd04630cb1d9e2f429c7bf05b1ca23.patch fixing tests + on 32bit archs. See https://github.com/gmr/pamqp/issues/11 + ------------------------------------------------------------------- Wed Aug 29 13:54:56 UTC 2018 - tchvatal@suse.com diff --git a/python-pamqp.spec b/python-pamqp.spec index 774f75b..154b7f9 100644 --- a/python-pamqp.spec +++ b/python-pamqp.spec @@ -25,6 +25,8 @@ License: BSD-3-Clause Group: Development/Languages/Python URL: https://github.com/gmr/pamqp Source: https://github.com/gmr/pamqp/archive/%{version}.tar.gz +# PATCH-FIX-UPSTREAM 776d086553bd04630cb1d9e2f429c7bf05b1ca23.patch mcepl@cepl.eu +Patch: 776d086553bd04630cb1d9e2f429c7bf05b1ca23.patch BuildRequires: %{python_module mock} BuildRequires: %{python_module nose} BuildRequires: %{python_module setuptools} @@ -46,6 +48,7 @@ encoding should be run through the pamqp.frame module. %prep %setup -q -n pamqp-%{version} +%autopatch -p1 %build %python_build