~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_errors.py

  • Committer: Martin Pool
  • Date: 2009-08-26 05:38:16 UTC
  • mfrom: (4634.6.2 2.0)
  • mto: (4634.6.4 2.0)
  • mto: This revision was merged to the branch mainline in revision 4660.
  • Revision ID: mbp@sourcefrog.net-20090826053816-ht6jpktdm77vi6t5
MergeĀ 2.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006, 2007, 2008 Canonical Ltd
2
 
#   Authors: Robert Collins <robert.collins@canonical.com>
3
 
#            and others
 
1
# Copyright (C) 2006, 2007, 2008, 2009 Canonical Ltd
4
2
#
5
3
# This program is free software; you can redistribute it and/or modify
6
4
# it under the terms of the GNU General Public License as published by
18
16
 
19
17
"""Tests for the formatting and construction of errors."""
20
18
 
 
19
import socket
21
20
import sys
 
21
 
22
22
from bzrlib import (
23
23
    bzrdir,
24
24
    errors,
669
669
        e = ErrorWithBadFormat(not_thing='x')
670
670
        self.assertStartsWith(
671
671
            str(e), 'Unprintable exception ErrorWithBadFormat')
 
672
 
 
673
    def test_cannot_bind_address(self):
 
674
        # see <https://bugs.edge.launchpad.net/bzr/+bug/286871>
 
675
        e = errors.CannotBindAddress('example.com', 22,
 
676
            socket.error(13, 'Permission denied'))
 
677
        self.assertContainsRe(str(e),
 
678
            r'Cannot bind address "example\.com:22":.*Permission denied')