/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-07-05 12:50:01 UTC
  • mfrom: (7490.40.46 work)
  • mto: (7490.40.48 work)
  • mto: This revision was merged to the branch mainline in revision 7519.
  • Revision ID: jelmer@jelmer.uk-20200705125001-7s3vo0p55szbbws7
Merge lp:brz/3.1.

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
31
32
from breezy.bzr.groupcompress_repo import RepositoryFormat2a
32
33
 
33
34
 
44
45
        self.assertContainsRe(
45
46
            err, br'Bazaar has encountered an internal error')
46
47
 
 
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
 
47
68
    def test_utf8_default_fs_enc(self):
48
69
        """In the C locale brz treats a posix filesystem as UTF-8 encoded"""
49
70
        if os.name != "posix":
58
79
 
59
80
    def test_nonascii_optparse(self):
60
81
        """Reasonable error raised when non-ascii in option name on Python 2"""
61
 
        error_re = u'no such option: -\xe4'
 
82
        if PY3:
 
83
            error_re = u'no such option: -\xe4'
 
84
        else:
 
85
            error_re = 'Only ASCII permitted in option names'
62
86
        out = self.run_bzr_error([error_re], ['st', u'-\xe4'])
63
87
 
64
88