~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Vincent Ladeuil
  • Date: 2010-10-08 10:50:51 UTC
  • mfrom: (5050.17.31 2.2.2-dev)
  • mto: This revision was merged to the branch mainline in revision 5474.
  • Revision ID: v.ladeuil+lp@free.fr-20101008105051-xd4knkrohzclffic
Merge 2.2 into trunk including fixes for bug #651706 and bug #646133

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006, 2007, 2009, 2010, 2011 Canonical Ltd
 
1
# Copyright (C) 2006, 2007, 2009, 2010 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
19
21
import sys
20
22
 
21
23
from bzrlib import (
25
27
    osutils,
26
28
    repository,
27
29
    tests,
 
30
    trace,
28
31
    )
29
32
 
30
 
from bzrlib.tests import TestCase
 
33
from bzrlib.tests import TestCaseInTempDir, TestCase
 
34
from bzrlib.errors import NotBranchError
31
35
 
32
36
 
33
37
class TestExceptionReporting(TestCase):
44
48
        self.assertContainsRe(err, r'Bazaar has encountered an internal error')
45
49
 
46
50
 
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
 
 
59
51
class TestDeprecationWarning(tests.TestCaseWithTransport):
60
52
    """The deprecation warning is controlled via a global variable:
61
53
    repository._deprecation_warning_done. As such, it can be emitted only once