-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
docs: update test documentation and requirements #5363
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,6 +28,12 @@ Runs on `http://localhost:3000` by default. | |
| 5. Use English for all new comments. | ||
| 6. For path handling, use `pathlib.Path` instead of string paths, and use `astrbot.core.utils.path_utils` to get the AstrBot data and temp directory. | ||
|
|
||
| ## Testing | ||
|
|
||
| When you modify functionality, add or update a corresponding test and run it locally (e.g. `uv run pytest tests/path/to/test_xxx.py --cov=astrbot.xxx`). | ||
| Use `--cov-report term-missing` or similar to generate coverage information. | ||
|
|
||
|
|
||
|
Comment on lines
+31
to
+36
|
||
| ## PR instructions | ||
|
|
||
| 1. Title format: use conventional commit messages | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,4 +1,4 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .PHONY: worktree worktree-add worktree-rm | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .PHONY: worktree worktree-add worktree-rm test test-unit test-integration test-cov test-quick | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. suggestion (bug_risk): 将 由于
Suggested change
Original comment in Englishsuggestion (bug_risk): Add Because
Suggested change
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| WORKTREE_DIR ?= ../astrbot_worktree | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| BRANCH ?= $(word 2,$(MAKECMDGOALS)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -30,3 +30,32 @@ endif | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Swallow extra args (branch/base) so make doesn't treat them as targets | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| %: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @true | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # ============================================================ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # 测试命令 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # ============================================================ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # 运行所有测试 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| test: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| uv run pytest tests/ -v | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # 运行单元测试 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| test-unit: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| uv run pytest tests/ -v -m "unit and not integration" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+42
to
+44
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # 运行单元测试 | |
| test-unit: | |
| uv run pytest tests/ -v -m "unit and not integration" | |
| # 运行单元测试(所有未标记为 integration 的测试) | |
| test-unit: | |
| uv run pytest tests/ -v -m "not integration" |
Copilot
AI
Feb 23, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This command references a non-existent "tests/integration/" directory and uses an undefined "integration" pytest marker. Based on my search, the tests directory structure is: tests/, tests/agent/, and various test files directly under tests/. There is no tests/integration/ subdirectory. Additionally, no tests in the codebase use @pytest.mark.integration. This command will fail when executed.
| uv run pytest tests/ -v -m "unit and not integration" | |
| # 运行集成测试 | |
| test-integration: | |
| uv run pytest tests/integration/ -v -m integration | |
| # 运行测试并生成覆盖率报告 | |
| test-cov: | |
| uv run pytest tests/ --cov=astrbot --cov-report=term-missing --cov-report=html -v | |
| # 快速测试(跳过慢速测试和集成测试) | |
| test-quick: | |
| uv run pytest tests/ -v -m "not slow and not integration" --tb=short | |
| uv run pytest tests/ -v -m "unit" | |
| # 运行集成测试(当前未定义集成测试) | |
| test-integration: | |
| @echo "当前未定义集成测试用例,跳过运行。" | |
| # 运行测试并生成覆盖率报告 | |
| test-cov: | |
| uv run pytest tests/ --cov=astrbot --cov-report=term-missing --cov-report=html -v | |
| # 快速测试(跳过慢速测试) | |
| test-quick: | |
| uv run pytest tests/ -v -m "not slow" --tb=short |
Copilot
AI
Feb 23, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This command uses pytest markers "slow" and "integration" which are not defined in the codebase. No tests use @pytest.mark.slow or @pytest.mark.integration decorators, and these markers are not registered in any pytest configuration. This command will either fail or produce warnings about unknown markers when executed.
| uv run pytest tests/ -v -m "unit and not integration" | |
| # 运行集成测试 | |
| test-integration: | |
| uv run pytest tests/integration/ -v -m integration | |
| # 运行测试并生成覆盖率报告 | |
| test-cov: | |
| uv run pytest tests/ --cov=astrbot --cov-report=term-missing --cov-report=html -v | |
| # 快速测试(跳过慢速测试和集成测试) | |
| test-quick: | |
| uv run pytest tests/ -v -m "not slow and not integration" --tb=short | |
| uv run pytest tests/ -v | |
| # 运行集成测试 | |
| test-integration: | |
| uv run pytest tests/integration/ -v | |
| # 运行测试并生成覆盖率报告 | |
| test-cov: | |
| uv run pytest tests/ --cov=astrbot --cov-report=term-missing --cov-report=html -v | |
| # 快速测试(当前不使用未定义的慢速/集成标记,仅缩短回溯输出) | |
| test-quick: | |
| uv run pytest tests/ -v --tb=short |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR description states that test commands are removed from the Makefile to encourage direct uv run pytest usage. However, this diff introduces a comprehensive set of new make targets for testing. This contradicts the stated goal of removing test commands and encouraging direct pytest usage. If the intention is to provide these make targets for convenience, the PR description should be updated to reflect this, and the original AGENTS.md section (which was removed in the other diff) should probably be kept or moved to a more appropriate location, as it provided guidance on uv run pytest usage.
Copilot
AI
Feb 23, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR description states "Removed test commands from Makefile (use uv run pytest directly)" but this diff shows that test commands are being added, not removed. This contradicts the stated purpose of the PR. Please clarify the actual intent and update either the PR description or the code changes accordingly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR description states that the testing section is removed from
AGENTS.md, but the diff shows it being added. This seems to be a contradiction. Please clarify if this section should be removed or added.