/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 breezy/tests/test_errors.py

  • Committer: Jelmer Vernooij
  • Date: 2017-07-30 23:53:38 UTC
  • mfrom: (6734.1.22 move-errors-more)
  • Revision ID: jelmer@jelmer.uk-20170730235338-25jy0lgifkyx796l
Merge lp:~jelmer/brz/move-errors-more.

Show diffs side-by-side

added added

removed removed

Lines of Context:
63
63
            "^Filename b?'bad/filen\\\\xe5me' is not valid in your current"
64
64
            " filesystem encoding UTF-8$")
65
65
 
66
 
    def test_corrupt_dirstate(self):
67
 
        error = errors.CorruptDirstate('path/to/dirstate', 'the reason why')
68
 
        self.assertEqualDiff(
69
 
            "Inconsistency in dirstate file path/to/dirstate.\n"
70
 
            "Error: the reason why",
71
 
            str(error))
72
 
 
73
 
    def test_dirstate_corrupt(self):
74
 
        error = errors.DirstateCorrupt('.bzr/checkout/dirstate',
75
 
                                       'trailing garbage: "x"')
76
 
        self.assertEqualDiff("The dirstate file (.bzr/checkout/dirstate)"
77
 
            " appears to be corrupt: trailing garbage: \"x\"",
78
 
            str(error))
79
 
 
80
66
    def test_duplicate_file_id(self):
81
67
        error = errors.DuplicateFileId('a_file_id', 'foo')
82
68
        self.assertEqualDiff('File id {a_file_id} already exists in inventory'
239
225
            "('key',) which is encoded as 'fulltext'.",
240
226
            str(error))
241
227
 
242
 
    def test_unknown_hook(self):
243
 
        error = errors.UnknownHook("branch", "foo")
244
 
        self.assertEqualDiff("The branch hook 'foo' is unknown in this version"
245
 
            " of breezy.",
246
 
            str(error))
247
 
        error = errors.UnknownHook("tree", "bar")
248
 
        self.assertEqualDiff("The tree hook 'bar' is unknown in this version"
249
 
            " of breezy.",
250
 
            str(error))
251
 
 
252
 
    def test_unstackable_branch_format(self):
253
 
        format = u'foo'
254
 
        url = "/foo"
255
 
        error = errors.UnstackableBranchFormat(format, url)
256
 
        self.assertEqualDiff(
257
 
            "The branch '/foo'(foo) is not a stackable format. "
258
 
            "You will need to upgrade the branch to permit branch stacking.",
259
 
            str(error))
260
 
 
261
228
    def test_unstackable_location(self):
262
229
        error = errors.UnstackableLocationError('foo', 'bar')
263
230
        self.assertEqualDiff("The branch 'foo' cannot be stacked on 'bar'.",
284
251
        error = errors.ReadError(path)
285
252
        self.assertContainsRe(str(error), "^Error reading from u?'a path'.$")
286
253
 
287
 
    def test_bad_index_format_signature(self):
288
 
        error = errors.BadIndexFormatSignature("foo", "bar")
289
 
        self.assertEqual("foo is not an index of type bar.",
290
 
            str(error))
291
 
 
292
 
    def test_bad_index_data(self):
293
 
        error = errors.BadIndexData("foo")
294
 
        self.assertEqual("Error in data for index foo.",
295
 
            str(error))
296
 
 
297
 
    def test_bad_index_duplicate_key(self):
298
 
        error = errors.BadIndexDuplicateKey("foo", "bar")
299
 
        self.assertEqual("The key 'foo' is already in index 'bar'.",
300
 
            str(error))
301
 
 
302
 
    def test_bad_index_key(self):
303
 
        error = errors.BadIndexKey("foo")
304
 
        self.assertEqual("The key 'foo' is not a valid key.",
305
 
            str(error))
306
 
 
307
 
    def test_bad_index_options(self):
308
 
        error = errors.BadIndexOptions("foo")
309
 
        self.assertEqual("Could not parse options for index foo.",
310
 
            str(error))
311
 
 
312
 
    def test_bad_index_value(self):
313
 
        error = errors.BadIndexValue("foo")
314
 
        self.assertEqual("The value 'foo' is not a valid value.",
315
 
            str(error))
316
 
 
317
254
    def test_bzrerror_from_literal_string(self):
318
255
        # Some code constructs BzrError from a literal string, in which case
319
256
        # no further formatting is done.  (I'm not sure raising the base class
501
438
        err = errors.UnknownFormatError('bar', kind='foo')
502
439
        self.assertEqual("Unknown foo format: 'bar'", str(err))
503
440
 
504
 
    def test_unknown_rules(self):
505
 
        err = errors.UnknownRules(['foo', 'bar'])
506
 
        self.assertEqual("Unknown rules detected: foo, bar.", str(err))
507
 
 
508
441
    def test_tip_change_rejected(self):
509
442
        err = errors.TipChangeRejected(u'Unicode message\N{INTERROBANG}')
510
443
        self.assertEqual(
538
471
        finally:
539
472
            del err
540
473
 
541
 
    def test_must_have_working_tree(self):
542
 
        err = errors.MustHaveWorkingTree('foo', 'bar')
543
 
        self.assertEqual(str(err), "Branching 'bar'(foo) must create a"
544
 
                                   " working tree.")
545
 
 
546
474
    def test_unresumable_write_group(self):
547
475
        repo = "dummy repo"
548
476
        wg_tokens = ['token']