1 |
Author: zmedico |
2 |
Date: 2009-02-27 02:43:45 +0000 (Fri, 27 Feb 2009) |
3 |
New Revision: 12720 |
4 |
|
5 |
Modified: |
6 |
main/trunk/pym/_emerge/__init__.py |
7 |
main/trunk/pym/portage/tests/process/test_poll.py |
8 |
Log: |
9 |
Fix PipeReader and PipeReaderTestCase to work with binary strings in py3k. |
10 |
|
11 |
|
12 |
Modified: main/trunk/pym/_emerge/__init__.py |
13 |
=================================================================== |
14 |
--- main/trunk/pym/_emerge/__init__.py 2009-02-27 01:20:49 UTC (rev 12719) |
15 |
+++ main/trunk/pym/_emerge/__init__.py 2009-02-27 02:43:45 UTC (rev 12720) |
16 |
@@ -1979,6 +1979,8 @@ |
17 |
|
18 |
def getvalue(self): |
19 |
"""Retrieve the entire contents""" |
20 |
+ if sys.hexversion >= 0x3000000: |
21 |
+ return bytes().join(self._read_data) |
22 |
return "".join(self._read_data) |
23 |
|
24 |
def close(self): |
25 |
|
26 |
Modified: main/trunk/pym/portage/tests/process/test_poll.py |
27 |
=================================================================== |
28 |
--- main/trunk/pym/portage/tests/process/test_poll.py 2009-02-27 01:20:49 UTC (rev 12719) |
29 |
+++ main/trunk/pym/portage/tests/process/test_poll.py 2009-02-27 02:43:45 UTC (rev 12720) |
30 |
@@ -28,7 +28,7 @@ |
31 |
test_string = 2 * "blah blah blah\n" |
32 |
|
33 |
master_fd, slave_fd = self._create_pipe() |
34 |
- master_file = os.fdopen(master_fd, 'r') |
35 |
+ master_file = os.fdopen(master_fd, 'rb') |
36 |
|
37 |
task_scheduler = TaskScheduler(max_jobs=2) |
38 |
scheduler = task_scheduler.sched_iface |
39 |
@@ -52,4 +52,7 @@ |
40 |
|
41 |
task_scheduler.run() |
42 |
|
43 |
+ if sys.hexversion >= 0x3000000: |
44 |
+ test_string = test_string.encode() |
45 |
+ |
46 |
self._assertEqual(test_string, consumer.getvalue()) |