fix(test): make test-quick reliable as developer gate

Fixes for D-001验收问题:
1. test-quick.sh: use set -euo pipefail, uv run ruff, no tail pipe
2. Remove unused imports in factories (app.py, platform.py, provider.py)
3. Fix unused variable in smoke test
4. Add noqa: E402 to test_n8nsvapi.py lazy imports
5. Update smoke test docs: "minimal fake flow" not full pipeline

Now test-quick is a reliable gate: lint failures exit 1, test failures propagate.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
huanghuoguoguo
2026-05-08 14:52:21 +08:00
parent 25bf3ea0b3
commit 66a0a7c9c8
6 changed files with 30 additions and 28 deletions

View File

@@ -4,31 +4,30 @@
# Runs linting, unit tests, and smoke tests without requiring real provider keys
# Suitable for local branch validation
set -e
set -euo pipefail
echo "=== LangBot Quick Self-Test ==="
echo ""
# 1. Ruff check
echo "[1/3] Running ruff check..."
if command -v ruff &> /dev/null; then
ruff check src/langbot/ tests/ --quiet || {
echo "⚠ Ruff check found issues. Run 'ruff check --fix' to auto-fix."
}
else
echo "⚠ ruff not installed, skipping lint check"
fi
uv run ruff check src/langbot/ tests/ --output-format=concise || {
echo ""
echo "⚠ Ruff check found issues. Run 'uv run ruff check --fix' to auto-fix."
exit 1
}
echo "✓ Ruff check passed"
echo ""
# 2. Unit tests
echo "[2/3] Running unit tests..."
uv run pytest tests/unit_tests/ -q --tb=short 2>&1 | tail -5
uv run pytest tests/unit_tests/ -q --tb=short
echo ""
# 3. Smoke tests (if exists)
echo "[3/3] Running smoke tests..."
if [ -d "tests/smoke" ]; then
uv run pytest tests/smoke/ -q --tb=short 2>&1 | tail -5
uv run pytest tests/smoke/ -q --tb=short
else
echo "No smoke tests found, skipping"
fi