launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #25489
[Merge] ~cjwatson/launchpad:py3-test-testcase-bytesio into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:py3-test-testcase-bytesio into launchpad:master.
Commit message:
Port test_testcase to io.BytesIO
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/392137
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:py3-test-testcase-bytesio into launchpad:master.
diff --git a/lib/lp/testing/tests/test_testcase.py b/lib/lp/testing/tests/test_testcase.py
index dcc3137..4de1db4 100644
--- a/lib/lp/testing/tests/test_testcase.py
+++ b/lib/lp/testing/tests/test_testcase.py
@@ -5,8 +5,8 @@
__metaclass__ = type
+import io
import logging
-from StringIO import StringIO
import sys
import oops_datedir_repo.serializer_rfc822
@@ -92,12 +92,12 @@ class TestCaptureOops(TestCaseWithFactory):
self.assertEqual(0, len(self.oopses))
self.trigger_oops()
self.attachOopses()
- content = StringIO()
+ content = io.BytesIO()
content.writelines(self.getDetails()['oops-0'].iter_bytes())
content.seek(0)
# Safety net: ensure that no autocasts have occured even on Python 2.6
# which is slightly better.
- self.assertIsInstance(content.getvalue(), str)
+ self.assertIsInstance(content.getvalue(), bytes)
# In tests it should be rfc822 for easy reading.
from_details = oops_datedir_repo.serializer_rfc822.read(content)
# Compare with the in-memory model (but only a select key, because the