Repeating Tests
===============

The --repeat option can be used to repeat tests some number of times.
Repeating tests is useful to help make sure that tests clean up after
themselves.

    >>> import os.path, sys
    >>> directory_with_tests = os.path.join(this_directory, 'testrunner-ex')
    >>> defaults = [
    ...     '--path', directory_with_tests,
    ...     '--tests-pattern', '^sampletestsf?$',
    ...     ]

    >>> sys.argv = 'test --layer 112 --layer unit --repeat 3'.split()
    >>> from zope.testing import testrunner
    >>> testrunner.run(defaults)
    Running unit tests:
    Iteration 1
      Ran 192 tests with 0 failures and 0 errors in 0.054 seconds.
    Iteration 2
      Ran 192 tests with 0 failures and 0 errors in 0.054 seconds.
    Iteration 3
      Ran 192 tests with 0 failures and 0 errors in 0.052 seconds.
    Running samplelayers.Layer112 tests:
      Set up samplelayers.Layerx in 0.000 seconds.
      Set up samplelayers.Layer1 in 0.000 seconds.
      Set up samplelayers.Layer11 in 0.000 seconds.
      Set up samplelayers.Layer112 in 0.000 seconds.
    Iteration 1
      Ran 34 tests with 0 failures and 0 errors in 0.010 seconds.
    Iteration 2
      Ran 34 tests with 0 failures and 0 errors in 0.010 seconds.
    Iteration 3
      Ran 34 tests with 0 failures and 0 errors in 0.010 seconds.
    Tearing down left over layers:
      Tear down samplelayers.Layer112 in 0.000 seconds.
      Tear down samplelayers.Layerx in 0.000 seconds.
      Tear down samplelayers.Layer11 in 0.000 seconds.
      Tear down samplelayers.Layer1 in 0.000 seconds.
    Total: 226 tests, 0 failures, 0 errors
    False

The tests are repeated by layer.  Layers are set up and torn down only
once.
 
