python3: use binary mode to open file in test

With text mode, trying to write a binary string generates a TypeError in
python 3

Change-Id: I1b7d1a46d98814aacb4bf9a7f80b168c2b786e30
This commit is contained in:
Bernard Cafarelli 2017-06-20 17:12:36 +02:00 committed by Jakub Libosvar
parent 92f9c21d03
commit 033ab6cc17
1 changed files with 2 additions and 2 deletions

View File

@ -130,7 +130,7 @@ class TestNeutronServer(base.BaseTestCase):
return True
def _fake_start(self):
with open(self.temp_file, 'a') as f:
with open(self.temp_file, 'ab') as f:
f.write(FAKE_START_MSG)
def _test_restart_service_on_sighup(self, service, workers=1):
@ -164,7 +164,7 @@ class TestNeutronServer(base.BaseTestCase):
# Verify that start has been called twice for each worker (one for
# initial start, and the second one on SIGHUP after children were
# terminated).
with open(self.temp_file, 'r') as f:
with open(self.temp_file, 'rb') as f:
res = f.readline()
self.assertEqual(expected_msg, res)