Skip to content

[BUG][tests/test_groupchat.py][Not a valid pytest suite — all 5 tests error on a missing report fixture, leaving GroupChat untested] #2059

Description

@kyegomez

Summary

tests/structs/test_groupchat.py is not a runnable pytest suite. Every test function takes a report parameter, and no such fixture exists, so all five error at collection. GroupChat therefore has zero working test coverage.

That is how a critical GroupChat defect went unnoticed (see below).

Reproduction

$ PYTHONPATH=. python3 -m pytest tests/structs/test_groupchat.py -q -p no:randomly
E       fixture 'report' not found
...
ERROR tests/structs/test_groupchat.py::test_basic_groupchat
ERROR tests/structs/test_groupchat.py::test_varying_agent_counts
ERROR tests/structs/test_groupchat.py::test_threshold_behavior
ERROR tests/structs/test_groupchat.py::test_idle_timeout
ERROR tests/structs/test_groupchat.py::test_error_cases
5 errors in 1.86s

The signatures are e.g. tests/structs/test_groupchat.py:120:

def test_basic_groupchat(report):

The only report in the repo is a plain helper function in an unrelated file (tests/test_streaming_timing.py:35), not a fixture. The file reads as a script that was converted to test_*.py naming without being converted to pytest.

What it hid

While testing GroupChat live I found that no agent could ever speak: _extract_args did not handle the case where Agent.run returns the forced tool call as a string rather than a list, so every bid parsed as (0.0, "") and the chat ended on turn one.

_ensure_respond_tool injects RESPOND_TOOL and rebuilds the LLM but never sets output_type, so an agent built the documented way (no explicit output_type) returns a string. Confirmed:

agent bid: score=0.92, real message
_extract_args(...) -> (0.0, '')          # default output_type
_extract_args(...) -> (0.84, '...')      # output_type="final"

A single working test that ran a two-agent chat and asserted at least one message was posted would have caught it immediately.

Suggested fix

  1. Convert the five tests to real pytest: drop the report parameter, or provide it as a fixture in conftest.py if the reporting output is wanted.
  2. Add offline coverage for the bid path specifically — stub swarms.utils.litellm_wrapper.completion to return a forced respond tool call and assert:
    • a bid above threshold results in a posted message,
    • _extract_args parses both the list form and the string form,
    • idle_timeout / lull behaviour ends the chat.

Also note idle_timeout is still a constructor parameter (:198) though the changelog states it is deprecated and unused — one of the tests is named test_idle_timeout, so it may be asserting behaviour that no longer exists.

Found at 3e89f27b (v14.0.2).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions