classification
Title: Resurrect and fix test_404 in Lib/test/test_xmlrpc.py
Type: behavior Stage: resolved
Components: Tests Versions: Python 3.8, Python 3.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: christian.heimes, ezio.melotti, miss-islington, r.david.murray, serhiy.storchaka, vajrasky
Priority: normal Keywords: patch

Created on 2013-08-21 15:57 by vajrasky, last changed 2018-12-19 09:48 by serhiy.storchaka. This issue is now closed.

Files
File name Uploaded Description Edit
fix_test_404.patch vajrasky, 2013-08-21 15:57 review
Pull Requests
URL Status Linked Edit
PR 11196 merged vajrasky, 2018-12-17 13:41
PR 11233 merged miss-islington, 2018-12-19 09:28
Messages (8)
msg195800 - (view) Author: Vajrasky Kok (vajrasky) * Date: 2013-08-21 15:57
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.
msg195807 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2013-08-21 17:04
"A lot of false alarms" means usually it works, but then sometimes it doesn't.  So just testing it on a couple of platforms isn't sufficient, unfortunately.
msg195863 - (view) Author: Vajrasky Kok (vajrasky) * Date: 2013-08-22 07:08
Yes, I agree with you, R. David Murray.

But there are some reasons why I try to resurrect this dormant test:

1. This test was disabled on 19 January 2008.
http://hg.python.org/cpython/rev/859bf85a556a

It has been more than 5 years. Many things happened.

2. In the last commit about this test, they used httplib not http library to access the server. If you see this commit:
http://hg.python.org/cpython/rev/5756b295b6fb

, the intuition (at least my intuition) suggests that the similar way can be applied to the dormant test. This commit is in 2012.

3. The http server in the test_xmlrpc.py differs than the http server 5 years ago.

But again, you are maybe right.

So let's hear from the person who disabled this test. Christian Heimes, what do you say about this ticket?
msg196021 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2013-08-23 20:12
We can always try to apply the patch and see what happens -- if the test starts failing again we can revert it.
msg331665 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2018-12-11 23:23
Vajrasky, do you mind to create a pull request on GitHub for your patch?
msg331915 - (view) Author: Vajrasky Kok (vajrasky) * Date: 2018-12-16 04:36
Serhiy, okay, I'll create a pull request soon (in 2-3 days).
msg332004 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2018-12-17 14:18
Thank you Vajrasky. The restored test is passed locally and on CI. Let try it on buildbots.
msg332116 - (view) Author: miss-islington (miss-islington) Date: 2018-12-19 09:46
New changeset 9e1c7ed9aaa4dea413f1b3ed92bb79cccb2f50eb by Miss Islington (bot) in branch '3.7':
bpo-18799: Resurrect test_404 in test_xmlrpc. (GH-11196)
https://github.com/python/cpython/commit/9e1c7ed9aaa4dea413f1b3ed92bb79cccb2f50eb
History
Date User Action Args
2018-12-19 09:48:51serhiy.storchakasetstatus: open -> closed
stage: patch review -> resolved
resolution: fixed
versions: + Python 3.7
2018-12-19 09:46:27miss-islingtonsetnosy: + miss-islington
messages: + msg332116
2018-12-19 09:28:37miss-islingtonsetpull_requests: + pull_request10467
2018-12-17 14:18:42serhiy.storchakasetmessages: + msg332004
versions: + Python 3.8, - Python 3.3, Python 3.4
2018-12-17 13:41:17vajraskysetpull_requests: + pull_request10435
2018-12-16 04:36:54vajraskysetmessages: + msg331915
2018-12-11 23:23:08serhiy.storchakasetnosy: + serhiy.storchaka
messages: + msg331665
2013-08-23 20:12:53ezio.melottisetversions: + Python 3.3
nosy: + ezio.melotti

messages: + msg196021

type: behavior
stage: patch review
2013-08-22 07:08:45vajraskysetnosy: + christian.heimes
messages: + msg195863
2013-08-21 17:04:37r.david.murraysetnosy: + r.david.murray
messages: + msg195807
2013-08-21 15:57:23vajraskycreate