/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/blackbox/test_exceptions.py

  • Committer: Jelmer Vernooij
  • Date: 2020-02-07 02:14:30 UTC
  • mto: This revision was merged to the branch mainline in revision 7492.
  • Revision ID: jelmer@jelmer.uk-20200207021430-m49iq3x4x8xlib6x
Drop python2 support.

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
    repository,
29
29
    tests,
30
30
    )
31
 
from breezy.sixish import PY3
32
31
from breezy.bzr.groupcompress_repo import RepositoryFormat2a
33
32
 
34
33
 
45
44
        self.assertContainsRe(
46
45
            err, br'Bazaar has encountered an internal error')
47
46
 
48
 
    def test_undecodable_argv(self):
49
 
        """A user error must be reported if argv is not in the locale encoding
50
 
 
51
 
        A subprocess with an environment ascii-only setting is used so the test
52
 
        can run without worrying about the locale the test suite is using.
53
 
        """
54
 
        if os.name != "posix":
55
 
            raise tests.TestNotApplicable("Needs system beholden to C locales")
56
 
        if PY3:
57
 
            raise tests.TestNotApplicable(
58
 
                "Unable to pass argv to subprocess as bytes")
59
 
        out, err = self.run_bzr_subprocess([b"\xa0"],
60
 
                                           env_changes={
61
 
                                               "LANG": "C", "LC_ALL": "C"},
62
 
                                           universal_newlines=True,
63
 
                                           retcode=errors.EXIT_ERROR)
64
 
        self.assertContainsRe(err, br"^brz: ERROR: .*'\\xa0'.* unsupported",
65
 
                              flags=re.MULTILINE)
66
 
        self.assertEqual(out, b"")
67
 
 
68
47
    def test_utf8_default_fs_enc(self):
69
48
        """In the C locale brz treats a posix filesystem as UTF-8 encoded"""
70
49
        if os.name != "posix":
79
58
 
80
59
    def test_nonascii_optparse(self):
81
60
        """Reasonable error raised when non-ascii in option name on Python 2"""
82
 
        if PY3:
83
 
            error_re = u'no such option: -\xe4'
84
 
        else:
85
 
            error_re = 'Only ASCII permitted in option names'
 
61
        error_re = u'no such option: -\xe4'
86
62
        out = self.run_bzr_error([error_re], ['st', u'-\xe4'])
87
63
 
88
64