'The server should not block when there are upload errors (bug #8622).
This can happen if something -- i.e. an exception handler -- tries to
access POST while handling an error in parsing POST. This shouldn\'t
cause an infinite loop!'

def test_file_error_blocking(self):

    class POSTAccessingHandler(client.ClientHandler, ):
        "A    handler    that'll    access    POST    during    an    exception."
        def handle_uncaught_exception(self, request, resolver, exc_info):
            ret = super(POSTAccessingHandler, self).handle_uncaught_exception(request, resolver, exc_info)
            p = request.POST
            return ret
    post_data = {'name': 'Ringo', 'file_field': open(__file__)}
    try:
        client.FakePayload('a').read(2)
    except Exception as reference_error:
        pass
    self.client.handler = POSTAccessingHandler()
    try:
        response = self.client.post('/file_uploads/upload_errors/', post_data)
    except reference_error.__class__ as err:
        self.failIf((str(err) == str(reference_error)), "Caught    a    repeated    exception    that'll    cause    an    infinite    loop    in    file    uploads.")
    except Exception as err:
        self.assertEqual(err.__class__, uploadhandler.CustomUploadError)
