From ddabeed530a0da193df4d6a55aa0aa54d0114e10 Mon Sep 17 00:00:00 2001 From: Dimitri John Ledkov Date: Thu, 18 Dec 2014 21:34:13 +0000 Subject: [PATCH] Fix ups --- ubuntutools/archive.py | 2 +- ubuntutools/test/test_help.py | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ubuntutools/archive.py b/ubuntutools/archive.py index 641c016..314f3b4 100644 --- a/ubuntutools/archive.py +++ b/ubuntutools/archive.py @@ -308,7 +308,7 @@ class SourcePackage(object): "Write dsc file to workdir" if self._dsc is None: self.pull_dsc() - with open(self.dsc_pathname, 'w') as f: + with open(self.dsc_pathname, 'wb') as f: f.write(self.dsc.raw_text) def _download_file(self, url, filename): diff --git a/ubuntutools/test/test_help.py b/ubuntutools/test/test_help.py index 819630c..6c797ea 100644 --- a/ubuntutools/test/test_help.py +++ b/ubuntutools/test/test_help.py @@ -45,6 +45,7 @@ class HelpTestCase(unittest.TestCase): null = open('/dev/null', 'r') process = subprocess.Popen(['./' + script, '--help'], close_fds=True, stdin=null, + universal_newlines=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) started = time.time() @@ -57,7 +58,10 @@ class HelpTestCase(unittest.TestCase): while time.time() - started < TIMEOUT: for fd in select.select(fds, [], fds, TIMEOUT)[0]: - out.append(os.read(fd, 1024)) + output = os.read(fd, 1024) + if not isinstance(output, str): + output = output.decode('utf-8') + out.append(output) if process.poll() is not None: break