Skip to content

Commit

Permalink
Merge branch 'master' into fix-serial-selection
Browse files Browse the repository at this point in the history
  • Loading branch information
mtreinish committed Sep 29, 2017
2 parents 978fc90 + 2d7d503 commit 33bbe41
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions stestr/tests/test_return_codes.py
Expand Up @@ -12,6 +12,8 @@
# License for the specific language governing permissions and limitations
# under the License.

import functools
import io
import os
import re
import shutil
Expand All @@ -20,6 +22,8 @@

import six
from six import StringIO
import subunit as subunit_lib
import testtools

from stestr.tests import base

Expand Down Expand Up @@ -67,6 +71,23 @@ def assertRunExit(self, cmd, expected, subunit=False):
self.assertEqual(p.returncode, expected,
"Expected return code: %s doesn't match actual "
"return code of: %s" % (expected, p.returncode))
output_stream = io.BytesIO(out)
stream = subunit_lib.ByteStreamToStreamResult(output_stream)
starts = testtools.StreamResult()
summary = testtools.StreamSummary()
tests = []

def _add_dict(test):
tests.append(test)

outcomes = testtools.StreamToDict(functools.partial(_add_dict))
result = testtools.CopyStreamResult([starts, outcomes, summary])
result.startTestRun()
try:
stream.run(result)
finally:
result.stopTestRun()
self.assertThat(len(tests), testtools.matchers.GreaterThan(0))

def test_parallel_passing(self):
self.assertRunExit('stestr run passing', 0)
Expand Down

0 comments on commit 33bbe41

Please sign in to comment.