[MERGE] Remove noise from bzr selftest --list-only so that it is easier to use in scripts.
Vincent Ladeuil
v.ladeuil+lp at free.fr
Wed Apr 8 09:26:26 BST 2009
>>>>> "robert" == Robert Collins <robert.collins at canonical.com> writes:
robert> This changes bzr selftest --list to not output a blank line at the top
robert> or summary data about the tests, and in fact to not create a result
robert> object at all, avoiding progress bars and other noise happening.
BB:tweak
Can you take the following into account:
=== modified file 'bzrlib/builtins.py'
--- bzrlib/builtins.py 2009-04-08 03:34:31 +0000
+++ bzrlib/builtins.py 2009-04-08 07:49:20 +0000
@@ -3230,6 +3230,7 @@
Command.__init__(self)
self.additional_selftest_args = {}
+ @display_command
def run(self, testspecs_list=None, verbose=False, one=False,
transport=None, benchmark=None,
lsprof_timed=None, cache_dir=None,
@@ -3247,13 +3248,13 @@
if cache_dir is not None:
tree_creator.TreeCreator.CACHE_ROOT = osutils.abspath(cache_dir)
if not list_only:
- print 'testing: %s' % (osutils.realpath(sys.argv[0]),)
- print ' %s (%s python%s)' % (
+ self.outf.write('testing: %s\n' % (osutils.realpath(sys.argv[0]),))
+ self.outf.write(' %s (%s python%s)\n' % (
bzrlib.__path__[0],
bzrlib.version_string,
bzrlib._format_version_tuple(sys.version_info),
- )
- print
+ ))
+ self.outf.write('\n')
if testspecs_list is not None:
pattern = '|'.join(testspecs_list)
else:
robert> === modified file 'bzrlib/tests/__init__.py'
robert> --- bzrlib/tests/__init__.py 2009-04-07 13:56:43 +0000
robert> +++ bzrlib/tests/__init__.py 2009-04-08 07:46:50 +0000
robert> @@ -542,7 +542,7 @@
robert> for t in iter_suite_tests(test):
robert> self.stream.writeln("%s" % (t.id()))
robert> run += 1
robert> - actionTaken = "Listed"
robert> + return None
robert> else:
robert> try:
robert> import testtools
robert> @@ -2653,6 +2653,8 @@
robert> for decorator in decorators:
robert> suite = decorator(suite)
robert> result = runner.run(suite)
robert> + if list_only:
robert> + return True
Hmm, don't we want to consider an empty list a failure ?
Also, there is a
result.report_starting()
that you may want to execute only when running the
tests. Arguably the stop_early (just above) doesn't make sense
either when listing tests.
...
nor does the result creation after all :)
Vincent
More information about the bazaar
mailing list