418
402
self.pb.update('[test 0/%d] starting...' % (self.num_tests))
420
404
def _progress_prefix_text(self):
421
a = '[%d' % self.count
405
# the longer this text, the less space we have to show the test
407
a = '[%d' % self.count # total that have been run
408
# tests skipped as known not to be relevant are not important enough
410
## if self.skip_count:
411
## a += ', %d skip' % self.skip_count
412
## if self.known_failure_count:
413
## a += '+%dX' % self.known_failure_count
422
414
if self.num_tests is not None:
423
415
a +='/%d' % self.num_tests
424
a += ' in %ds' % (time.time() - self._overall_start_time)
417
runtime = time.time() - self._overall_start_time
419
a += '%dm%ds' % (runtime / 60, runtime % 60)
425
422
if self.error_count:
426
a += ', %d errors' % self.error_count
423
a += ', %d err' % self.error_count
427
424
if self.failure_count:
428
a += ', %d failed' % self.failure_count
429
if self.known_failure_count:
430
a += ', %d known failures' % self.known_failure_count
432
a += ', %d skipped' % self.skip_count
425
a += ', %d fail' % self.failure_count
433
426
if self.unsupported:
434
a += ', %d missing features' % len(self.unsupported)
427
a += ', %d missing' % len(self.unsupported)
2810
2805
'bzrlib.tests.test_transport_implementations',
2811
2806
'bzrlib.tests.test_read_bundle',
2813
suite = TestUtil.TestSuite()
2814
2808
loader = TestUtil.TestLoader()
2816
if keep_only is not None:
2810
if keep_only is None:
2811
loader = TestUtil.TestLoader()
2817
2813
id_filter = TestIdList(keep_only)
2814
loader = TestUtil.FilteredByModuleTestLoader(id_filter.refers_to)
2815
suite = loader.suiteClass()
2819
2817
# modules building their suite with loadTestsFromModuleNames
2820
if keep_only is None:
2821
suite.addTest(loader.loadTestsFromModuleNames(testmod_names))
2823
for mod in [m for m in testmod_names
2824
if id_filter.is_module_name_used(m)]:
2825
mod_suite = loader.loadTestsFromModuleNames([mod])
2826
mod_suite = filter_suite_by_id_list(mod_suite, id_filter)
2827
suite.addTest(mod_suite)
2818
suite.addTest(loader.loadTestsFromModuleNames(testmod_names))
2829
2820
# modules adapted for transport implementations
2830
2821
from bzrlib.tests.test_transport_implementations import TransportTestProviderAdapter
2831
2822
adapter = TransportTestProviderAdapter()
2832
if keep_only is None:
2833
adapt_modules(test_transport_implementations, adapter, loader, suite)
2835
for mod in [m for m in test_transport_implementations
2836
if id_filter.is_module_name_used(m)]:
2837
mod_suite = TestUtil.TestSuite()
2838
adapt_modules([mod], adapter, loader, mod_suite)
2839
mod_suite = filter_suite_by_id_list(mod_suite, id_filter)
2840
suite.addTest(mod_suite)
2823
adapt_modules(test_transport_implementations, adapter, loader, suite)
2842
2825
# modules defining their own test_suite()
2843
2826
for package in [p for p in packages_to_test()
2844
2827
if (keep_only is None
2845
or id_filter.is_module_name_used(p.__name__))]:
2828
or id_filter.refers_to(p.__name__))]:
2846
2829
pack_suite = package.test_suite()
2847
if keep_only is not None:
2848
pack_suite = filter_suite_by_id_list(pack_suite, id_filter)
2849
2830
suite.addTest(pack_suite)
2851
for mod in MODULES_TO_DOCTEST:
2832
modules_to_doctest = [
2837
'bzrlib.iterablefile',
2844
'bzrlib.version_info_formats.format_custom',
2847
for mod in modules_to_doctest:
2848
if not (keep_only is None or id_filter.refers_to(mod)):
2849
# No tests to keep here, move along
2853
2852
doc_suite = doctest.DocTestSuite(mod)
2854
2853
except ValueError, e:
2855
2854
print '**failed to get doctest for: %s\n%s' % (mod, e)
2857
if keep_only is not None:
2858
# DocTests may use ids which doesn't contain the module name
2859
doc_suite = filter_suite_by_id_list(doc_suite, id_filter)
2860
2856
suite.addTest(doc_suite)
2862
2858
default_encoding = sys.getdefaultencoding()
2863
2859
for name, plugin in bzrlib.plugin.plugins().items():
2864
2860
if keep_only is not None:
2865
if not id_filter.is_module_name_used(plugin.module.__name__):
2861
if not id_filter.refers_to(plugin.module.__name__):
2867
2863
plugin_suite = plugin.test_suite()
2868
2864
# We used to catch ImportError here and turn it into just a warning,
2869
2865
# but really if you don't have --no-plugins this should be a failure.
2870
2866
# mbp 20080213 - see http://bugs.launchpad.net/bugs/189771
2867
if plugin_suite is None:
2868
plugin_suite = plugin.load_plugin_tests(loader)
2871
2869
if plugin_suite is not None:
2872
if keep_only is not None:
2873
plugin_suite = filter_suite_by_id_list(plugin_suite,
2875
2870
suite.addTest(plugin_suite)
2876
2871
if default_encoding != sys.getdefaultencoding():
2877
2872
bzrlib.trace.warning(