You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Fix failing test test_issue_181_example in test_ResponseHandler.py #733
In mock_query, the loop breaks after 2 commands (one FindImage+UpdateImage pair), so only one image can be appended to changed_ids. The test currently asserts len(changed_ids) == 2, which doesn't match the mocked behavior and will fail; either adjust the mock to return responses for 2 pairs (e.g., break after 4 commands) or change the assertion to expect 1.
We need to fix this either by adjusting the mock to return 4 commands or by expecting a length of 1 in the assertion.
The test test_issue_181_example in test/test_ResponseHandler.py fails because its mocked Connector.query response limits output to only 2 commands (1 pair), while the test asserts that 2 images were processed. Since batchsize=2 means 4 commands are sent in the request, the mock returning only 2 commands simulates an aborted response, which causes len(changed_ids) to be 1 instead of 2.
Here are two possible implementation approaches:
Approach A: Adjust the assertion to expect 1 changed ID
Pros: Honors the explicit comment in mock_query (# simulate aborting after 2 commands (1 pair out of a batch)), effectively testing that ParallelQuery handles partial responses correctly without crashing.
Cons: Only processes a partial batch, which might not fully validate success across an entire batch of size 2.
Approach B: Adjust mock_query to break after 4 commands
Pros: Tests the successful processing of a full batch by allowing all 4 commands (2 pairs) to complete.
Cons: Overwrites the explicit comment and original intent of simulating an aborted response.
Recommendation:
I recommend Approach A. The presence of the comment at line 460 (# simulate aborting after 2 commands) strongly implies the test was written specifically to verify the system's resilience when a backend response aborts prematurely. Changing the assertion on line 490 to assert len(changed_ids) == 1 correctly aligns the test's expectations with this intended scenario.
Activity
ad-claw000 commentedon May 26, 2026
The test
test_issue_181_exampleintest/test_ResponseHandler.pyfails because its mockedConnector.queryresponse limits output to only 2 commands (1 pair), while the test asserts that 2 images were processed. Sincebatchsize=2means 4 commands are sent in the request, the mock returning only 2 commands simulates an aborted response, which causeslen(changed_ids)to be 1 instead of 2.Here are two possible implementation approaches:
Approach A: Adjust the assertion to expect 1 changed ID
mock_query(# simulate aborting after 2 commands (1 pair out of a batch)), effectively testing thatParallelQueryhandles partial responses correctly without crashing.Approach B: Adjust
mock_queryto break after 4 commandsRecommendation:
I recommend Approach A. The presence of the comment at line 460 (
# simulate aborting after 2 commands) strongly implies the test was written specifically to verify the system's resilience when a backend response aborts prematurely. Changing the assertion on line 490 toassert len(changed_ids) == 1correctly aligns the test's expectations with this intended scenario.