From 0b1fd4fc2653a851f147c435e65c6f3a29781100 Mon Sep 17 00:00:00 2001 From: Rodolfo Alonso Hernandez Date: Mon, 13 Jul 2020 13:25:33 +0000 Subject: [PATCH] String to byte conversion should provide the encoding type Note: In Train we still need to support Python 2.7 so this commit adds import of six and six is used to make correct convertion to bytes in both Python 2.7 and Python 3. Change-Id: Id988cab87d32d5721cd91152df194fbb6fa703c5 Closes-Bug: #1887385 (cherry picked from commit 7a56b8f3bc5187846ce9f62dd9347ab5ffefcb5c) (cherry picked from commit 18f019984a71a0e09530c2e6ec29c010968de90e) (cherry picked from commit 0090884e15068a69f229044e37847ae13432c970) --- neutron/tests/functional/test_server.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/neutron/tests/functional/test_server.py b/neutron/tests/functional/test_server.py index 1fc88ac5e9c..152f1d1585f 100644 --- a/neutron/tests/functional/test_server.py +++ b/neutron/tests/functional/test_server.py @@ -24,6 +24,7 @@ import mock from neutron_lib import worker as neutron_worker from oslo_config import cfg import psutil +import six from neutron.common import utils from neutron import manager @@ -221,7 +222,7 @@ class TestWsgiServer(TestNeutronServer): # Memorize a port that was chosen for the service self.port = server.port - os.write(self.pipeout, bytes(self.port)) + os.write(self.pipeout, six.b(str(self.port))) server.wait()