Merge "Use bytes for python3 friendly os.write" into stable/newton

This commit is contained in:
Jenkins 2017-03-11 02:19:34 +00:00 committed by Gerrit Code Review
commit 475e07563d
2 changed files with 2 additions and 2 deletions

View File

@ -136,7 +136,7 @@ class Pidfile(object):
def write(self, pid):
os.ftruncate(self.fd, 0)
os.write(self.fd, "%d" % pid)
os.write(self.fd, b"%d" % pid)
os.fsync(self.fd)
def read(self):

View File

@ -180,7 +180,7 @@ class TestPidfile(base.BaseTestCase):
self.os.assert_has_calls([
mock.call.ftruncate(FAKE_FD, 0),
mock.call.write(FAKE_FD, '34'),
mock.call.write(FAKE_FD, b'34'),
mock.call.fsync(FAKE_FD)]
)