[pygobject] test_gi: Fix for Python 2
- From: Martin Pitt <martinpitt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pygobject] test_gi: Fix for Python 2
- Date: Mon, 16 Jul 2012 15:30:37 +0000 (UTC)
commit 079b73b3eb9083bd53e06d095f9dccc02acf2a6e
Author: Martin Pitt <martinpitt gnome org>
Date: Mon Jul 16 17:29:22 2012 +0200
test_gi: Fix for Python 2
tests/test_gi.py | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/tests/test_gi.py b/tests/test_gi.py
index 62ed357..4348c29 100644
--- a/tests/test_gi.py
+++ b/tests/test_gi.py
@@ -10,7 +10,7 @@ import shutil
import os
import locale
import subprocess
-from io import StringIO
+from io import StringIO, BytesIO
from gi.repository import GObject, GLib
@@ -2280,7 +2280,10 @@ class TestModule(unittest.TestCase):
def test_help(self):
orig_stdout = sys.stdout
try:
- sys.stdout = StringIO()
+ if sys.version_info.major < 3:
+ sys.stdout = BytesIO()
+ else:
+ sys.stdout = StringIO()
help(GIMarshallingTests)
output = sys.stdout.getvalue()
finally:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]