summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2009-02-27 02:43:45 +0000
committerZac Medico <zmedico@gentoo.org>2009-02-27 02:43:45 +0000
commit57aaae1ce3f340badc57404b10179836539720e6 (patch)
treecfd69b6cc28c95ec0aef1fa31ae6968f27d30c34
parent385a9e1028c4cb073167c52469d6019ba65fc53c (diff)
downloadportage-57aaae1ce3f340badc57404b10179836539720e6.tar.gz
portage-57aaae1ce3f340badc57404b10179836539720e6.tar.bz2
portage-57aaae1ce3f340badc57404b10179836539720e6.zip
Fix PipeReader and PipeReaderTestCase to work with binary strings in py3k.
svn path=/main/trunk/; revision=12720
-rw-r--r--pym/_emerge/__init__.py2
-rw-r--r--pym/portage/tests/process/test_poll.py5
2 files changed, 6 insertions, 1 deletions
diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py
index 0dd1070b2..83186a91e 100644
--- a/pym/_emerge/__init__.py
+++ b/pym/_emerge/__init__.py
@@ -1979,6 +1979,8 @@ class PipeReader(AbstractPollTask):
def getvalue(self):
"""Retrieve the entire contents"""
+ if sys.hexversion >= 0x3000000:
+ return bytes().join(self._read_data)
return "".join(self._read_data)
def close(self):
diff --git a/pym/portage/tests/process/test_poll.py b/pym/portage/tests/process/test_poll.py
index 904930410..e399c479d 100644
--- a/pym/portage/tests/process/test_poll.py
+++ b/pym/portage/tests/process/test_poll.py
@@ -28,7 +28,7 @@ class PipeReaderTestCase(TestCase):
test_string = 2 * "blah blah blah\n"
master_fd, slave_fd = self._create_pipe()
- master_file = os.fdopen(master_fd, 'r')
+ master_file = os.fdopen(master_fd, 'rb')
task_scheduler = TaskScheduler(max_jobs=2)
scheduler = task_scheduler.sched_iface
@@ -52,4 +52,7 @@ class PipeReaderTestCase(TestCase):
task_scheduler.run()
+ if sys.hexversion >= 0x3000000:
+ test_string = test_string.encode()
+
self._assertEqual(test_string, consumer.getvalue())