~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/https_server.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2010-09-01 08:02:42 UTC
  • mfrom: (5390.3.3 faster-revert-593560)
  • Revision ID: pqm@pqm.ubuntu.com-20100901080242-esg62ody4frwmy66
(spiv) Avoid repeatedly calling self.target.all_file_ids() in
 InterTree.iter_changes. (Andrew Bennetts)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2007-2011 Canonical Ltd
 
1
# Copyright (C) 2007-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
17
17
"""HTTPS test server, available when ssl python module is available"""
18
18
 
19
19
import ssl
20
 
import sys
21
20
 
22
21
from bzrlib.tests import (
23
22
    http_server,
49
48
        serving = test_server.TestingTCPServerMixin.verify_request(
50
49
            self, request, client_address)
51
50
        if serving:
52
 
            try:
53
 
                request.do_handshake()
54
 
            except ssl.SSLError, e:
55
 
                # FIXME: We proabaly want more tests to capture which ssl
56
 
                # errors are worth reporting but mostly our tests want an https
57
 
                # server that works -- vila 2012-01-19
58
 
                return False
 
51
            request.do_handshake()
59
52
        return serving
60
53
 
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
 
        base = test_server.TestingTCPServerMixin
70
 
        return base.ignored_exceptions_during_shutdown(self, e)
71
 
 
72
54
 
73
55
class TestingHTTPSServer(TestingHTTPSServerMixin,
74
56
                         http_server.TestingHTTPServer):