Junyan Qin (Chin) b6cdf18c1a 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>
2025-10-01 10:56:59 +08:00
2025-05-20 09:39:46 +08:00
2025-09-13 09:44:18 +08:00
2025-09-29 17:37:15 +08:00

LangBot

English / 简体中文 / 繁體中文 / 日本語 / (PR for your language)

Discord Ask DeepWiki GitHub release (latest by date) python

Home Deployment Plugin Submit Plugin

LangBot is an open-source LLM native instant messaging robot development platform, aiming to provide out-of-the-box IM robot development experience, with Agent, RAG, MCP and other LLM application functions, adapting to global instant messaging platforms, and providing rich API interfaces, supporting custom development.

📦 Getting Started

Docker Compose Deployment

git clone https://github.com/langbot-app/LangBot
cd LangBot/docker
docker compose up -d

Visit http://localhost:5300 to start using it.

Detailed documentation Docker Deployment.

One-click Deployment on BTPanel

LangBot has been listed on the BTPanel, if you have installed the BTPanel, you can use the document to use it.

Zeabur Cloud Deployment

Community contributed Zeabur template.

Deploy on Zeabur

Railway Cloud Deployment

Deploy on Railway

Other Deployment Methods

Directly use the released version to run, see the Manual Deployment documentation.

😎 Stay Ahead

Click the Star and Watch button in the upper right corner of the repository to get the latest updates.

star gif

Features

  • 💬 Chat with LLM / Agent: Supports multiple LLMs, adapt to group chats and private chats; Supports multi-round conversations, tool calls, multi-modal, and streaming output capabilities. Built-in RAG (knowledge base) implementation, and deeply integrates with Dify.
  • 🤖 Multi-platform Support: Currently supports QQ, QQ Channel, WeCom, personal WeChat, Lark, DingTalk, Discord, Telegram, etc.
  • 🛠️ High Stability, Feature-rich: Native access control, rate limiting, sensitive word filtering, etc. mechanisms; Easy to use, supports multiple deployment methods. Supports multiple pipeline configurations, different bots can be used for different scenarios.
  • 🧩 Plugin Extension, Active Community: Support event-driven, component extension, etc. plugin mechanisms; Integrate Anthropic MCP protocol; Currently has hundreds of plugins.
  • 😻 Web UI: Support management LangBot instance through the browser. No need to manually write configuration files.

For more detailed specifications, please refer to the documentation.

Or visit the demo environment: https://demo.langbot.dev/

  • Login information: Email: demo@langbot.app Password: langbot123456
  • Note: For WebUI demo only, please do not fill in any sensitive information in the public environment.

Message Platform

Platform Status Remarks
Discord
Telegram
Slack
LINE
Personal QQ
QQ Official API
WeCom
WeComCS
WeCom AI Bot
Personal WeChat
Lark
DingTalk

LLMs

LLM Status Remarks
OpenAI Available for any OpenAI interface format model
DeepSeek
Moonshot
Anthropic
xAI
Zhipu AI
CompShare LLM and GPU resource platform
Dify LLMOps platform
PPIO LLM and GPU resource platform
ShengSuanYun LLM and GPU resource platform
302.AI LLM gateway(MaaS)
Google Gemini
Ollama Local LLM running platform
LMStudio Local LLM running platform
GiteeAI LLM interface gateway(MaaS)
SiliconFlow LLM gateway(MaaS)
Aliyun Bailian LLM gateway(MaaS), LLMOps platform
Volc Engine Ark LLM gateway(MaaS), LLMOps platform
ModelScope LLM gateway(MaaS)
MCP Support tool access through MCP protocol

🤝 Community Contribution

Thank you for the following code contributors and other members in the community for their contributions to LangBot:

Description
🤩 Easy-to-use global IM bot platform designed for LLM era / 简单易用的大模型即时通信机器人开发平台 ️ Bots for QQ / QQ频道 / Discord / LINE / WeChat(微信, 企业微信)/ Telegram / 飞书 / 钉钉 / Slack 🧩 Integrated with ChatGPT(GPT), DeepSeek, Dify, n8n, Langflow, Claude, Google Gemini, xAI, PPIO, Ollama, 阿里云百炼, SiliconFlow, Qwen, Moonshot, SillyTraven, MCP etc. LLM & Agent & RAG
Readme Apache-2.0 43 MiB
Languages
Python 61.3%
TypeScript 36.9%
CSS 1.6%
Shell 0.1%