virtue/runner.py
def run(tests=(), reporter=None, stop_after=None):
    """
    Run the tests that are loaded by each of the strings provided.

    Arguments:

        tests (iterable):

            the collection of tests (specified as `str` s) to run

        reporter (Reporter):

            a `Reporter` to use for the run. If unprovided, the default
            is to return a `virtue.reporters.Counter` (which produces no
            output).

        stop_after (int):

            a number of non-successful tests to allow before stopping the run.

    """

    if reporter is None:
        reporter = Counter()
    if stop_after is not None:
        reporter = _StopAfterWrapper(reporter=reporter, limit=stop_after)

    locator = ObjectLocator()
    cases = (
        case
        for test in tests
        for loader in locator.locate_by_name(name=test)
        for case in loader.load()
    )
    suite = unittest.TestSuite(cases)
    getattr(reporter, "startTestRun", lambda: None)()
    suite.run(reporter)
    getattr(reporter, "stopTestRun", lambda: None)()
    return reporter
def run(tests=(), reporter=None, stop_after=None):
    """
    Run the tests that are loaded by each of the strings provided.

    Arguments:

        tests (iterable):

            the collection of tests (specified as `str` s) to run

        reporter (Reporter):

            a `Reporter` to use for the run. If unprovided, the default
            is to return a `virtue.reporters.Counter` (which produces no
            output).

        stop_after (int):

            a number of non-successful tests to allow before stopping the run.

    """

    if reporter is None:
        reporter = Counter()
    if stop_after is not None:
        reporter = _StopAfterWrapper(reporter=reporter, limit=stop_after)

    locator = ObjectLocator()
    cases = (
        case
        for test in tests
        for loader in locator.locate_by_name(name=test)
        for case in loader.load()
    )
    suite = unittest.TestSuite(cases)
    getattr(reporter, "startTestRun", lambda: None)()
    suite.run(reporter)
    getattr(reporter, "stopTestRun", lambda: None)()
    return reporter
def run ( tests = ( ) , reporter = None , stop_after = None ) : if reporter is None : reporter = Counter ( ) if stop_after is not None : reporter = _StopAfterWrapper ( reporter = reporter , limit = stop_after ) locator = ObjectLocator ( ) cases = ( case for test in tests for loader in locator . locate_by_name ( name = test ) for case in loader . load ( ) ) suite = unittest . TestSuite ( cases ) getattr ( reporter , "startTestRun" , lambda : None ) ( ) suite . run ( reporter ) getattr ( reporter , "stopTestRun" , lambda : None ) ( ) return reporter
Run the tests that are loaded by each of the strings provided.

    Arguments:

        tests (iterable):

            the collection of tests (specified as `str` s) to run

        reporter (Reporter):

            a `Reporter` to use for the run. If unprovided, the default
            is to return a `virtue.reporters.Counter` (which produces no
            output).

        stop_after (int):

            a number of non-successful tests to allow before stopping the run.
Run the tests that are loaded by each of the strings provided .