/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/test_http_response.py

  • Committer: Breezy landing bot
  • Author(s): Jelmer Vernooij
  • Date: 2020-02-14 03:16:54 UTC
  • mfrom: (7479.2.3 no-more-python2)
  • Revision ID: breezy.the.bot@gmail.com-20200214031654-bp1xtv2jr9nmhto3
Drop python2 support.

Merged from https://code.launchpad.net/~jelmer/brz/no-more-python2/+merge/378694

Show diffs side-by-side

added added

removed removed

Lines of Context:
37
37
  InvalidHttpResponse.
38
38
"""
39
39
 
40
 
try:
41
 
    import http.client as http_client
42
 
except ImportError:  # python < 3 without future
43
 
    import httplib as http_client
44
 
 
45
 
try:
46
 
    parse_headers = http_client.parse_headers
47
 
except AttributeError:  # python 2
48
 
    parse_headers = http_client.HTTPMessage
 
40
from io import BytesIO
 
41
 
 
42
import http.client as http_client
 
43
 
 
44
parse_headers = http_client.parse_headers
49
45
 
50
46
from .. import (
51
47
    errors,
52
48
    tests,
53
49
    )
54
 
from ..sixish import (
55
 
    BytesIO,
56
 
    PY3,
57
 
    )
58
50
from ..transport.http import (
59
51
    response,
60
52
    HTTPConnection,
726
718
        # Get rid of the status line
727
719
        status_and_headers.readline()
728
720
        msg = parse_headers(status_and_headers)
729
 
        if PY3:
730
 
            return msg.get
731
 
        else:
732
 
            return msg.getheader
 
721
        return msg.get
733
722
 
734
723
    def get_response(self, a_response):
735
724
        """Process a supplied response, and return the result."""