~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: INADA Naoki
  • Date: 2011-05-05 09:15:34 UTC
  • mto: (5830.3.3 i18n-msgfmt)
  • mto: This revision was merged to the branch mainline in revision 5873.
  • Revision ID: songofacandy@gmail.com-20110505091534-7sv835xpofwrmpt4
Add update-pot command to Makefile and tools/bzrgettext script that
extracts help text from bzr commands.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
"""Tests for display of exceptions."""
18
18
 
19
19
import os
20
 
import re
 
20
import sys
21
21
 
22
22
from bzrlib import (
23
23
    bzrdir,
30
30
    )
31
31
from bzrlib.repofmt.groupcompress_repo import RepositoryFormat2a
32
32
 
33
 
 
34
 
class TestExceptionReporting(tests.TestCaseInTempDir):
 
33
from bzrlib.tests import TestCase
 
34
 
 
35
 
 
36
class TestExceptionReporting(TestCase):
35
37
 
36
38
    def test_exception_exitcode(self):
37
39
        # we must use a subprocess, because the normal in-memory mechanism
56
58
            env_changes={"LANG": "C", "LC_ALL": "C"},
57
59
            universal_newlines=True,
58
60
            retcode=errors.EXIT_ERROR)
59
 
        self.assertContainsRe(err, r"^bzr: ERROR: .*'\\xa0'.* unsupported",
60
 
            flags=re.MULTILINE)
 
61
        self.assertContainsRe(err, r"^bzr: ERROR: .*'\\xa0'.* unsupported")
61
62
        self.assertEquals(out, "")
62
63
 
63
64
 
64
 
class TestOptParseBugHandling(tests.TestCase):
 
65
class TestOptParseBugHandling(TestCase):
65
66
    "Test that we handle http://bugs.python.org/issue2931"
66
67
 
67
68
    def test_nonascii_optparse(self):
68
69
        """Reasonable error raised when non-ascii in option name"""
69
 
        error_re = 'Only ASCII permitted in option names'
 
70
        if sys.version_info < (2,5):
 
71
            error_re = 'no such option'
 
72
        else:
 
73
            error_re = 'Only ASCII permitted in option names'
70
74
        out = self.run_bzr_error([error_re], ['st',u'-\xe4'])
71
75
 
72
76
 
122
126
            check = self.assertContainsRe
123
127
        else:
124
128
            check = self.assertNotContainsRe
125
 
        check(self.get_log(), 'WARNING.*bzr upgrade')
 
129
        check(self._get_log(keep_log_file=True), 'WARNING.*bzr upgrade')
126
130
 
127
131
    def test_repository_deprecation_warning(self):
128
132
        """Old formats give a warning"""