~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_selftest.py

  • Committer: Vincent Ladeuil
  • Date: 2010-04-23 08:51:52 UTC
  • mfrom: (5131.2.6 support_OO_flag)
  • mto: This revision was merged to the branch mainline in revision 5179.
  • Revision ID: v.ladeuil+lp@free.fr-20100423085152-uoewc1vnkwqhw0pj
Manually assign docstrings to command objects, so that they work with python -OO

Show diffs side-by-side

added added

removed removed

Lines of Context:
2773
2773
        # Test that a plausible list of modules to doctest is returned
2774
2774
        # by _test_suite_modules_to_doctest.
2775
2775
        test_list = tests._test_suite_modules_to_doctest()
 
2776
        if __doc__ is None:
 
2777
            # When docstrings are stripped, there are no modules to doctest
 
2778
            self.assertEqual([], test_list)
 
2779
            return
2776
2780
        self.assertSubset([
2777
2781
            'bzrlib.timestamp',
2778
2782
            ],
2795
2799
        self.overrideAttr(tests, '_test_suite_testmod_names', testmod_names)
2796
2800
        def doctests():
2797
2801
            calls.append("modules_to_doctest")
 
2802
            if __doc__ is None:
 
2803
                return []
2798
2804
            return ['bzrlib.timestamp']
2799
2805
        self.overrideAttr(tests, '_test_suite_modules_to_doctest', doctests)
2800
2806
        expected_test_list = [
2803
2809
            ('bzrlib.tests.per_transport.TransportTests'
2804
2810
             '.test_abspath(LocalTransport,LocalURLServer)'),
2805
2811
            'bzrlib.tests.test_selftest.TestTestSuite.test_test_suite',
2806
 
            # modules_to_doctest
2807
 
            'bzrlib.timestamp.format_highres_date',
2808
2812
            # plugins can't be tested that way since selftest may be run with
2809
2813
            # --no-plugins
2810
2814
            ]
 
2815
        if __doc__ is not None:
 
2816
            expected_test_list.extend([
 
2817
                # modules_to_doctest
 
2818
                'bzrlib.timestamp.format_highres_date',
 
2819
                ])
2811
2820
        suite = tests.test_suite()
2812
2821
        self.assertEqual(set(["testmod_names", "modules_to_doctest"]),
2813
2822
            set(calls))