# 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_parallel_subunit_passing(self):
        self.assertRunExit('stestr --user-config stestr.yaml run --subunit '
                           'passing', 0, subunit=True)

    def test_parallel_subunit_failing(self):
        self.assertRunExit('stestr --user-config stestr.yaml run --subunit '
                           'failing', 0, subunit=True)

    def test_slowest_passing(self):
        self.assertRunExit('stestr run --slowest passing', 0)

    def test_slowest_failing(self):
        self.assertRunExit('stestr run --slowest failing', 1)

    def test_until_failure_fails(self):
        self.assertRunExit('stestr run --until-failure', 1)

    def test_until_failure_with_subunit_fails(self):
        self.assertRunExit('stestr --user-config stestr.yaml run '
                           '--until-failure --subunit', 1, subunit=True)

    def test_with_parallel_class(self):
        # NOTE(masayukig): Ideally, it's better to figure out the
        # difference between with --parallel-class and without
        # --parallel-class. However, it's difficult to make such a
        # test from a command line based test.
        self.assertRunExit('stestr --parallel-class run passing', 0)

    def test_no_repo_dir(self):
        stestr_repo_dir = os.path.join(self.directory, '.stestr')

# 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_parallel_subunit_passing(self):
        self.assertRunExit('stestr --user-config stestr.yaml run --subunit '
                           'passing', 0, subunit=True)

    def test_parallel_subunit_failing(self):
        self.assertRunExit('stestr --user-config stestr.yaml run --subunit '
                           'failing', 0, subunit=True)

    def test_slowest_passing(self):
        self.assertRunExit('stestr run --slowest passing', 0)

    def test_slowest_failing(self):
        self.assertRunExit('stestr run --slowest failing', 1)

    def test_until_failure_fails(self):
        self.assertRunExit('stestr run --until-failure', 1)

    def test_until_failure_with_subunit_fails(self):
        self.assertRunExit('stestr --user-config stestr.yaml run '
                           '--until-failure --subunit', 1, subunit=True)

    def test_with_parallel_class(self):
        # NOTE(masayukig): Ideally, it's better to figure out the
        # difference between with --parallel-class and without
        # --parallel-class. However, it's difficult to make such a
        # test from a command line based test.
        self.assertRunExit('stestr --parallel-class run passing', 0)

    def test_no_repo_dir(self):
        stestr_repo_dir = os.path.join(self.directory, '.stestr')

        shutil.rmtree(stestr_repo_dir, ignore_errors=True)