fix(test): fix make test failed (#2502)

This commit is contained in:
yyhhyy 2025-03-21 18:04:53 +08:00 committed by GitHub
parent 996f41615a
commit 5a35023090
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 22 additions and 11 deletions

View File

@ -19,18 +19,30 @@ $(VENV)/.venv-timestamp: uv.lock
uv venv --python 3.11 $(VENV)
uv pip install --prefix $(VENV) ruff
uv pip install --prefix $(VENV) mypy
uv pip install --prefix $(VENV) pytest
touch $(VENV)/.venv-timestamp
testenv: $(VENV)/.testenv
$(VENV)/.testenv: $(VENV)/bin/activate
. $(VENV_BIN)/activate && uv sync --active --all-packages \
--extra "base" \
--extra "proxy_openai" \
--extra "rag" \
--extra "storage_chromadb" \
--extra "dbgpts" \
--link-mode=copy
# check uv version and use appropriate parameters
if . $(VENV_BIN)/activate && uv sync --help | grep -q -- "--active"; then \
. $(VENV_BIN)/activate && uv sync --active --all-packages \
--extra "base" \
--extra "proxy_openai" \
--extra "rag" \
--extra "storage_chromadb" \
--extra "dbgpts" \
--link-mode=copy; \
else \
. $(VENV_BIN)/activate && uv sync --all-packages \
--extra "base" \
--extra "proxy_openai" \
--extra "rag" \
--extra "storage_chromadb" \
--extra "dbgpts" \
--link-mode=copy; \
fi
cp .devcontainer/dbgpt.pth $(VENV)/lib/python3.11/site-packages
touch $(VENV)/.testenv
@ -96,7 +108,7 @@ clean: ## Clean up the environment
rm -rf $(VENV)
find . -type f -name '*.pyc' -delete
find . -type d -name '__pycache__' -delete
find . -type d -name '.pytest_cache' -delete
# find . -type d -name '.pytest_cache' -delete
find . -type d -name '.coverage' -delete
.PHONY: clean-dist

View File

@ -198,9 +198,8 @@ def test_extract_union_field_type():
)
desc_list = _get_parameter_descriptions(ComplexConfig)
# Test union type
assert desc_list[0].param_name == "str_with_default"
assert desc_list[0].param_name == "union_field"
assert desc_list[0].param_type == "string"
assert desc_list[0].required is False
@ -269,7 +268,7 @@ def test_python_type_hint_variations():
# Test nested Optional with Union
assert desc_list[4].param_name == "nested_optional"
assert desc_list[4].param_type == "integer"
assert desc_list[4].param_type == "string"
assert desc_list[4].required is False
# Test nested | syntax