/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 bzrlib/tests/http_utils.py

  • Committer: Martin Pool
  • Date: 2008-04-24 07:22:53 UTC
  • mto: This revision was merged to the branch mainline in revision 3415.
  • Revision ID: mbp@sourcefrog.net-20080424072253-opmjij7xfy38w27f
Remove every assert statement from bzrlib!

Depending on the context they are:

 * turned into an explicit if/raise of either AssertionError 
   or something more specific -- particularly where they protect
   programming interfaces, complex invariants, or data file integrity
 * removed, if they're redundant with a later check, not protecting
   a meaningful invariant
 * turned into a selftest method on tests

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
import urllib2
26
26
import urlparse
27
27
 
28
 
 
29
28
from bzrlib import (
 
29
    errors,
30
30
    tests,
31
31
    transport,
32
32
    )
70
70
        # feeding the bytes in the http request to the smart_protocol_request,
71
71
        # but for now it's simpler to just feed the bytes directly.
72
72
        smart_protocol_request.accept_bytes(self.rfile.read(data_length))
73
 
        assert smart_protocol_request.next_read_size() == 0, (
74
 
            "not finished reading, but all data sent to protocol.")
 
73
        if not (smart_protocol_request.next_read_size() == 0):
 
74
            raise errors.SmartProtocolError(
 
75
                "not finished reading, but all data sent to protocol.")
75
76
        self.send_header("Content-Length", str(len(out_buffer.getvalue())))
76
77
        self.end_headers()
77
78
        self.wfile.write(out_buffer.getvalue())