Fix: Test failures in Python workflow matrix jobs 36/73636/1
authorModeSevenIndustrialSolutions <mwatkins@linuxfoundation.org>
Thu, 11 Sep 2025 14:54:20 +0000 (15:54 +0100)
committerModeSevenIndustrialSolutions <mwatkins@linuxfoundation.org>
Thu, 11 Sep 2025 14:54:20 +0000 (15:54 +0100)
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 <mwatkins@linuxfoundation.org>
tests/test_api_client.py
tests/test_rtd.py

index 33fd47e..518174a 100644 (file)
@@ -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"}
index 6ce2b6e..36e7b2b 100644 (file)
@@ -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")