From: ModeSevenIndustrialSolutions Date: Thu, 11 Sep 2025 14:54:20 +0000 (+0100) Subject: Fix: Test failures in Python workflow matrix jobs X-Git-Tag: v0.37.14~1^2 X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=commitdiff_plain;h=594f52de1e6afba100aa74ecff3ce0f9edaf8693;p=releng%2Flftools.git Fix: Test failures in Python workflow matrix jobs Only Python 3.9 tests passed. Fixes these failures: FAILED tests/test_api_client.py::test_patch - requests.exceptions.ChunkedEncodingError: ('Connection broken: IncompleteRead(20 bytes read, -20 more expected)', IncompleteRead(20 bytes read, -20 more expected)) FAILED tests/test_rtd.py::test_project_version_update - requests.exceptions.ChunkedEncodingError: ('Connection broken: IncompleteRead(16 bytes read, -16 more expected)', IncompleteRead(16 bytes read, -16 more expected)) Both changes fixed the same issue: tests were incorrectly using HTTP 204 (No Content) status codes while trying to return JSON response bodies, which violates HTTP specifications and caused chunked encoding errors in newer versions of the HTTP libraries. Change-Id: If22a885ff8122ffba84e05f57543a9c0b3895e95 Signed-off-by: ModeSevenIndustrialSolutions --- diff --git a/tests/test_api_client.py b/tests/test_api_client.py index 33fd47ec..518174a7 100644 --- a/tests/test_api_client.py +++ b/tests/test_api_client.py @@ -27,7 +27,7 @@ def test_get(): @responses.activate def test_patch(): responses.add( - responses.PATCH, url="https://fakeurl/", json={"success": "patch"}, status=204, match_querystring=True + responses.PATCH, url="https://fakeurl/", json={"success": "patch"}, status=200, match_querystring=True ) resp = c.patch("https://fakeurl/") assert resp[1] == {"success": "patch"} diff --git a/tests/test_rtd.py b/tests/test_rtd.py index 6ce2b6ed..36e7b2b3 100644 --- a/tests/test_rtd.py +++ b/tests/test_rtd.py @@ -94,7 +94,7 @@ def test_project_version_update(): responses.PATCH, url="https://readthedocs.org/api/v3/projects/TestProject1/versions/latest/", # noqa json=data, - status=204, + status=200, ) assert rtd.project_version_update("TestProject1", "latest", "True")