mirror of
https://github.com/OpenBMB/ChatDev.git
synced 2026-04-25 11:18:06 +00:00
feat: make check-backend for quality checks
This commit is contained in:
parent
6a898ce2da
commit
f3d6a2f94e
19
Makefile
19
Makefile
@ -41,6 +41,23 @@ validate-yamls: ## Validate all YAML configuration files
|
||||
|
||||
.PHONY: help
|
||||
help: ## Display this help message
|
||||
@python -c "import re; \
|
||||
@uv run python -c "import re; \
|
||||
p=r'$(firstword $(MAKEFILE_LIST))'.strip(); \
|
||||
[print(f'{m[0]:<20} {m[1]}') for m in re.findall(r'^([a-zA-Z_-]+):.*?## (.*)$$', open(p, encoding='utf-8').read(), re.M)]" | sort
|
||||
|
||||
# ==============================================================================
|
||||
# Quality Checks
|
||||
# ==============================================================================
|
||||
|
||||
.PHONY: check-backend
|
||||
check-backend: ## Run backend quality checks (tests + linting)
|
||||
@$(MAKE) backend-tests
|
||||
@$(MAKE) backend-lint
|
||||
|
||||
.PHONY: backend-tests
|
||||
backend-tests: ## Run backend tests
|
||||
@uv run pytest -v
|
||||
|
||||
.PHONY: backend-lint
|
||||
backend-lint: ## Run backend linting
|
||||
@uvx ruff check .
|
||||
|
||||
@ -45,5 +45,19 @@ dependencies = [
|
||||
requires = ["hatchling"]
|
||||
build-backend = "hatchling.build"
|
||||
|
||||
[tool.pytest.ini_options]
|
||||
pythonpath = ["."]
|
||||
testpaths = ["tests"]
|
||||
python_files = ["test_*.py"]
|
||||
python_classes = ["Test*"]
|
||||
python_functions = ["test_*"]
|
||||
addopts = "-v --tb=short"
|
||||
filterwarnings = [
|
||||
# Upstream SWIG issue in faiss-cpu on Python 3.12; awaiting SWIG 4.4 fix.
|
||||
"ignore:builtin type Swig.*:DeprecationWarning",
|
||||
"ignore:builtin type swigvarlink.*:DeprecationWarning",
|
||||
]
|
||||
|
||||
|
||||
[tool.uv]
|
||||
package = false
|
||||
|
||||
@ -3,11 +3,6 @@ from unittest.mock import MagicMock, patch
|
||||
from runtime.node.agent.memory.memory_base import MemoryContentSnapshot, MemoryItem
|
||||
from runtime.node.agent.memory.simple_memory import SimpleMemory
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Helpers
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
def _make_store(memory_path=None):
|
||||
"""Build a minimal MemoryStoreConfig mock for SimpleMemory."""
|
||||
simple_cfg = MagicMock()
|
||||
@ -37,12 +32,7 @@ def _make_memory_item(item_id: str, dim: int):
|
||||
)
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Tests
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
class TestSimpleMemoryRetrieveMixedDimensions:
|
||||
"""Task 2.1: verify retrieve() handles mixed-dimension embeddings."""
|
||||
|
||||
def test_mixed_dimensions_does_not_crash(self):
|
||||
"""Retrieve with mixed-dimensional embeddings MUST not raise."""
|
||||
@ -112,7 +102,6 @@ class TestSimpleMemoryRetrieveMixedDimensions:
|
||||
|
||||
|
||||
class TestOpenAIEmbeddingDynamicFallback:
|
||||
"""Task 2.2: verify dynamic fallback dimension caching."""
|
||||
|
||||
def test_fallback_uses_model_dimension_after_success(self):
|
||||
"""After a successful call the fallback dimension MUST match the model."""
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user