/breezy/trunk

To get this branch, use:
bzr branch https://code.breezy-vcs.org/breezy/trunk

« back to all changes in this revision

Viewing changes to breezy/tests/test_knit.py

  • Committer: Jelmer Vernooij
  • Date: 2017-07-23 22:06:41 UTC
  • mfrom: (6738 trunk)
  • mto: This revision was merged to the branch mainline in revision 6739.
  • Revision ID: jelmer@jelmer.uk-20170723220641-69eczax9bmv8d6kk
Merge trunk, address review comments.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1196
1196
            "b option 0 1 4 :"  # We don't have a 4th record
1197
1197
            ])
1198
1198
        index = self.get_knit_index(transport, 'filename', 'r')
1199
 
        try:
1200
 
            self.assertRaises(errors.KnitCorrupt, index.keys)
1201
 
        except TypeError as e:
1202
 
            if (str(e) == ('exceptions must be strings, classes, or instances,'
1203
 
                           ' not exceptions.IndexError')):
1204
 
                self.knownFailure('Pyrex <0.9.5 fails with TypeError when'
1205
 
                                  ' raising new style exceptions with python'
1206
 
                                  ' >=2.5')
1207
 
            else:
1208
 
                raise
 
1199
        self.assertRaises(errors.KnitCorrupt, index.keys)
1209
1200
 
1210
1201
    def test_corrupted_parent(self):
1211
1202
        transport = MockTransport([
1215
1206
            "c option 0 1 1v :", # Can't have a parent of '1v'
1216
1207
            ])
1217
1208
        index = self.get_knit_index(transport, 'filename', 'r')
1218
 
        try:
1219
 
            self.assertRaises(errors.KnitCorrupt, index.keys)
1220
 
        except TypeError as e:
1221
 
            if (str(e) == ('exceptions must be strings, classes, or instances,'
1222
 
                           ' not exceptions.ValueError')):
1223
 
                self.knownFailure('Pyrex <0.9.5 fails with TypeError when'
1224
 
                                  ' raising new style exceptions with python'
1225
 
                                  ' >=2.5')
1226
 
            else:
1227
 
                raise
 
1209
        self.assertRaises(errors.KnitCorrupt, index.keys)
1228
1210
 
1229
1211
    def test_corrupted_parent_in_list(self):
1230
1212
        transport = MockTransport([
1234
1216
            "c option 0 1 1 v :", # Can't have a parent of 'v'
1235
1217
            ])
1236
1218
        index = self.get_knit_index(transport, 'filename', 'r')
1237
 
        try:
1238
 
            self.assertRaises(errors.KnitCorrupt, index.keys)
1239
 
        except TypeError as e:
1240
 
            if (str(e) == ('exceptions must be strings, classes, or instances,'
1241
 
                           ' not exceptions.ValueError')):
1242
 
                self.knownFailure('Pyrex <0.9.5 fails with TypeError when'
1243
 
                                  ' raising new style exceptions with python'
1244
 
                                  ' >=2.5')
1245
 
            else:
1246
 
                raise
 
1219
        self.assertRaises(errors.KnitCorrupt, index.keys)
1247
1220
 
1248
1221
    def test_invalid_position(self):
1249
1222
        transport = MockTransport([
1251
1224
            "a option 1v 1 :",
1252
1225
            ])
1253
1226
        index = self.get_knit_index(transport, 'filename', 'r')
1254
 
        try:
1255
 
            self.assertRaises(errors.KnitCorrupt, index.keys)
1256
 
        except TypeError as e:
1257
 
            if (str(e) == ('exceptions must be strings, classes, or instances,'
1258
 
                           ' not exceptions.ValueError')):
1259
 
                self.knownFailure('Pyrex <0.9.5 fails with TypeError when'
1260
 
                                  ' raising new style exceptions with python'
1261
 
                                  ' >=2.5')
1262
 
            else:
1263
 
                raise
 
1227
        self.assertRaises(errors.KnitCorrupt, index.keys)
1264
1228
 
1265
1229
    def test_invalid_size(self):
1266
1230
        transport = MockTransport([
1268
1232
            "a option 1 1v :",
1269
1233
            ])
1270
1234
        index = self.get_knit_index(transport, 'filename', 'r')
1271
 
        try:
1272
 
            self.assertRaises(errors.KnitCorrupt, index.keys)
1273
 
        except TypeError as e:
1274
 
            if (str(e) == ('exceptions must be strings, classes, or instances,'
1275
 
                           ' not exceptions.ValueError')):
1276
 
                self.knownFailure('Pyrex <0.9.5 fails with TypeError when'
1277
 
                                  ' raising new style exceptions with python'
1278
 
                                  ' >=2.5')
1279
 
            else:
1280
 
                raise
 
1235
        self.assertRaises(errors.KnitCorrupt, index.keys)
1281
1236
 
1282
1237
    def test_scan_unvalidated_index_not_implemented(self):
1283
1238
        transport = MockTransport()