Work with fix test
Use the fix-test system when you need to implement or modify automatic test diagnosis and repair capabilities in your project.
Prerequisites
- Access to the project source code
- Understanding of test execution workflows
- Familiarity with the test lifecycle management system
Understand the test lifecycle architecture
Start by examining how the test lifecycle system works:
- Open
src/attune/workflows/test_lifecycle.pyto see theTestLifecycleManagerclass - Review the
TestTaskandTestActiondataclasses to understand the task queue structure - Check
src/attune/workflows/test_maintenance.pyfor theTestMaintenanceWorkflowthat handles automatic test management
The system uses event-driven test management where file changes trigger test tasks that get queued and processed automatically.
Identify the target component
Determine which component needs modification based on your goal:
- Test execution tracking: Modify functions in
src/attune/workflows/test_runner.py - Test lifecycle events: Update
TestLifecycleManagermethods intest_lifecycle.py - Maintenance workflows: Change
TestMaintenanceWorkflowintest_maintenance.py
Modify test execution functions
For changes to test running and tracking:
-
Locate the specific function in
test_runner.py:run_tests_with_tracking()for test execution with monitoringtrack_coverage()for coverage analysistrack_file_tests()for file-specific test trackingget_file_test_status()for retrieving test statusget_files_needing_tests()for identifying test gaps
-
Read the function's docstring and examine its parameters and return type
-
Study the existing error handling patterns and logging style
-
Implement your changes following the established conventions
Update lifecycle management
For changes to the test lifecycle system:
-
Modify the appropriate method in
TestLifecycleManager:on_file_created(),on_file_modified(), oron_file_deleted()for file event handlingprocess_queue()for task executionschedule_maintenance()orrun_maintenance()for automated maintenance
-
Update the corresponding
TestTaskorTestPlanItemproperties if needed -
Ensure the task priority and action enums are used correctly
Test your changes
Run the test suite to verify your modifications work correctly:
pytest -k "test_lifecycle" tests/
pytest -k "test_runner" tests/
Your changes should pass all existing tests without breaking the test lifecycle workflow.
Success criteria
Your fix-test modifications are complete when:
- All targeted tests pass
- The test lifecycle manager processes tasks correctly
- Test execution tracking records data as expected
- No regressions appear in the existing test suite