[gvfs] gvfs-test: Fix Drive tests for Python 3.3
- From: Martin Pitt <martinpitt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gvfs] gvfs-test: Fix Drive tests for Python 3.3
- Date: Tue, 6 Nov 2012 14:24:23 +0000 (UTC)
commit f14dd5a3fc835e3ba29979c96bc5f62e7dd4e187
Author: Martin Pitt <martinpitt gnome org>
Date: Tue Nov 6 15:23:13 2012 +0100
gvfs-test: Fix Drive tests for Python 3.3
Python 3.3 changed the behaviour of subprocess.Popen() with
universal_newlines=True: now stdin is expected to be a str as well, which makes
sense, but didn't work that way in Python 3.2.
Change the code to explicitly recode and not use universal_newlines=True, so
that this works for both Python versions.
test/gvfs-test | 7 +++----
1 files changed, 3 insertions(+), 4 deletions(-)
---
diff --git a/test/gvfs-test b/test/gvfs-test
index dc49e86..e68c93e 100755
--- a/test/gvfs-test
+++ b/test/gvfs-test
@@ -98,13 +98,12 @@ class GvfsTestCase(unittest.TestCase):
assert in_testbed, 'root_command() only works under gvfs-testbed'
rootsh = subprocess.Popen(['./rootsh'], stdin=subprocess.PIPE,
- stdout=subprocess.PIPE, stderr=subprocess.PIPE,
- universal_newlines=True)
+ stdout=subprocess.PIPE, stderr=subprocess.PIPE)
# set reasonable path that includes /sbin
- rootsh.stdin.write('export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\n')
+ rootsh.stdin.write(b'export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\n')
(out, err) = rootsh.communicate(command.encode('UTF-8'))
- return (rootsh.returncode, out, err)
+ return (rootsh.returncode, out.decode('UTF-8'), err.decode('UTF-8'))
@classmethod
def root_command_success(klass, command):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]