~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_selftest.py

  • Committer: John Arbash Meinel
  • Date: 2009-07-24 18:26:21 UTC
  • mfrom: (4567 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4568.
  • Revision ID: john@arbash-meinel.com-20090724182621-68s2jhoqf3pn72n7
Merge bzr.dev 4567 to resolve NEWS

Show diffs side-by-side

added added

removed removed

Lines of Context:
723
723
                self.time(time.sleep, 0.003)
724
724
        self.check_timing(ShortDelayTestCase('test_short_delay'),
725
725
                          r"^ +[0-9]+ms$")
726
 
        # if a benchmark time is given, we want a x of y style result.
 
726
        # if a benchmark time is given, we now show just that time followed by
 
727
        # a star
727
728
        self.check_timing(ShortDelayTestCase('test_short_benchmark'),
728
 
                          r"^ +[0-9]+ms/ +[0-9]+ms$")
 
729
                          r"^ +[0-9]+ms\*$")
729
730
 
730
731
    def test_unittest_reporting_unittest_class(self):
731
732
        # getting the time from a non-bzrlib test works ok
943
944
        result.report_unsupported(test, feature)
944
945
        output = result_stream.getvalue()[prefix:]
945
946
        lines = output.splitlines()
946
 
        self.assertEqual(lines, ['NODEP                   0ms',
 
947
        self.assertEqual(lines, ['NODEP        0ms',
947
948
                                 "    The feature 'Feature' is not available."])
948
949
 
949
950
    def test_text_report_unsupported(self):
1490
1491
        sample_test.run(result)
1491
1492
        self.assertContainsRe(
1492
1493
            output_stream.getvalue(),
1493
 
            r"\d+ms/ +\d+ms\n$")
 
1494
            r"\d+ms\*\n$")
1494
1495
 
1495
1496
    def test_hooks_sanitised(self):
1496
1497
        """The bzrlib hooks should be sanitised by setUp."""
1686
1687
    def test_assert_isinstance(self):
1687
1688
        self.assertIsInstance(2, int)
1688
1689
        self.assertIsInstance(u'', basestring)
1689
 
        self.assertRaises(AssertionError, self.assertIsInstance, None, int)
 
1690
        e = self.assertRaises(AssertionError, self.assertIsInstance, None, int)
 
1691
        self.assertEquals(str(e),
 
1692
            "None is an instance of <type 'NoneType'> rather than <type 'int'>")
1690
1693
        self.assertRaises(AssertionError, self.assertIsInstance, 23.3, int)
 
1694
        e = self.assertRaises(AssertionError,
 
1695
            self.assertIsInstance, None, int, "it's just not")
 
1696
        self.assertEquals(str(e),
 
1697
            "None is an instance of <type 'NoneType'> rather than <type 'int'>"
 
1698
            ": it's just not")
1691
1699
 
1692
1700
    def test_assertEndsWith(self):
1693
1701
        self.assertEndsWith('foo', 'oo')