652
613
global MODULES_TO_DOCTEST
615
# FIXME: If these fail to load, e.g. because of a syntax error, the
616
# exception is hidden by unittest. Sucks. Should either fix that or
617
# perhaps import them and pass them to unittest as modules.
619
['bzrlib.tests.MetaTestLog',
620
'bzrlib.tests.test_api',
621
'bzrlib.tests.test_gpg',
622
'bzrlib.tests.test_identitymap',
623
'bzrlib.tests.test_inv',
655
624
'bzrlib.tests.test_ancestry',
656
'bzrlib.tests.test_annotate',
657
'bzrlib.tests.test_api',
658
'bzrlib.tests.test_bad_files',
659
'bzrlib.tests.test_basis_inventory',
660
'bzrlib.tests.test_branch',
625
'bzrlib.tests.test_commit',
661
626
'bzrlib.tests.test_command',
662
'bzrlib.tests.test_commit',
663
627
'bzrlib.tests.test_commit_merge',
664
628
'bzrlib.tests.test_config',
665
'bzrlib.tests.test_conflicts',
666
'bzrlib.tests.test_diff',
667
'bzrlib.tests.test_fetch',
668
'bzrlib.tests.test_gpg',
669
'bzrlib.tests.test_graph',
629
'bzrlib.tests.test_merge3',
630
'bzrlib.tests.test_merge',
670
631
'bzrlib.tests.test_hashcache',
671
'bzrlib.tests.test_http',
672
'bzrlib.tests.test_identitymap',
673
'bzrlib.tests.test_inv',
632
'bzrlib.tests.test_status',
674
633
'bzrlib.tests.test_log',
675
'bzrlib.tests.test_merge',
676
'bzrlib.tests.test_merge3',
634
'bzrlib.tests.test_revisionnamespaces',
635
'bzrlib.tests.test_branch',
636
'bzrlib.tests.test_revision',
637
'bzrlib.tests.test_revision_info',
677
638
'bzrlib.tests.test_merge_core',
678
'bzrlib.tests.test_missing',
679
'bzrlib.tests.test_msgeditor',
680
'bzrlib.tests.test_nonascii',
681
'bzrlib.tests.test_options',
682
'bzrlib.tests.test_osutils',
639
'bzrlib.tests.test_smart_add',
640
'bzrlib.tests.test_bad_files',
641
'bzrlib.tests.test_diff',
683
642
'bzrlib.tests.test_parent',
684
'bzrlib.tests.test_permissions',
685
'bzrlib.tests.test_plugins',
686
'bzrlib.tests.test_remove',
687
'bzrlib.tests.test_revision',
688
'bzrlib.tests.test_revisionnamespaces',
689
'bzrlib.tests.test_revprops',
690
'bzrlib.tests.test_reweave',
691
'bzrlib.tests.test_rio',
643
'bzrlib.tests.test_xml',
644
'bzrlib.tests.test_weave',
645
'bzrlib.tests.test_fetch',
646
'bzrlib.tests.test_whitebox',
647
'bzrlib.tests.test_store',
692
648
'bzrlib.tests.test_sampler',
693
'bzrlib.tests.test_selftest',
694
'bzrlib.tests.test_setup',
695
'bzrlib.tests.test_sftp_transport',
696
'bzrlib.tests.test_smart_add',
697
'bzrlib.tests.test_source',
698
'bzrlib.tests.test_status',
699
'bzrlib.tests.test_store',
700
'bzrlib.tests.test_symbol_versioning',
701
'bzrlib.tests.test_testament',
702
'bzrlib.tests.test_trace',
703
649
'bzrlib.tests.test_transactions',
704
650
'bzrlib.tests.test_transport',
651
'bzrlib.tests.test_sftp',
652
'bzrlib.tests.test_graph',
653
'bzrlib.tests.test_workingtree',
654
'bzrlib.tests.test_upgrade',
655
'bzrlib.tests.test_uncommit',
656
'bzrlib.tests.test_conflicts',
657
'bzrlib.tests.test_testament',
658
'bzrlib.tests.test_annotate',
659
'bzrlib.tests.test_revprops',
660
'bzrlib.tests.test_options',
661
'bzrlib.tests.test_http',
662
'bzrlib.tests.test_nonascii',
663
'bzrlib.tests.test_reweave',
705
664
'bzrlib.tests.test_tsort',
706
'bzrlib.tests.test_ui',
707
'bzrlib.tests.test_uncommit',
708
'bzrlib.tests.test_upgrade',
709
'bzrlib.tests.test_weave',
710
'bzrlib.tests.test_whitebox',
711
'bzrlib.tests.test_workingtree',
712
'bzrlib.tests.test_xml',
665
'bzrlib.tests.test_trace',
666
'bzrlib.tests.test_rio',
715
TestCase.BZRPATH = osutils.pathjoin(
716
osutils.realpath(osutils.dirname(bzrlib.__path__[0])), 'bzr')
717
print '%10s: %s' % ('bzr', osutils.realpath(sys.argv[0]))
718
print '%10s: %s' % ('bzrlib', bzrlib.__path__[0])
669
TestCase.BZRPATH = os.path.join(os.path.realpath(os.path.dirname(bzrlib.__path__[0])), 'bzr')
670
print '%-30s %s' % ('bzr binary', TestCase.BZRPATH)
720
672
suite = TestSuite()
721
# python2.4's TestLoader.loadTestsFromNames gives very poor
722
# errors if it fails to load a named module - no indication of what's
723
# actually wrong, just "no such module". We should probably override that
724
# class, but for the moment just load them ourselves. (mbp 20051202)
725
loader = TestLoader()
726
for mod_name in testmod_names:
727
mod = _load_module_by_name(mod_name)
728
suite.addTest(loader.loadTestsFromModule(mod))
673
suite.addTest(TestLoader().loadTestsFromNames(testmod_names))
729
674
for package in packages_to_test():
730
675
suite.addTest(package.test_suite())
731
676
for m in MODULES_TO_TEST:
732
suite.addTest(loader.loadTestsFromModule(m))
677
suite.addTest(TestLoader().loadTestsFromModule(m))
733
678
for m in (MODULES_TO_DOCTEST):
734
679
suite.addTest(DocTestSuite(m))
735
for name, plugin in bzrlib.plugin.all_plugins().items():
736
if hasattr(plugin, 'test_suite'):
737
suite.addTest(plugin.test_suite())
680
for p in bzrlib.plugin.all_plugins:
681
if hasattr(p, 'test_suite'):
682
suite.addTest(p.test_suite())
741
def _load_module_by_name(mod_name):
742
parts = mod_name.split('.')
743
module = __import__(mod_name)
745
# for historical reasons python returns the top-level module even though
746
# it loads the submodule; we need to walk down to get the one we want.
748
module = getattr(module, parts.pop(0))