/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: Andrew Bennetts
  • Date: 2008-10-01 05:40:45 UTC
  • mfrom: (3753 +trunk)
  • mto: This revision was merged to the branch mainline in revision 3756.
  • Revision ID: andrew.bennetts@canonical.com-20081001054045-z50qc0d3p9qsc5im
Merge from bzr.dev; resolve osutils.py conflict by reverting my sha import hackery.

Show diffs side-by-side

added added

removed removed

Lines of Context:
801
801
    def _clear_hooks(self):
802
802
        # prevent hooks affecting tests
803
803
        import bzrlib.branch
 
804
        import bzrlib.smart.client
804
805
        import bzrlib.smart.server
805
806
        self._preserved_hooks = {
806
807
            bzrlib.branch.Branch: bzrlib.branch.Branch.hooks,
807
808
            bzrlib.mutabletree.MutableTree: bzrlib.mutabletree.MutableTree.hooks,
 
809
            bzrlib.smart.client._SmartClient: bzrlib.smart.client._SmartClient.hooks,
808
810
            bzrlib.smart.server.SmartTCPServer: bzrlib.smart.server.SmartTCPServer.hooks,
809
811
            }
810
812
        self.addCleanup(self._restoreHooks)
811
813
        # reset all hooks to an empty instance of the appropriate type
812
814
        bzrlib.branch.Branch.hooks = bzrlib.branch.BranchHooks()
 
815
        bzrlib.smart.client._SmartClient.hooks = bzrlib.smart.client.SmartClientHooks()
813
816
        bzrlib.smart.server.SmartTCPServer.hooks = bzrlib.smart.server.SmartServerHooks()
814
817
 
815
818
    def _silenceUI(self):
874
877
        self.assertEqual(mode, mode_test,
875
878
                         'mode mismatch %o != %o' % (mode, mode_test))
876
879
 
 
880
    def assertEqualStat(self, expected, actual):
 
881
        """assert that expected and actual are the same stat result.
 
882
 
 
883
        :param expected: A stat result.
 
884
        :param actual: A stat result.
 
885
        :raises AssertionError: If the expected and actual stat values differ
 
886
            other than by atime.
 
887
        """
 
888
        self.assertEqual(expected.st_size, actual.st_size)
 
889
        self.assertEqual(expected.st_mtime, actual.st_mtime)
 
890
        self.assertEqual(expected.st_ctime, actual.st_ctime)
 
891
        self.assertEqual(expected.st_dev, actual.st_dev)
 
892
        self.assertEqual(expected.st_ino, actual.st_ino)
 
893
        self.assertEqual(expected.st_mode, actual.st_mode)
 
894
 
877
895
    def assertPositive(self, val):
878
896
        """Assert that val is greater than 0."""
879
897
        self.assertTrue(val > 0, 'expected a positive value, but got %s' % val)
1131
1149
        # warnings.  It's the easiest way to insulate ourselves from -Werror,
1132
1150
        # though.  -- Andrew, 20071062
1133
1151
        wlist = []
1134
 
        def _catcher(message, category, filename, lineno, file=None):
 
1152
        def _catcher(message, category, filename, lineno, file=None, line=None):
1135
1153
            # despite the name, 'message' is normally(?) a Warning subclass
1136
1154
            # instance
1137
1155
            wlist.append(message)
1209
1227
        new_env = {
1210
1228
            'BZR_HOME': None, # Don't inherit BZR_HOME to all the tests.
1211
1229
            'HOME': os.getcwd(),
1212
 
            'APPDATA': None,  # bzr now use Win32 API and don't rely on APPDATA
 
1230
            # bzr now uses the Win32 API and doesn't rely on APPDATA, but the
 
1231
            # tests do check our impls match APPDATA
1213
1232
            'BZR_EDITOR': None, # test_msgeditor manipulates this variable
1214
1233
            'BZR_EMAIL': None,
1215
1234
            'BZREMAIL': None, # may still be present in the environment
2750
2769
                   'bzrlib.tests.interrepository_implementations',
2751
2770
                   'bzrlib.tests.intertree_implementations',
2752
2771
                   'bzrlib.tests.per_lock',
2753
 
                   'bzrlib.tests.repository_implementations',
 
2772
                   'bzrlib.tests.per_repository',
2754
2773
                   'bzrlib.tests.test__dirstate_helpers',
2755
2774
                   'bzrlib.tests.test_ancestry',
2756
2775
                   'bzrlib.tests.test_annotate',