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 7a56b8f3bc)
(cherry picked from commit 18f019984a)
(cherry picked from commit 0090884e15)
This commit is contained in:
Rodolfo Alonso Hernandez 2020-07-13 13:25:33 +00:00 committed by Dan Radez
parent 9f14638f61
commit 0b1fd4fc26
1 changed files with 2 additions and 1 deletions

View File

@ -24,6 +24,7 @@ import mock
from neutron_lib import worker as neutron_worker from neutron_lib import worker as neutron_worker
from oslo_config import cfg from oslo_config import cfg
import psutil import psutil
import six
from neutron.common import utils from neutron.common import utils
from neutron import manager from neutron import manager
@ -221,7 +222,7 @@ class TestWsgiServer(TestNeutronServer):
# Memorize a port that was chosen for the service # Memorize a port that was chosen for the service
self.port = server.port self.port = server.port
os.write(self.pipeout, bytes(self.port)) os.write(self.pipeout, six.b(str(self.port)))
server.wait() server.wait()