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)
This commit is contained in:
Rodolfo Alonso Hernandez 2020-07-13 13:25:33 +00:00 committed by Slawek Kaplonski
parent cc7a29c4b7
commit 0090884e15
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 oslo_config import cfg
import psutil
import six
from neutron.common import utils
from neutron import manager
@ -228,7 +229,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()