mirror of
https://github.com/langbot-app/LangBot.git
synced 2025-11-25 03:15:06 +08:00
feat: add comprehensive unit tests for pipeline stages (#1701)
* feat: add comprehensive unit tests for pipeline stages * fix: deps install in ci * ci: use venv * ci: run run_tests.sh * fix: resolve circular import issues in pipeline tests Update all test files to use lazy imports via importlib.import_module() to avoid circular dependency errors. Fix mock_conversation fixture to properly mock list.copy() method. Changes: - Use lazy import pattern in all test files - Fix conftest.py fixture for conversation messages - Add integration test file for full import tests - Update documentation with known issues and workarounds Tests now successfully avoid circular import errors while maintaining full test coverage of pipeline stages. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * docs: add comprehensive testing summary Document implementation details, challenges, solutions, and future improvements for the pipeline unit test suite. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * refactor: rewrite unit tests to test actual pipeline stage code Rewrote unit tests to properly test real stage implementations instead of mock logic: - Test actual BanSessionCheckStage with 7 test cases (100% coverage) - Test actual RateLimit stage with 3 test cases (70% coverage) - Test actual PipelineManager with 5 test cases - Use lazy imports via import_module to avoid circular dependencies - Import pipelinemgr first to ensure proper stage registration - Use Query.model_construct() to bypass Pydantic validation in tests - Remove obsolete pure unit tests that didn't test real code - All 20 tests passing with 48% overall pipeline coverage 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * test: add unit tests for GroupRespondRuleCheckStage Added comprehensive unit tests for resprule stage: - Test person message skips rule check - Test group message with no matching rules (INTERRUPT) - Test group message with matching rule (CONTINUE) - Test AtBotRule removes At component correctly - Test AtBotRule when no At component present Coverage: 100% on resprule.py and atbot.py All 25 tests passing with 51% overall pipeline coverage 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * refactor: restructure tests to tests/unit_tests/pipeline Reorganized test directory structure to support multiple test categories: - Move tests/pipeline → tests/unit_tests/pipeline - Rename .github/workflows/pipeline-tests.yml → run-tests.yml - Update run_tests.sh to run all unit tests (not just pipeline) - Update workflow to trigger on all pkg/** and tests/** changes - Coverage now tracks entire pkg/ module instead of just pipeline This structure allows for easy addition of more unit tests for other modules in the future. All 25 tests passing with 21% overall pkg coverage. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * ci: upload codecov report * ci: codecov file * ci: coverage.xml --------- Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
committed by
GitHub
parent
bd4c7f634d
commit
b6cdf18c1a
6
.gitignore
vendored
6
.gitignore
vendored
@@ -22,7 +22,7 @@ tips.py
|
||||
venv*
|
||||
bin/
|
||||
.vscode
|
||||
test_*
|
||||
/test_*
|
||||
venv/
|
||||
hugchat.json
|
||||
qcapi
|
||||
@@ -43,4 +43,6 @@ test.py
|
||||
/web_ui
|
||||
.venv/
|
||||
uv.lock
|
||||
/test
|
||||
/test
|
||||
coverage.xml
|
||||
.coverage
|
||||
Reference in New Issue
Block a user