~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_selftest.py

  • Committer: Robert Collins
  • Date: 2007-10-03 06:37:01 UTC
  • mfrom: (2871.1.4 commit-builder)
  • mto: This revision was merged to the branch mainline in revision 2933.
  • Revision ID: robertc@robertcollins.net-20071003063701-goxzcxccmwdukl6w
Merge bzr.dev (untested).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1659
1659
            self.check_inventory_shape(tree.inventory, files)
1660
1660
        finally:
1661
1661
            tree.unlock()
 
1662
 
 
1663
 
 
1664
class TestBlackboxSupport(TestCase):
 
1665
    """Tests for testsuite blackbox features."""
 
1666
 
 
1667
    def test_run_bzr_failure_not_caught(self):
 
1668
        # When we run bzr in blackbox mode, we want any unexpected errors to
 
1669
        # propagate up to the test suite so that it can show the error in the
 
1670
        # usual way, and we won't get a double traceback.
 
1671
        e = self.assertRaises(
 
1672
            AssertionError,
 
1673
            self.run_bzr, ['assert-fail'])
 
1674
        # make sure we got the real thing, not an error from somewhere else in
 
1675
        # the test framework
 
1676
        self.assertEquals('always fails', str(e))
 
1677
        # check that there's no traceback in the test log
 
1678
        self.assertNotContainsRe(self._get_log(keep_log_file=True),
 
1679
            r'Traceback')
 
1680
 
 
1681
    def test_run_bzr_user_error_caught(self):
 
1682
        # Running bzr in blackbox mode, normal/expected/user errors should be
 
1683
        # caught in the regular way and turned into an error message plus exit
 
1684
        # code.
 
1685
        out, err = self.run_bzr(["log", "/nonexistantpath"], retcode=3)
 
1686
        self.assertEqual(out, '')
 
1687
        self.assertEqual(err, 'bzr: ERROR: Not a branch: "/nonexistantpath/".\n')