launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #25679
[Merge] ~cjwatson/launchpad:py3-parallel-testing into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:py3-parallel-testing into launchpad:master.
Commit message:
Fix parallel testing machinery on Python 3
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/393810
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:py3-parallel-testing into launchpad:master.
diff --git a/lib/lp/services/testing/parallel.py b/lib/lp/services/testing/parallel.py
index b169b0f..e5fb710 100644
--- a/lib/lp/services/testing/parallel.py
+++ b/lib/lp/services/testing/parallel.py
@@ -104,7 +104,7 @@ class ListTestCase(ProtocolTestCase):
self._args = args
def run(self, result):
- with tempfile.NamedTemporaryFile() as test_list_file:
+ with tempfile.NamedTemporaryFile(mode='w+') as test_list_file:
for test_id in self._test_ids:
test_list_file.write(test_id + '\n')
test_list_file.flush()
diff --git a/lib/lp/services/testing/tests/test_parallel.py b/lib/lp/services/testing/tests/test_parallel.py
index f8afd34..7e83670 100644
--- a/lib/lp/services/testing/tests/test_parallel.py
+++ b/lib/lp/services/testing/tests/test_parallel.py
@@ -5,6 +5,7 @@
__metaclass__ = type
+import io
import subprocess
import tempfile
from textwrap import dedent
@@ -41,7 +42,7 @@ class TestListTestCase(TestCase, TestWithFixtures):
with open(load_list, 'rt') as testlist:
contents = testlist.readlines()
self.assertEqual(['foo\n', 'bar\n'], contents)
- return {'stdout': six.StringIO(), 'stdin': six.StringIO()}
+ return {'stdout': io.BytesIO(), 'stdin': io.BytesIO()}
popen = self.useFixture(PopenFixture(check_list_file))
case = ListTestCase(['foo', 'bar'], ['bin/test'])
self.assertEqual([], popen.procs)
@@ -76,7 +77,7 @@ class TestUtilities(TestCase, TestWithFixtures):
prepare_argv(['bin/test', '--load-list', 'Foo', 'foo']))
def test_find_tests_honours_list_list_equals(self):
- with tempfile.NamedTemporaryFile() as listfile:
+ with tempfile.NamedTemporaryFile(mode='w+') as listfile:
listfile.write('foo\nbar\n')
listfile.flush()
self.assertEqual(
@@ -85,7 +86,7 @@ class TestUtilities(TestCase, TestWithFixtures):
['bin/test', '--load-list=%s' % listfile.name, 'foo']))
def test_find_tests_honours_list_list_two_arg_form(self):
- with tempfile.NamedTemporaryFile() as listfile:
+ with tempfile.NamedTemporaryFile(mode='w+') as listfile:
listfile.write('foo\nbar\n')
listfile.flush()
self.assertEqual(
@@ -104,8 +105,8 @@ class TestUtilities(TestCase, TestWithFixtures):
['bin/test', '-vt', 'filter', '--list-tests', '--subunit'],
args['args'])
return {
- 'stdin': six.StringIO(),
- 'stdout': six.StringIO(six.ensure_str(dedent("""\
+ 'stdin': io.BytesIO(),
+ 'stdout': io.BytesIO(six.ensure_binary(dedent("""\
test: quux
successful: quux
test: glom