~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Andrew Bennetts
  • Date: 2011-02-25 08:45:27 UTC
  • mto: This revision was merged to the branch mainline in revision 5695.
  • Revision ID: andrew.bennetts@canonical.com-20110225084527-0ucp7p00d00hoqon
Add another test.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006, 2007, 2009, 2010 Canonical Ltd
 
1
# Copyright (C) 2006, 2007, 2009, 2010, 2011 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
16
16
 
17
17
"""Tests for display of exceptions."""
18
18
 
19
 
from cStringIO import StringIO
20
 
import os
21
19
import sys
22
20
 
23
21
from bzrlib import (
27
25
    osutils,
28
26
    repository,
29
27
    tests,
30
 
    trace,
31
28
    )
32
29
 
33
 
from bzrlib.tests import TestCaseInTempDir, TestCase
34
 
from bzrlib.errors import NotBranchError
 
30
from bzrlib.tests import TestCase
35
31
 
36
32
 
37
33
class TestExceptionReporting(TestCase):
48
44
        self.assertContainsRe(err, r'Bazaar has encountered an internal error')
49
45
 
50
46
 
 
47
class TestOptParseBugHandling(TestCase):
 
48
    "Test that we handle http://bugs.python.org/issue2931"
 
49
 
 
50
    def test_nonascii_optparse(self):
 
51
        """Reasonable error raised when non-ascii in option name"""
 
52
        if sys.version_info < (2,5):
 
53
            error_re = 'no such option'
 
54
        else:
 
55
            error_re = 'Only ASCII permitted in option names'
 
56
        out = self.run_bzr_error([error_re], ['st',u'-\xe4'])
 
57
 
 
58
 
51
59
class TestDeprecationWarning(tests.TestCaseWithTransport):
52
60
    """The deprecation warning is controlled via a global variable:
53
61
    repository._deprecation_warning_done. As such, it can be emitted only once