~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2011-04-18 03:15:03 UTC
  • mfrom: (5785.1.6 undecodable_argv_745712)
  • Revision ID: pqm@pqm.ubuntu.com-20110418031503-x95t7v5ujr0lh9yw
(mbp) better message when argv can't be decoded in the application locale
 (Martin [gz])

Show diffs side-by-side

added added

removed removed

Lines of Context:
335
335
        tree.add('foo.c')
336
336
        self.run_bzr('commit -m ""', retcode=3)
337
337
 
338
 
    def test_unsupported_encoding_commit_message(self):
339
 
        if sys.platform == 'win32':
340
 
            raise tests.TestNotApplicable('Win32 parses arguments directly'
341
 
                ' as Unicode, so we can\'t pass invalid non-ascii')
342
 
        tree = self.make_branch_and_tree('.')
343
 
        self.build_tree_contents([('foo.c', 'int main() {}')])
344
 
        tree.add('foo.c')
345
 
        # LANG env variable has no effect on Windows
346
 
        # but some characters anyway cannot be represented
347
 
        # in default user encoding
348
 
        char = probe_bad_non_ascii(osutils.get_user_encoding())
349
 
        if char is None:
350
 
            raise TestSkipped('Cannot find suitable non-ascii character'
351
 
                'for user_encoding (%s)' % osutils.get_user_encoding())
352
 
        out,err = self.run_bzr_subprocess('commit -m "%s"' % char,
353
 
                                          retcode=1,
354
 
                                          env_changes={'LANG': 'C'})
355
 
        self.assertContainsRe(err, r'bzrlib.errors.BzrError: Parameter.*is '
356
 
                                    'unsupported by the current encoding.')
357
 
 
358
338
    def test_other_branch_commit(self):
359
339
        # this branch is to ensure consistent behaviour, whether we're run
360
340
        # inside a branch, or not.