~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_selftest.py

  • Committer: Martin
  • Date: 2010-05-16 15:18:43 UTC
  • mfrom: (5235 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5239.
  • Revision ID: gzlist@googlemail.com-20100516151843-lu53u7caehm3ie3i
Merge bzr.dev to resolve conflicts in NEWS and _chk_map_pyx

Show diffs side-by-side

added added

removed removed

Lines of Context:
609
609
                l.attempt_lock()
610
610
        test = TestDanglingLock('test_function')
611
611
        result = test.run()
 
612
        total_failures = result.errors + result.failures
612
613
        if self._lock_check_thorough:
613
 
            self.assertEqual(1, len(result.errors))
 
614
            self.assertLength(1, total_failures)
614
615
        else:
615
616
            # When _lock_check_thorough is disabled, then we don't trigger a
616
617
            # failure
617
 
            self.assertEqual(0, len(result.errors))
 
618
            self.assertLength(0, total_failures)
618
619
 
619
620
 
620
621
class TestTestCaseWithTransport(tests.TestCaseWithTransport):
2773
2774
        # Test that a plausible list of modules to doctest is returned
2774
2775
        # by _test_suite_modules_to_doctest.
2775
2776
        test_list = tests._test_suite_modules_to_doctest()
 
2777
        if __doc__ is None:
 
2778
            # When docstrings are stripped, there are no modules to doctest
 
2779
            self.assertEqual([], test_list)
 
2780
            return
2776
2781
        self.assertSubset([
2777
2782
            'bzrlib.timestamp',
2778
2783
            ],
2795
2800
        self.overrideAttr(tests, '_test_suite_testmod_names', testmod_names)
2796
2801
        def doctests():
2797
2802
            calls.append("modules_to_doctest")
 
2803
            if __doc__ is None:
 
2804
                return []
2798
2805
            return ['bzrlib.timestamp']
2799
2806
        self.overrideAttr(tests, '_test_suite_modules_to_doctest', doctests)
2800
2807
        expected_test_list = [
2803
2810
            ('bzrlib.tests.per_transport.TransportTests'
2804
2811
             '.test_abspath(LocalTransport,LocalURLServer)'),
2805
2812
            'bzrlib.tests.test_selftest.TestTestSuite.test_test_suite',
2806
 
            # modules_to_doctest
2807
 
            'bzrlib.timestamp.format_highres_date',
2808
2813
            # plugins can't be tested that way since selftest may be run with
2809
2814
            # --no-plugins
2810
2815
            ]
 
2816
        if __doc__ is not None:
 
2817
            expected_test_list.extend([
 
2818
                # modules_to_doctest
 
2819
                'bzrlib.timestamp.format_highres_date',
 
2820
                ])
2811
2821
        suite = tests.test_suite()
2812
2822
        self.assertEqual(set(["testmod_names", "modules_to_doctest"]),
2813
2823
            set(calls))