~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_exceptions.py

  • Committer: Tarmac
  • Author(s): Vincent Ladeuil
  • Date: 2017-01-30 14:42:05 UTC
  • mfrom: (6620.1.1 trunk)
  • Revision ID: tarmac-20170130144205-r8fh2xpmiuxyozpv
Merge  2.7 into trunk including fix for bug #1657238 [r=vila]

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006, 2007, 2009, 2010, 2011 Canonical Ltd
 
1
# Copyright (C) 2006, 2007, 2009-2012, 2016 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
58
58
            retcode=errors.EXIT_ERROR)
59
59
        self.assertContainsRe(err, r"^bzr: ERROR: .*'\\xa0'.* unsupported",
60
60
            flags=re.MULTILINE)
61
 
        self.assertEquals(out, "")
 
61
        self.assertEqual(out, "")
 
62
 
 
63
    def test_utf8_default_fs_enc(self):
 
64
        """In the C locale bzr treats a posix filesystem as UTF-8 encoded"""
 
65
        if os.name != "posix":
 
66
            raise tests.TestNotApplicable("Needs system beholden to C locales")
 
67
        out, err = self.run_bzr_subprocess(["init", "file:%C2%A7"],
 
68
            env_changes={"LANG": "C", "LC_ALL": "C"})
 
69
        self.assertContainsRe(out, "^Created a standalone tree .*$")
62
70
 
63
71
 
64
72
class TestOptParseBugHandling(tests.TestCase):
133
141
 
134
142
    def test_repository_deprecation_warning_suppressed_global(self):
135
143
        """Old formats give a warning"""
136
 
        conf = config.GlobalConfig()
137
 
        conf.set_user_option('suppress_warnings', 'format_deprecation')
 
144
        conf = config.GlobalStack()
 
145
        conf.set('suppress_warnings', 'format_deprecation')
138
146
        self.make_obsolete_repo('foo')
139
147
        self.enable_deprecation_warning()
140
148
        out, err = self.run_bzr('status', working_dir='foo')
143
151
    def test_repository_deprecation_warning_suppressed_locations(self):
144
152
        """Old formats give a warning"""
145
153
        self.make_obsolete_repo('foo')
146
 
        conf = config.LocationConfig(osutils.pathjoin(self.test_dir, 'foo'))
147
 
        conf.set_user_option('suppress_warnings', 'format_deprecation')
 
154
        conf = config.LocationStack(osutils.pathjoin(self.test_dir, 'foo'))
 
155
        conf.set('suppress_warnings', 'format_deprecation')
148
156
        self.enable_deprecation_warning()
149
157
        out, err = self.run_bzr('status', working_dir='foo')
150
158
        self.check_warning(False)
152
160
    def test_repository_deprecation_warning_suppressed_branch(self):
153
161
        """Old formats give a warning"""
154
162
        tree = self.make_obsolete_repo('foo')
155
 
        conf = tree.branch.get_config()
156
 
        conf.set_user_option('suppress_warnings', 'format_deprecation')
 
163
        conf = tree.branch.get_config_stack()
 
164
        conf.set('suppress_warnings', 'format_deprecation')
157
165
        self.enable_deprecation_warning()
158
166
        out, err = self.run_bzr('status', working_dir='foo')
159
167
        self.check_warning(False)