/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: 2018-11-16 23:19:12 UTC
  • mfrom: (7180 work)
  • mto: This revision was merged to the branch mainline in revision 7294.
  • Revision ID: jelmer@jelmer.uk-20181116231912-e043vpq22bdkxa6q
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
38
38
        # we must use a subprocess, because the normal in-memory mechanism
39
39
        # allows errors to propagate up through the test suite
40
40
        out, err = self.run_bzr_subprocess(['assert-fail'],
41
 
            universal_newlines=True,
42
 
            retcode=errors.EXIT_INTERNAL_ERROR)
 
41
                                           universal_newlines=True,
 
42
                                           retcode=errors.EXIT_INTERNAL_ERROR)
43
43
        self.assertEqual(4, errors.EXIT_INTERNAL_ERROR)
44
44
        self.assertContainsRe(err, br'\nAssertionError: always fails\n')
45
 
        self.assertContainsRe(err, br'Bazaar has encountered an internal error')
 
45
        self.assertContainsRe(
 
46
            err, br'Bazaar has encountered an internal error')
46
47
 
47
48
    def test_undecodable_argv(self):
48
49
        """A user error must be reported if argv is not in the locale encoding
53
54
        if os.name != "posix":
54
55
            raise tests.TestNotApplicable("Needs system beholden to C locales")
55
56
        if PY3:
56
 
            raise tests.TestNotApplicable("Unable to pass argv to subprocess as bytes")
 
57
            raise tests.TestNotApplicable(
 
58
                "Unable to pass argv to subprocess as bytes")
57
59
        out, err = self.run_bzr_subprocess([b"\xa0"],
58
 
            env_changes={"LANG": "C", "LC_ALL": "C"},
59
 
            universal_newlines=True,
60
 
            retcode=errors.EXIT_ERROR)
 
60
                                           env_changes={
 
61
                                               "LANG": "C", "LC_ALL": "C"},
 
62
                                           universal_newlines=True,
 
63
                                           retcode=errors.EXIT_ERROR)
61
64
        self.assertContainsRe(err, br"^brz: ERROR: .*'\\xa0'.* unsupported",
62
 
            flags=re.MULTILINE)
 
65
                              flags=re.MULTILINE)
63
66
        self.assertEqual(out, b"")
64
67
 
65
68
    def test_utf8_default_fs_enc(self):
67
70
        if os.name != "posix":
68
71
            raise tests.TestNotApplicable("Needs system beholden to C locales")
69
72
        out, err = self.run_bzr_subprocess(["init", "file:%C2%A7"],
70
 
            env_changes={"LANG": "C", "LC_ALL": "C"})
 
73
                                           env_changes={"LANG": "C", "LC_ALL": "C"})
71
74
        self.assertContainsRe(out, b"^Created a standalone tree .*$")
72
75
 
73
76
 
105
108
    def setUp(self):
106
109
        super(TestDeprecationWarning, self).setUp()
107
110
        self.addCleanup(repository.format_registry.remove,
108
 
            TestObsoleteRepoFormat)
 
111
                        TestObsoleteRepoFormat)
109
112
        repository.format_registry.register(TestObsoleteRepoFormat)
110
113
        self.addCleanup(controldir.format_registry.remove, "testobsolete")
111
114
        bzr.register_metadir(controldir.format_registry, "testobsolete",
112
 
            "breezy.tests.blackbox.test_exceptions.TestObsoleteRepoFormat",
113
 
            branch_format='breezy.bzr.branch.BzrBranchFormat7',
114
 
            tree_format='breezy.bzr.workingtree_4.WorkingTreeFormat6',
115
 
            deprecated=True,
116
 
            help='Same as 2a, but with an obsolete repo format.')
 
115
                             "breezy.tests.blackbox.test_exceptions.TestObsoleteRepoFormat",
 
116
                             branch_format='breezy.bzr.branch.BzrBranchFormat7',
 
117
                             tree_format='breezy.bzr.workingtree_4.WorkingTreeFormat6',
 
118
                             deprecated=True,
 
119
                             help='Same as 2a, but with an obsolete repo format.')
117
120
        self.disable_deprecation_warning()
118
121
 
119
122
    def enable_deprecation_warning(self, repo=None):