• Facebook
  • Twitter
  • Reddit
  • StumbleUpon
  • Digg
  • email

All Samples(68)  |  Call(42)  |  Derive(15)  |  Import(11)
A class used to run DocTest test cases, and accumulate statistics.
The `run` method is used to process a single DocTest case.  It
returns a tuple `(f, t)`, where `t` is the number of test cases
tried, and `f` is the number of test cases that failed.

    >>> tests = DocTestFinder().find(_TestClass)
    >>> runner = DocTestRunner(verbose=False)
    >>> tests.sort(key = lambda test: test.name)
    >>> for test in tests:
    ...     print test.name, '->', runner.run(test)
    _TestClass -> TestResults(failed=0, attempted=2)
    _TestClass.__init__ -> TestResults(failed=0, attempted=2)
    _TestClass.get -> TestResults(failed=0, attempted=2)
    _TestClass.square -> TestResults(failed=0, attempted=1)

The `summarize` method prints a summary of all the test cases that
have been run by the runner, and returns an aggregated `(f, t)`
tuple:

    >>> runner.summarize(verbose=1)
    4 items passed all tests:
       2 tests in _TestClass
       2 tests in _TestClass.__init__
       2 tests in _TestClass.get
       1 tests in _TestClass.square
    7 tests in 4 items.
    7 passed and 0 failed.
    Test passed.
    TestResults(failed=0, attempted=7)

The aggregated number of tried examples and failed examples is
also available via the `tries` and `failures` attributes:

    >>> runner.tries
    7
    >>> runner.failures
    0

The comparison between expected outputs and actual outputs is done
by an `OutputChecker`.  This comparison may be customized with a
number of option flags; see the documentation for `testmod` for
more information.  If the option flags are insufficient, then the
comparison may also be customized by passing a subclass of
`OutputChecker` to the constructor.

The test runner's display output can be controlled in two ways.
First, an output function (`out) can be passed to
`TestRunner.run`; this function will be called with strings that
should be displayed.  It defaults to `sys.stdout.write`.  If
capturing the output is not sufficient, then the display output
can be also customized by subclassing DocTestRunner, and
overriding the methods `report_start`, `report_success`,
`report_unexpected_exception`, and `report_failure`.

src/m/u/mutant-HEAD/mutant.py   mutant(Download)
def _quiet_testmod(module):
    """
    Run all of a modules doctests, not producing any output to stdout.
    Return a tuple with the number of failures and the number of tries.
    """
    finder = doctest.DocTestFinder(exclude_empty=False)
    runner = doctest.DocTestRunner(verbose=False)

src/m/u/mutant-0.1/mutant.py   mutant(Download)
def _quiet_testmod(module):
    """
    Run all of a modules doctests, not producing any output to stdout.
    Return a tuple with the number of failures and the number of tries.
    """
    finder = doctest.DocTestFinder(exclude_empty=False)
    runner = doctest.DocTestRunner(verbose=False)

src/f/u/funkload-1.13.0/src/funkload/TestRunner.py   funkload(Download)
#
g_doctest_verbose = False
try:
    from doctest import DocTestSuite, DocFileSuite, DocTestCase, DocTestRunner
    from doctest import REPORTING_FLAGS, _unittest_reportflags
    g_has_doctest = True
except ImportError:
            optionflags |= _unittest_reportflags
        # Patching doctestcase to enable verbose mode
        global g_doctest_verbose
        runner = DocTestRunner(optionflags=optionflags,
                               checker=self._dt_checker,
                               verbose=g_doctest_verbose)
        # End of patch

src/r/d/rdkit-HEAD/trunk/Docs/Book/runtests.py   rdkit(Download)
                                     verbose=verbose,
                                     optionflags=optionflags)
    else:
        runner = doctest.DocTestRunner(checker=ErrorIgnorer(),
                                       verbose=verbose,
                                       optionflags=optionflags)
    # Convert the string to a test, and run it.

src/r/d/rdkit-HEAD/Docs/Book/runtests.py   rdkit(Download)
                                     verbose=verbose,
                                     optionflags=optionflags)
    else:
        runner = doctest.DocTestRunner(checker=ErrorIgnorer(),
                                       verbose=verbose,
                                       optionflags=optionflags)
    # Convert the string to a test, and run it.

src/z/a/zamboni-lib-HEAD/lib/python/IPython/dtutils.py   zamboni-lib(Download)
    if eraise:
        runner = doctest.DebugRunner()
    else:
        runner = doctest.DocTestRunner()
 
    parser = doctest.DocTestParser()
    if ns is None:

src/i/p/ipython-py3k-HEAD/IPython/deathrow/dtutils.py   ipython-py3k(Download)
    if eraise:
        runner = doctest.DebugRunner()
    else:
        runner = doctest.DocTestRunner()
 
    parser = doctest.DocTestParser()
    if ns is None:

src/i/p/ipython-0.10/IPython/dtutils.py   ipython(Download)
    if eraise:
        runner = doctest.DebugRunner()
    else:
        runner = doctest.DocTestRunner()
 
    parser = doctest.DocTestParser()
    if ns is None:

src/s/y/sympy-HEAD/sympy/utilities/runtests.py   sympy(Download)
        self._reporter.entering_filename(filename, len(tests))
        for test in tests:
            assert len(test.examples) != 0
            runner = pdoctest.DocTestRunner(optionflags=pdoctest.ELLIPSIS | \
                    pdoctest.NORMALIZE_WHITESPACE)
            old = sys.stdout
            new = StringIO()

src/s/y/sympy-tensor-HEAD/sympy/utilities/runtests.py   sympy-tensor(Download)
        self._reporter.entering_filename(filename, len(tests))
        for test in tests:
            assert len(test.examples) != 0
            runner = pdoctest.DocTestRunner(optionflags=pdoctest.ELLIPSIS | \
                    pdoctest.NORMALIZE_WHITESPACE)
            old = sys.stdout
            new = StringIO()

  1 | 2 | 3 | 4 | 5  Next