Fix unit tests for Bazaar on Python 3.x.
We had some tests for Bazaar that tried writing the wrong string type to
a file. This change updates the file writing to ensure we're writing
byte strings exclusively.
Testing Done:
Unit tests pass on all supported Python versions.
Reviewed at
@@ -71,7 +71,7 @@ class BazaarClientTests(SCMClientTests):
if cwd is not None:
filename = os.path.join(cwd, filename)
- with open(filename, 'w') as f:
+ with open(filename, 'wb') as f:
f.write(data)
self._run_bzr(['add', filename], cwd=cwd, *args, **kwargs)
@@ -222,7 +222,7 @@ class BazaarClientTests(SCMClientTests):
os.chdir(self.child_branch)
self._bzr_add_file_commit('foo.txt', FOO1, 'delete and modify stuff')
- self._bzr_add_file_commit('bar.txt', 'baz', 'added bar')
+ self._bzr_add_file_commit('bar.txt', b'baz', 'added bar')
revisions = self.client.parse_revision_spec([])
result = self.client.diff(revisions, ['foo.txt'])
