summaryrefslogtreecommitdiff
path: root/testrepository/testcommand.py
diff options
context:
space:
mode:
authorRobert Collins <robertc@robertcollins.net>2014-02-11 13:38:15 +1300
committerRobert Collins <robertc@robertcollins.net>2014-02-11 13:38:15 +1300
commitdbc0c6cbbd7f6cc6a3b2bb617525e6f16b817359 (patch)
tree850e377ddabc39d7ca313ddaf462dbe9f5c1dd4f /testrepository/testcommand.py
parent705741ab624c2570f1f30b99808809f239f60859 (diff)
downloadtestrepository-dbc0c6cbbd7f6cc6a3b2bb617525e6f16b817359.tar.gz
* When list-tests encounters an error, a much clearer response will
now be shown. (Robert Collins, #1271133)
Diffstat (limited to 'testrepository/testcommand.py')
-rw-r--r--testrepository/testcommand.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/testrepository/testcommand.py b/testrepository/testcommand.py
index 267f4ef..f2d51ef 100644
--- a/testrepository/testcommand.py
+++ b/testrepository/testcommand.py
@@ -14,10 +14,14 @@
"""The test command that test repository knows how to run."""
-from extras import try_imports
+from extras import (
+ try_import,
+ try_imports,
+ )
from collections import defaultdict
ConfigParser = try_imports(['ConfigParser', 'configparser'])
+import io
import itertools
import operator
import os.path
@@ -29,7 +33,9 @@ import multiprocessing
from textwrap import dedent
from fixtures import Fixture
+v2 = try_import('subunit.v2')
+from testrepository import results
from testrepository.testlist import (
parse_enumeration,
write_list,
@@ -294,6 +300,11 @@ class TestListingFixture(Fixture):
stdout=subprocess.PIPE, stdin=subprocess.PIPE)
out, err = run_proc.communicate()
if run_proc.returncode != 0:
+ if v2 is not None:
+ new_out = io.BytesIO()
+ v2.ByteStreamToStreamResult(io.BytesIO(out), 'stdout').run(
+ results.CatFiles(new_out))
+ out = new_out.getvalue()
raise ValueError(
"Non-zero exit code (%d) from test listing."
" stdout=%r, stderr=%r" % (run_proc.returncode, out, err))