feat(tests): replace hardcoded YAML strings with factory fixtures#259
Merged
Conversation
mvillmow
commented
Jun 20, 2026
mvillmow
left a comment
Contributor
Author
There was a problem hiding this comment.
LGTM — hardcoded YAML constants replaced by typed factories in conftest.py; all test names/signatures preserved, factory dicts satisfy extra=forbid, match strings align with validators. No defects in changed lines.
Addresses #149: consolidate workflow fixture creation from 5 hardcoded YAML strings scattered across test_models.py and test_cli.py into a single set of typed factory functions in conftest.py. Each test now calls the factory with only the fields it cares about; defaults live in one place. This makes schema evolution resilient: a new required field on AgentSpec now requires editing conftest.py only, rather than updating every fixture that constructs an agent. Changes: - Create tests/conftest.py with make_agent_dict, make_task_dict, make_team_dict, make_workflow_dict, make_workflow_yaml, make_workflow_spec, and make_two_task_dep_dict factory functions - Expose workflow_dict_factory, workflow_spec_factory, and workflow_file_factory as pytest fixtures for test consumption - Remove MINIMAL_WORKFLOW_YAML, TWO_TASK_DEP_YAML from test_models.py - Remove _VALID_WORKFLOW_YAML, _INVALID_WORKFLOW_YAML_MISSING_NAME from test_cli.py - Update all tests to use factories instead of YAML strings - Migrate test_cycle_raises to use factory scaffolding - Update imports to use collections.abc.Callable (Python 3.9+) All 20 tests in test_models.py and test_cli.py pass. No changes to test_executor.py or test_agamemnon_client.py. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com> Signed-off-by: mvillmow <4211002+mvillmow@users.noreply.github.com>
GHSA-4xgf-cpjx-pc3j) Signed-off-by: Micah Villmow <4211002+mvillmow@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replace hardcoded YAML string literals and inline workflow dicts with a single set of typed factory functions in
tests/conftest.py. Each test now calls a factory with only the fields it cares about; defaults come from one place.Before: Changes to the schema required updating 5 hardcoded YAML strings across two test files.
After: Changes require editing one file (conftest.py).
Closes #149
Changes
Create
tests/conftest.py:make_agent_dict,make_task_dict,make_team_dict— dict buildersmake_workflow_dict— complete workflow dict buildermake_workflow_yaml,make_workflow_spec— typed views of the workflowmake_two_task_dep_dict— canonical two-agent dependency test fixtureworkflow_dict_factory,workflow_spec_factory,workflow_file_factory— pytest fixturesUpdate
tests/test_models.py:MINIMAL_WORKFLOW_YAMLandTWO_TASK_DEP_YAMLimport yamlworkflow_spec_factoryorworkflow_dict_factorytest_cycle_raisesinline dict to useworkflow_dict_factory()Update
tests/test_cli.py:_VALID_WORKFLOW_YAMLand_INVALID_WORKFLOW_YAML_MISSING_NAMEvalid_workflow_fileto delegate toworkflow_file_factoryinvalid_workflow_fileto usemake_workflow_dict()then delete the name keyTest Results
🤖 Generated with Claude Code