[New-bugs-announce] [issue18799] Resurrect and fix test_404 in Lib/test/test_xmlrpc.py

Vajrasky Kok report at bugs.python.org
Wed Aug 21 17:57:23 CEST 2013


New submission from Vajrasky Kok:

There is a dormant test in Lib/test/test_xmlrpc.py (line 579):

    # [ch] The test 404 is causing lots of false alarms.
    def XXXtest_404(self):
        # send POST with http.client, it should return 404 header and
        # 'Not Found' message.
        conn = httplib.client.HTTPConnection(ADDR, PORT)
        conn.request('POST', '/this-is-not-valid')
        response = conn.getresponse()
        conn.close()

        self.assertEqual(response.status, 404)
        self.assertEqual(response.reason, 'Not Found')

I decided to test it by removing 'XXX' and adding 'import httplib'. Yes, it hung up.

But then I looked at its sibling:

    def test_partial_post(self):
        # Check that a partial POST doesn't make the server loop: issue #14001.
        conn = http.client.HTTPConnection(ADDR, PORT)
        conn.request('POST', '/RPC2 HTTP/1.0\r\nContent-Length: 100\r\n\r\nbye')
        conn.close()

I tried to use http module instead of httplib. It works. I tested it on Linux and Windows Vista. It works on both platforms.

Attached the patch to fix the resurrect and fix the test_404.

----------
components: Tests
files: fix_test_404.patch
keywords: patch
messages: 195800
nosy: vajrasky
priority: normal
severity: normal
status: open
title: Resurrect and fix test_404 in Lib/test/test_xmlrpc.py
versions: Python 3.4
Added file: http://bugs.python.org/file31401/fix_test_404.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue18799>
_______________________________________


More information about the New-bugs-announce mailing list