~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

Abbreviate pack_stat struct format to '>6L'

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