15
0
forked from pool/python-pamqp

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
This commit is contained in:
2018-09-12 09:28:08 +00:00
committed by Git OBS Bridge
parent fd73bc5664
commit ebd7040f1f
3 changed files with 88 additions and 0 deletions

View File

@@ -0,0 +1,79 @@
From 776d086553bd04630cb1d9e2f429c7bf05b1ca23 Mon Sep 17 00:00:00 2001
From: "Gavin M. Roy" <gavinr@aweber.com>
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],

View File

@@ -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

View File

@@ -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