diff options
| author | Thomi Richards <thomi.richards@canonical.com> | 2013-12-02 18:21:08 +1300 |
|---|---|---|
| committer | Thomi Richards <thomi.richards@canonical.com> | 2013-12-02 18:21:08 +1300 |
| commit | a279fbd89bf49237368e6bfd22278e79f56a2372 (patch) | |
| tree | 410f2661a989812d0f0aae4861b523db46b3f6d8 /python/subunit/run.py | |
| parent | 1ee230bbe58895d769ba5793eae2272b32de10c9 (diff) | |
| parent | d2776fbb08a7edf6c69974586f06888fe94bdff8 (diff) | |
| download | subunit-git-a279fbd89bf49237368e6bfd22278e79f56a2372.tar.gz | |
Merged trunk, fixed conflict.
Diffstat (limited to 'python/subunit/run.py')
| -rwxr-xr-x | python/subunit/run.py | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/python/subunit/run.py b/python/subunit/run.py index b4ffdb3..7e4d783 100755 --- a/python/subunit/run.py +++ b/python/subunit/run.py @@ -33,6 +33,7 @@ from testtools.run import ( BUFFEROUTPUT, CATCHBREAK, FAILFAST, + list_test, TestProgram, USAGE_AS_MAIN, ) @@ -51,7 +52,7 @@ class SubunitTestRunner(object): def run(self, test): "Run the given test case or test suite." - result = self._list(test) + result, _ = self._list(test) result = ExtendedToStreamDecorator(result) result = AutoTimingTestResultDecorator(result) if self.failfast is not None: @@ -65,9 +66,15 @@ class SubunitTestRunner(object): def list(self, test): "List the test." - self._list(test) + result, errors = self._list(test) + if errors: + failed_descr = '\n'.join(errors).encode('utf8') + result.status(file_name="import errors", runnable=False, + file_bytes=failed_descr, mime_type="text/plain;charset=utf8") + sys.exit(2) def _list(self, test): + test_ids, errors = list_test(test) try: fileno = self.stream.fileno() except: @@ -77,9 +84,9 @@ class SubunitTestRunner(object): else: stream = self.stream result = StreamResultToBytes(stream) - for case in iterate_tests(test): - result.status(test_id=case.id(), test_status='exists') - return result + for test_id in test_ids: + result.status(test_id=test_id, test_status='exists') + return result, errors class SubunitTestProgram(TestProgram): |
