~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/__init__.py

  • Committer: John Arbash Meinel
  • Date: 2009-11-18 15:47:16 UTC
  • mto: This revision was merged to the branch mainline in revision 4810.
  • Revision ID: john@arbash-meinel.com-20091118154716-meiszr5ej7ohas3v
Move all the stat comparison and platform checkning code to assertEqualStat.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1107
1107
        self.assertEqual(mode, mode_test,
1108
1108
                         'mode mismatch %o != %o' % (mode, mode_test))
1109
1109
 
1110
 
    def assertEqualStat(self, expected, actual, ignore_ino=False):
 
1110
    def assertEqualStat(self, expected, actual):
1111
1111
        """assert that expected and actual are the same stat result.
1112
1112
 
1113
1113
        :param expected: A stat result.
1114
1114
        :param actual: A stat result.
1115
 
        :param ignore_ino: On Windows os.fstat() returns a value for st_ino,
1116
 
            but os.lstat() returns 0 for st_ino. As such, we can't trust the
1117
 
            value.
1118
1115
        :raises AssertionError: If the expected and actual stat values differ
1119
1116
            other than by atime.
1120
1117
        """
1124
1121
                         'st_mtime did not match')
1125
1122
        self.assertEqual(expected.st_ctime, actual.st_ctime,
1126
1123
                         'st_ctime did not match')
1127
 
        self.assertEqual(expected.st_dev, actual.st_dev,
1128
 
                         'st_dev did not match')
1129
 
        if not ignore_ino:
 
1124
        if sys.platform == 'win32':
 
1125
            # On Win32 both 'dev' and 'ino' cannot be trusted. In python2.4 it
 
1126
            # is 'dev' that varies, in python 2.5 (6?) it is st_ino that is
 
1127
            # odd. Regardless we shouldn't actually try to assert anything
 
1128
            # about their values
 
1129
            self.assertEqual(expected.st_dev, actual.st_dev,
 
1130
                             'st_dev did not match')
1130
1131
            self.assertEqual(expected.st_ino, actual.st_ino,
1131
1132
                             'st_ino did not match')
1132
1133
        self.assertEqual(expected.st_mode, actual.st_mode,