Commit Graph

3 Commits

Author SHA1 Message Date
a560341a03 Optimize tests and simplify coverage config
- Optimize slow tests (3.5s -> 0.4s):
  - Mock threading.Thread instead of spawning real threads
  - Use PropertyMock instead of generator-based exception
- Simplify coverage config:
  - Set source to '.' to check all Python files
  - Remove exclude_lines (no special exclusions needed)
2025-12-02 22:12:50 +01:00
94fef50913 Achieve 100% test coverage for lichess_bot/main.py
- Refactor loops to use explicit next()/StopIteration for coverage
- Add tests for _collect_analysis_lines with empty and full iterators
- Add tests for _process_game_events_loop with multiple game events
- Add tests for _run_event_loop with limited and unlimited iterations
- Add test for process_analysis_output with error exit but no stderr
- Add test for process_game_finish with invalid data type
- All 85 tests pass with 100% line and branch coverage
2025-12-02 22:03:16 +01:00
38fe3ef53e Add comprehensive tests for lichess_bot main.py and lichess_api.py
- Fix test_process_game_event_game_end to properly mock engine
- Fix test_handle_game tests to mock _run_analysis_subprocess to prevent hanging
- Fix test_process_game_start_event to mock analysis subprocess
- Add test_process_game_event_game_end_after_move to cover game end status path
- Add test_process_game_event_color_unknown_on_gamefull to cover gameFull with spectator
- Add tests for lichess_api.py covering spectator case and join_game_stream edge cases
- Fix mypy type errors with Event and GameThreads type aliases

Coverage:
- lichess_api.py: 100% (was 98%)
- main.py: 99% (branch partials for loop exits only)
2025-12-02 21:53:15 +01:00