~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Jelmer Vernooij
  • Date: 2011-05-10 07:46:15 UTC
  • mfrom: (5844 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5845.
  • Revision ID: jelmer@samba.org-20110510074615-eptod049ndjxc4i7
Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
"""Tests for display of exceptions."""
18
18
 
 
19
import os
19
20
import sys
20
21
 
21
22
from bzrlib import (
45
46
                r'exceptions\.AssertionError: always fails\n')
46
47
        self.assertContainsRe(err, r'Bazaar has encountered an internal error')
47
48
 
 
49
    def test_undecodable_argv(self):
 
50
        """A user error must be reported if argv is not in the locale encoding
 
51
 
 
52
        A subprocess with an environment ascii-only setting is used so the test
 
53
        can run without worrying about the locale the test suite is using.
 
54
        """
 
55
        if os.name != "posix":
 
56
            raise tests.TestNotApplicable("Needs system beholden to C locales")
 
57
        out, err = self.run_bzr_subprocess(["\xa0"],
 
58
            env_changes={"LANG": "C", "LC_ALL": "C"},
 
59
            universal_newlines=True,
 
60
            retcode=errors.EXIT_ERROR)
 
61
        self.assertContainsRe(err, r"^bzr: ERROR: .*'\\xa0'.* unsupported")
 
62
        self.assertEquals(out, "")
 
63
 
48
64
 
49
65
class TestOptParseBugHandling(TestCase):
50
66
    "Test that we handle http://bugs.python.org/issue2931"
86
102
        bzrdir.register_metadir(controldir.format_registry, "testobsolete",
87
103
            "bzrlib.tests.blackbox.test_exceptions.TestObsoleteRepoFormat",
88
104
            branch_format='bzrlib.branch.BzrBranchFormat7',
89
 
            tree_format='bzrlib.workingtree.WorkingTreeFormat6',
 
105
            tree_format='bzrlib.workingtree_4.WorkingTreeFormat6',
90
106
            deprecated=True,
91
107
            help='Same as 2a, but with an obsolete repo format.')
92
108
        self.disable_deprecation_warning()