Merge "Make subprocess outputs to text for Python 3"

This commit is contained in:
Jenkins 2016-09-27 18:53:27 +00:00 committed by Gerrit Code Review
commit 158b2506b7
2 changed files with 7 additions and 1 deletions

View File

@ -20,7 +20,7 @@ import subprocess
def _get_test_list(regex, env=None):
env = env or copy.deepcopy(os.environ)
proc = subprocess.Popen(['testr', 'list-tests', regex], env=env,
stdout=subprocess.PIPE)
stdout=subprocess.PIPE, universal_newlines=True)
out = proc.communicate()[0]
raw_test_list = out.split('\n')
bad = False

View File

@ -168,3 +168,9 @@ regex_b"""
expected_regex = 'regex_a|regex_b'
self.assertEqual(result, expected_regex)
class TestGetTestList(base.TestCase):
def test__get_test_list(self):
test_list = os_testr._get_test_list('test__get_test_list')
self.assertIn('test__get_test_list', test_list[0])