2047
2047
class cmd_selftest(Command):
2048
2048
"""Run internal test suite.
2050
This creates temporary test directories in the working directory,
2051
but not existing data is affected. These directories are deleted
2052
if the tests pass, or left behind to help in debugging if they
2053
fail and --keep-output is specified.
2050
This creates temporary test directories in the working directory, but not
2051
existing data is affected. These directories are deleted if the tests
2052
pass, or left behind to help in debugging if they fail and --keep-output
2055
If arguments are given, they are regular expressions that say
2056
which tests should run.
2055
If arguments are given, they are regular expressions that say which tests
2056
should run. Tests matching any expression are run, and other tests are
2059
Alternatively if --first is given, matching tests are run first and then
2060
all other tests are run. This is useful if you have been working in a
2061
particular area, but want to make sure nothing else was broken.
2058
2063
If the global option '--no-plugins' is given, plugins are not loaded
2059
2064
before running the selftests. This has two effects: features provided or
2060
2065
modified by plugins will not be tested, and tests provided by plugins will
2064
2069
bzr selftest ignore
2070
run only tests relating to 'ignore'
2065
2071
bzr --no-plugins selftest -v
2072
disable plugins and list tests as they're run
2067
2074
# TODO: --list should give a list of all available tests
2103
2110
Option('clean-output',
2104
2111
help='clean temporary tests directories'
2105
2112
' without running tests'),
2114
help='run all tests, but run specified tests first',
2107
2117
encoding_type = 'replace'
2109
2119
def run(self, testspecs_list=None, verbose=None, one=False,
2110
2120
keep_output=False, transport=None, benchmark=None,
2111
lsprof_timed=None, cache_dir=None, clean_output=False):
2121
lsprof_timed=None, cache_dir=None, clean_output=False,
2112
2123
import bzrlib.ui
2113
2124
from bzrlib.tests import selftest
2114
2125
import bzrlib.benchmarks as benchmarks
2147
2158
transport=transport,
2148
2159
test_suite_factory=test_suite_factory,
2149
2160
lsprof_timed=lsprof_timed,
2150
bench_history=benchfile)
2161
bench_history=benchfile,
2162
matching_tests_first=first,
2152
2165
if benchfile is not None:
2153
2166
benchfile.close()