/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

Support user.signingkey configuration variable in .git/config.

Merged from https://code.launchpad.net/~jelmer/brz/local-git-key/+merge/381000

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
    tests,
29
29
    urlutils,
30
30
    )
 
31
from ..sixish import (
 
32
    PY3,
 
33
    text_type,
 
34
    )
31
35
 
32
36
 
33
37
class TestErrors(tests.TestCase):
45
49
            init = getattr(c, '__init__', None)
46
50
            fmt = getattr(c, '_fmt', None)
47
51
            if init:
48
 
                args = inspect.getfullargspec(init)[0]
 
52
                if PY3:
 
53
                    args = inspect.getfullargspec(init)[0]
 
54
                else:
 
55
                    args = inspect.getargspec(init)[0]
49
56
                self.assertFalse('message' in args,
50
57
                                 ('Argument name "message" not allowed for '
51
58
                                  '"errors.%s.__init__"' % c.__name__))
358
365
        e = errors.DuplicateRecordNameError(b"n\xc3\xa5me")
359
366
        self.assertEqual(
360
367
            u"Container has multiple records with the same name: n\xe5me",
361
 
            str(e))
 
368
            text_type(e))
362
369
 
363
370
    def test_check_error(self):
364
371
        e = errors.BzrCheckError('example check failure')
402
409
        err = errors.TipChangeRejected(u'Unicode message\N{INTERROBANG}')
403
410
        self.assertEqual(
404
411
            u'Tip change rejected: Unicode message\N{INTERROBANG}',
405
 
            str(err))
 
412
            text_type(err))
406
413
 
407
414
    def test_error_from_smart_server(self):
408
415
        error_tuple = ('error', 'tuple')
501
508
        # Unicode error, because it tries to call str() on the string
502
509
        # returned from e.__str__(), and it has non ascii characters
503
510
        s = str(e)
504
 
        self.assertEqual('Pass through \xb5 and bar', s)
 
511
        if PY3:
 
512
            self.assertEqual('Pass through \xb5 and bar', s)
 
513
        else:
 
514
            self.assertEqual('Pass through \xc2\xb5 and bar', s)
505
515
 
506
516
    def test_missing_format_string(self):
507
517
        e = ErrorWithNoFormat(param='randomvalue')