~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Martin Pool
  • Date: 2007-10-10 00:21:57 UTC
  • mfrom: (2900 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2901.
  • Revision ID: mbp@sourcefrog.net-20071010002157-utci0x44m2w47wgd
merge news

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
"""Tests for the commit CLI of bzr."""
19
19
 
20
20
import os
 
21
import sys
21
22
 
 
23
import bzrlib
22
24
from bzrlib import (
23
25
    osutils,
24
26
    ignores,
 
27
    osutils,
25
28
    )
26
29
from bzrlib.bzrdir import BzrDir
 
30
from bzrlib.tests import (
 
31
    probe_bad_non_ascii,
 
32
    TestSkipped,
 
33
    )
27
34
from bzrlib.tests.blackbox import ExternalBase
28
35
 
29
36
 
238
245
        tree = self.make_branch_and_tree('.')
239
246
        self.build_tree_contents([('foo.c', 'int main() {}')])
240
247
        tree.add('foo.c')
241
 
        out,err = self.run_bzr_subprocess('commit -m "\xff"', retcode=1,
242
 
                                                    env_changes={'LANG': 'C'})
 
248
        # LANG env variable has no effect on Windows
 
249
        # but some characters anyway cannot be represented
 
250
        # in default user encoding
 
251
        char = probe_bad_non_ascii(bzrlib.user_encoding)
 
252
        if char is None:
 
253
            raise TestSkipped('Cannot find suitable non-ascii character'
 
254
                'for user_encoding (%s)' % bzrlib.user_encoding)
 
255
        out,err = self.run_bzr_subprocess('commit -m "%s"' % char,
 
256
                                          retcode=1,
 
257
                                          env_changes={'LANG': 'C'})
243
258
        self.assertContainsRe(err, r'bzrlib.errors.BzrError: Parameter.*is '
244
259
                                    'unsupported by the current encoding.')
245
260