/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: 2017-07-23 22:06:41 UTC
  • mfrom: (6738 trunk)
  • mto: This revision was merged to the branch mainline in revision 6739.
  • Revision ID: jelmer@jelmer.uk-20170723220641-69eczax9bmv8d6kk
Merge trunk, address review comments.

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
20
21
 
21
22
from . import (
22
23
    http_server,
31
32
        self.key_file = key_file
32
33
        self.cert_file = cert_file
33
34
 
34
 
    def _get_ssl_request(self, sock, addr):
 
35
    def _get_ssl_request (self, sock, addr):
35
36
        """Wrap the socket with SSL"""
36
37
        ssl_sock = ssl.wrap_socket(sock, server_side=True,
37
38
                                   keyfile=self.key_file,
50
51
        if serving:
51
52
            try:
52
53
                request.do_handshake()
53
 
            except ssl.SSLError:
 
54
            except ssl.SSLError as e:
54
55
                # FIXME: We proabaly want more tests to capture which ssl
55
56
                # errors are worth reporting but mostly our tests want an https
56
57
                # server that works -- vila 2012-01-19
58
59
        return serving
59
60
 
60
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
61
69
        base = test_server.TestingTCPServerMixin
62
70
        return base.ignored_exceptions_during_shutdown(self, e)
63
71