# Path: stestr/commands/list.py
# class List(command.Command):
#     def get_parser(self, prog_name):
#     def take_action(self, parsed_args):
# def list_command(config='.stestr.conf', repo_type='file', repo_url=None,
#                  test_path=None, top_dir=None, group_regex=None,
#                  exclude_list=None,
#                  include_list=None,
#                  exclude_regex=None, filters=None,
#                  stdout=sys.stdout):
# 
# Path: stestr/commands/run.py
# def _to_int(possible, default=0, out=sys.stderr):
#     def get_parser(self, prog_name):
#     def take_action(self, parsed_args):
# def _find_failing(repo):
#     def gather_errors(test_dict):
# def run_command(config='.stestr.conf', repo_type='file',
#                 repo_url=None, test_path=None, top_dir=None, group_regex=None,
#                 failing=False, serial=False, concurrency=0, load_list=None,
#                 subunit_out=False, until_failure=False,
#                 analyze_isolation=False, isolated=False, worker_path=None,
#                 exclude_list=None,
#                 include_list=None,
#                 exclude_regex=None, no_discover=False,
#                 random=False, combine=False, filters=None, pretty_out=True,
#                 color=False, stdout=sys.stdout, abbreviate=False,
#                 suppress_attachments=False, all_attachments=False,
#                 show_binary_attachments=True, pdb=False):
#         def run_tests():
# def _run_tests(cmd, until_failure,
#                subunit_out=False, combine_id=None, repo_type='file',
#                repo_url=None, pretty_out=True, color=False, stdout=sys.stdout,
#                abbreviate=False, suppress_attachments=False,
#                all_attachments=False, show_binary_attachments=False):
#         def run_tests():
# class Run(command.Command):
# 
# Path: stestr/tests/base.py
# class TestCase(testtools.TestCase):
#     def setUp(self):


import functools
import io
import os
import re
import shutil
import subprocess
import tempfile
import fixtures
import subunit as subunit_lib
import testtools
from stestr.commands import list as list_cmd
from stestr.commands import run
from stestr.tests import base

    def test_no_subunit_trace_force_subunit_trace(self):
        out, err = self.assertRunExit(
            'stestr run --no-subunit-trace --force-subunit-trace passing', 0)
        out = str(out)
        self.assertNotIn('PASSED (id=0)', out)
        self.assertIn('Totals', out)
        self.assertIn('Worker Balance', out)
        self.assertIn('Sum of execute time for each test:', out)

    def test_parallel_passing_from_func(self):
        stdout = fixtures.StringStream('stdout')
        self.useFixture(stdout)
        self.assertEqual(0, run.run_command(filters=['passing'],
                                            stdout=stdout.stream))

    def test_parallel_passing_bad_regex_from_func(self):
        stdout = fixtures.StringStream('stdout')
        self.useFixture(stdout)
        self.assertEqual(1, run.run_command(filters=['bad.regex.foobar'],
                                            stdout=stdout.stream))

    def test_parallel_fails_from_func(self):
        stdout = fixtures.StringStream('stdout')
        self.useFixture(stdout)
        self.assertEqual(1, run.run_command(stdout=stdout.stream))

    def test_serial_passing_from_func(self):
        stdout = fixtures.StringStream('stdout')
        self.useFixture(stdout)

# Path: stestr/commands/list.py
# class List(command.Command):
#     def get_parser(self, prog_name):
#     def take_action(self, parsed_args):
# def list_command(config='.stestr.conf', repo_type='file', repo_url=None,
#                  test_path=None, top_dir=None, group_regex=None,
#                  exclude_list=None,
#                  include_list=None,
#                  exclude_regex=None, filters=None,
#                  stdout=sys.stdout):
# 
# Path: stestr/commands/run.py
# def _to_int(possible, default=0, out=sys.stderr):
#     def get_parser(self, prog_name):
#     def take_action(self, parsed_args):
# def _find_failing(repo):
#     def gather_errors(test_dict):
# def run_command(config='.stestr.conf', repo_type='file',
#                 repo_url=None, test_path=None, top_dir=None, group_regex=None,
#                 failing=False, serial=False, concurrency=0, load_list=None,
#                 subunit_out=False, until_failure=False,
#                 analyze_isolation=False, isolated=False, worker_path=None,
#                 exclude_list=None,
#                 include_list=None,
#                 exclude_regex=None, no_discover=False,
#                 random=False, combine=False, filters=None, pretty_out=True,
#                 color=False, stdout=sys.stdout, abbreviate=False,
#                 suppress_attachments=False, all_attachments=False,
#                 show_binary_attachments=True, pdb=False):
#         def run_tests():
# def _run_tests(cmd, until_failure,
#                subunit_out=False, combine_id=None, repo_type='file',
#                repo_url=None, pretty_out=True, color=False, stdout=sys.stdout,
#                abbreviate=False, suppress_attachments=False,
#                all_attachments=False, show_binary_attachments=False):
#         def run_tests():
# class Run(command.Command):
# 
# Path: stestr/tests/base.py
# class TestCase(testtools.TestCase):
#     def setUp(self):


# Path: stestr/tests/test_return_codes.py
import functools
import io
import os
import re
import shutil
import subprocess
import tempfile
import fixtures
import subunit as subunit_lib
import testtools
from stestr.commands import list as list_cmd
from stestr.commands import run
from stestr.tests import base


    def test_no_subunit_trace_force_subunit_trace(self):
        out, err = self.assertRunExit(
            'stestr run --no-subunit-trace --force-subunit-trace passing', 0)
        out = str(out)
        self.assertNotIn('PASSED (id=0)', out)
        self.assertIn('Totals', out)
        self.assertIn('Worker Balance', out)
        self.assertIn('Sum of execute time for each test:', out)

    def test_parallel_passing_from_func(self):
        stdout = fixtures.StringStream('stdout')
        self.useFixture(stdout)
        self.assertEqual(0, run.run_command(filters=['passing'],
                                            stdout=stdout.stream))

    def test_parallel_passing_bad_regex_from_func(self):
        stdout = fixtures.StringStream('stdout')
        self.useFixture(stdout)
        self.assertEqual(1, run.run_command(filters=['bad.regex.foobar'],
                                            stdout=stdout.stream))

    def test_parallel_fails_from_func(self):
        stdout = fixtures.StringStream('stdout')
        self.useFixture(stdout)
        self.assertEqual(1, run.run_command(stdout=stdout.stream))

    def test_serial_passing_from_func(self):
        stdout = fixtures.StringStream('stdout')
        self.useFixture(stdout)

        self.assertEqual(0, run.run_command(filters=['passing'], serial=True,