/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: Breezy landing bot
  • Author(s): Colin Watson
  • Date: 2020-11-16 21:47:08 UTC
  • mfrom: (7521.1.1 remove-lp-workaround)
  • Revision ID: breezy.the.bot@gmail.com-20201116214708-jos209mgxi41oy15
Remove breezy.git workaround for bazaar.launchpad.net.

Merged from https://code.launchpad.net/~cjwatson/brz/remove-lp-workaround/+merge/393710

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
"""HTTPS test server, available when ssl python module is available"""
18
18
 
19
19
import ssl
20
 
import sys
21
20
 
22
 
from bzrlib.tests import (
 
21
from . import (
23
22
    http_server,
24
23
    ssl_certs,
25
24
    test_server,
32
31
        self.key_file = key_file
33
32
        self.cert_file = cert_file
34
33
 
35
 
    def _get_ssl_request (self, sock, addr):
 
34
    def _get_ssl_request(self, sock, addr):
36
35
        """Wrap the socket with SSL"""
37
36
        ssl_sock = ssl.wrap_socket(sock, server_side=True,
38
37
                                   keyfile=self.key_file,
51
50
        if serving:
52
51
            try:
53
52
                request.do_handshake()
54
 
            except ssl.SSLError, e:
 
53
            except ssl.SSLError:
55
54
                # FIXME: We proabaly want more tests to capture which ssl
56
55
                # errors are worth reporting but mostly our tests want an https
57
56
                # server that works -- vila 2012-01-19
59
58
        return serving
60
59
 
61
60
    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
61
        base = test_server.TestingTCPServerMixin
70
62
        return base.ignored_exceptions_during_shutdown(self, e)
71
63
 
134
126
 
135
127
    # urls returned by this server should require the urllib client impl
136
128
    _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'