[PKG-Openstack-devel] Bug#895468: ryu: Fix test_0_call_bytearray failure
Corey Bryant
corey.bryant at canonical.com
Wed Apr 11 21:25:53 BST 2018
Package: ryu
Version: 4.21+dfsg1-4
Severity: normal
Tags: patch
User: ubuntu-devel at lists.ubuntu.com
Usertags: origin-ubuntu bionic ubuntu-patch
Dear Maintainer,
In Ubuntu, the attached patch was applied to achieve the following:
* d/p/test_rpc-Adopt-to-msgpack-python-0.50.patch: Cherry-picked from
upstream to fix test failure "test_0_call_bytearray() did not raise
TypeError".
Thanks for considering the patch.
-- System Information:
Debian Release: buster/sid
APT prefers bionic
APT policy: (500, 'bionic'), (500, 'artful-updates')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 4.15.0-13-generic (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
-------------- next part --------------
diff -Nru ryu-4.21+dfsg1/debian/patches/remove-failing-test.patch ryu-4.21+dfsg1/debian/patches/remove-failing-test.patch
--- ryu-4.21+dfsg1/debian/patches/remove-failing-test.patch 2018-03-18 17:00:30.000000000 -0400
+++ ryu-4.21+dfsg1/debian/patches/remove-failing-test.patch 1969-12-31 19:00:00.000000000 -0500
@@ -1,23 +0,0 @@
-Description: Remove failing test
- This test fails for an unknown reasons, let's just remove it.
-Author: Thomas Goirand <zigo at debian.org>
-Forwarded: no
-Last-Update: 2018-02-16
-
---- ryu-4.21+dfsg1.orig/ryu/tests/unit/lib/test_rpc.py
-+++ ryu-4.21+dfsg1/ryu/tests/unit/lib/test_rpc.py
-@@ -138,14 +138,6 @@ class Test_rpc(unittest.TestCase):
- assert result == obj
- assert isinstance(result, numbers.Integral)
-
-- @raises(TypeError)
-- def test_0_call_bytearray(self):
-- c = rpc.Client(self._client_sock)
-- obj = bytearray(b'foo')
-- result = c.call('resp', [obj])
-- assert result == obj
-- assert isinstance(result, str)
--
- def test_1_shutdown_wr(self):
- # test if the server shutdown on disconnect
- self._client_sock.shutdown(socket.SHUT_WR)
diff -Nru ryu-4.21+dfsg1/debian/patches/series ryu-4.21+dfsg1/debian/patches/series
--- ryu-4.21+dfsg1/debian/patches/series 2018-03-18 17:00:30.000000000 -0400
+++ ryu-4.21+dfsg1/debian/patches/series 2018-04-11 16:24:30.000000000 -0400
@@ -1,2 +1,2 @@
remove-test-requirements-units.patch
-remove-failing-test.patch
+test_rpc-Adopt-to-msgpack-python-0.50.patch
diff -Nru ryu-4.21+dfsg1/debian/patches/test_rpc-Adopt-to-msgpack-python-0.50.patch ryu-4.21+dfsg1/debian/patches/test_rpc-Adopt-to-msgpack-python-0.50.patch
--- ryu-4.21+dfsg1/debian/patches/test_rpc-Adopt-to-msgpack-python-0.50.patch 1969-12-31 19:00:00.000000000 -0500
+++ ryu-4.21+dfsg1/debian/patches/test_rpc-Adopt-to-msgpack-python-0.50.patch 2018-04-11 16:24:09.000000000 -0400
@@ -0,0 +1,44 @@
+From 81cdd4f0d76952c16d6e65e6af8da82702175220 Mon Sep 17 00:00:00 2001
+From: IWASE Yusuke <iwase.yusuke0 at gmail.com>
+Date: Thu, 11 Jan 2018 16:02:40 +0900
+Subject: [PATCH] test_rpc: Adopt to msgpack-python>=0.50
+
+msgpack-python version 0.50 or later supports bytearray objects, this
+patch fixes to adopt to this change.
+
+Signed-off-by: IWASE Yusuke <iwase.yusuke0 at gmail.com>
+Signed-off-by: FUJITA Tomonori <fujita.tomonori at lab.ntt.co.jp>
+---
+ ryu/tests/unit/lib/test_rpc.py | 13 +++++++++----
+ 1 file changed, 9 insertions(+), 4 deletions(-)
+
+diff --git a/ryu/tests/unit/lib/test_rpc.py b/ryu/tests/unit/lib/test_rpc.py
+index 2df123ee..4fba5068 100644
+--- a/ryu/tests/unit/lib/test_rpc.py
++++ b/ryu/tests/unit/lib/test_rpc.py
+@@ -138,13 +138,18 @@ class Test_rpc(unittest.TestCase):
+ assert result == obj
+ assert isinstance(result, numbers.Integral)
+
+- @raises(TypeError)
+ def test_0_call_bytearray(self):
+ c = rpc.Client(self._client_sock)
+ obj = bytearray(b'foo')
+- result = c.call('resp', [obj])
+- assert result == obj
+- assert isinstance(result, str)
++ # Note: msgpack-python version 0.50 or later supports bytearray
++ # objects, here ignores TypeError for the backward compatibility.
++ try:
++ result = c.call('resp', [obj])
++ except TypeError:
++ # Case with msgpack-python version 0.4.x or earlier.
++ return
++ self.assertEqual(obj, result)
++ self.assertIsInstance(result, six.binary_type)
+
+ def test_1_shutdown_wr(self):
+ # test if the server shutdown on disconnect
+--
+2.15.1
+
More information about the Openstack-devel
mailing list