/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/tests/https_server.py

  • Committer: Jelmer Vernooij
  • Date: 2018-01-14 05:14:06 UTC
  • mfrom: (6844 trunk)
  • mto: This revision was merged to the branch mainline in revision 6845.
  • Revision ID: jelmer@jelmer.uk-20180114051406-eimpackj3a23cgvp
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
import ssl
20
20
import sys
21
21
 
22
 
from bzrlib.tests import (
 
22
from . import (
23
23
    http_server,
24
24
    ssl_certs,
25
25
    test_server,
51
51
        if serving:
52
52
            try:
53
53
                request.do_handshake()
54
 
            except ssl.SSLError, e:
 
54
            except ssl.SSLError as e:
55
55
                # FIXME: We proabaly want more tests to capture which ssl
56
56
                # errors are worth reporting but mostly our tests want an https
57
57
                # server that works -- vila 2012-01-19
59
59
        return serving
60
60
 
61
61
    def ignored_exceptions_during_shutdown(self, e):
62
 
        if (sys.version < (2, 7) and isinstance(e, TypeError)
63
 
            and e.args[0] == "'member_descriptor' object is not callable"):
64
 
            # Fixed in python-2.7 (and some Ubuntu 2.6) there is a bug where
65
 
            # the ssl socket fail to raise a socket.error when trying to read
66
 
            # from a closed socket. This is rarely observed in practice but
67
 
            # still make valid selftest runs fail if not caught.
68
 
            return True
69
62
        base = test_server.TestingTCPServerMixin
70
63
        return base.ignored_exceptions_during_shutdown(self, e)
71
64
 
134
127
 
135
128
    # urls returned by this server should require the urllib client impl
136
129
    _url_protocol = 'https+urllib'
137
 
 
138
 
 
139
 
class HTTPSServer_PyCurl(HTTPSServer):
140
 
    """Subclass of HTTPSServer that gives http+pycurl urls.
141
 
 
142
 
    This is for use in testing: connections to this server will always go
143
 
    through pycurl where possible.
144
 
    """
145
 
 
146
 
    # We don't care about checking the pycurl availability as
147
 
    # this server will be required only when pycurl is present
148
 
 
149
 
    # urls returned by this server should require the pycurl client impl
150
 
    _url_protocol = 'https+pycurl'