- Fix test_app_activity_functions.py SQLAlchemy database issues:
- Reinitialize db with test app config before creating tables
- Store and restore original database URI in tearDown
- Add try/except around drop_all in tearDown
- Fix test_activity_integration.py attempts increment test:
- Remove next_section_and_step from incorrect transition
- When next_section_and_step is specified, code navigates without incrementing attempts
- Transition should only have counts_as_attempt without navigation to increment and stay on same step
- This matches the actual behavior: navigation happens immediately when specified
- Fix test_activity_processing.py: Import activity module and use activity.* functions
- Fix test_app_activity_functions.py: Import activity module, use activity.* functions, initialize activity module with app's socketio and db
- Fix test_activity_integration.py: Update YAML format to match current specification
- Change buckets from objects to simple string lists
- Use next_section_and_step instead of separate next_section_id/next_step_id
- Add required title fields and tokens_for_ai
- Replace type field with content_blocks for info steps
Address CodeRabbit feedback by replacing bare except clauses with
specific Exception handling:
- test_activity_integration.py: Fix 2 tearDown methods
- test_app_integration.py: Fix 1 tearDown method
Changes:
- Replace bare 'except:' with 'except Exception as e:'
- Add explanatory comments for why exceptions are caught
- Maintain same functionality while improving code quality
Tests still pass: 11/13 integration tests passing (85%)
Major improvements to test_activity_integration.py:
- Configure tests to use uncloseai.com models (hermes-3-llama-3.1-405b and qwen-2.5-72b)
- Fix Flask app and activity module configuration in test setUp
- Properly initialize MODEL_CLIENT_MAP with test models
- Set up activity.app, activity.db, and activity.get_room for proper test isolation
- Fix file path handling in create_test_activity_file()
- Improve activity YAML structure to avoid premature activity completion
- Add session refresh to handle database state properly
Test results improved from 3/9 passing to 7/9 passing (78% pass rate):
✓ test_cancel_activity
✓ test_display_activity_metadata
✓ test_execute_processing_script_with_metadata_operations
✓ test_handle_activity_response_correct_answer
✓ test_start_activity
✓ test_activity_state_metadata_persistence
✓ test_metadata_update_and_remove
Remaining issues (edge cases):
- test_handle_activity_response_increments_attempts: attempts counter behavior on incorrect answers
- test_loop_through_steps_until_question: step navigation emit count