/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/__init__.py

  • Committer: Aaron Bentley
  • Date: 2007-02-07 03:09:58 UTC
  • mfrom: (2268 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2269.
  • Revision ID: aaron.bentley@utoronto.ca-20070207030958-fx6ykp7rg7zma6xu
Merge bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
569
569
        self._startLogFile()
570
570
        self._benchcalls = []
571
571
        self._benchtime = None
 
572
        # prevent hooks affecting tests
 
573
        self._preserved_hooks = bzrlib.branch.Branch.hooks
 
574
        self.addCleanup(self._restoreHooks)
 
575
        # this list of hooks must be kept in sync with the defaults
 
576
        # in branch.py
 
577
        bzrlib.branch.Branch.hooks = bzrlib.branch.BranchHooks()
572
578
 
573
579
    def _silenceUI(self):
574
580
        """Turn off UI for duration of test"""
661
667
                excName = str(excClass)
662
668
            raise self.failureException, "%s not raised" % excName
663
669
 
664
 
    def assertIs(self, left, right):
 
670
    def assertIs(self, left, right, message=None):
665
671
        if not (left is right):
666
 
            raise AssertionError("%r is not %r." % (left, right))
 
672
            if message is not None:
 
673
                raise AssertionError(message)
 
674
            else:
 
675
                raise AssertionError("%r is not %r." % (left, right))
 
676
 
 
677
    def assertIsNot(self, left, right, message=None):
 
678
        if (left is right):
 
679
            if message is not None:
 
680
                raise AssertionError(message)
 
681
            else:
 
682
                raise AssertionError("%r is %r." % (left, right))
667
683
 
668
684
    def assertTransportMode(self, transport, path, mode):
669
685
        """Fail if a path does not have mode mode.
825
841
        for name, value in self.__old_env.iteritems():
826
842
            osutils.set_or_unset_env(name, value)
827
843
 
 
844
    def _restoreHooks(self):
 
845
        bzrlib.branch.Branch.hooks = self._preserved_hooks
 
846
 
828
847
    def tearDown(self):
829
848
        self._runCleanups()
830
849
        unittest.TestCase.tearDown(self)
1539
1558
 
1540
1559
    def failUnlessExists(self, path):
1541
1560
        """Fail unless path, which may be abs or relative, exists."""
1542
 
        self.failUnless(osutils.lexists(path))
 
1561
        self.failUnless(osutils.lexists(path),path+" does not exist")
1543
1562
 
1544
1563
    def failIfExists(self, path):
1545
1564
        """Fail if path, which may be abs or relative, exists."""
1546
 
        self.failIf(osutils.lexists(path))
 
1565
        self.failIf(osutils.lexists(path),path+" exists")
1547
1566
 
1548
1567
 
1549
1568
class TestCaseWithTransport(TestCaseInTempDir):
1750
1769
                   'bzrlib.tests.test_config',
1751
1770
                   'bzrlib.tests.test_conflicts',
1752
1771
                   'bzrlib.tests.test_decorators',
 
1772
                   'bzrlib.tests.test_delta',
1753
1773
                   'bzrlib.tests.test_diff',
1754
1774
                   'bzrlib.tests.test_doc_generate',
1755
1775
                   'bzrlib.tests.test_errors',