Fix failing tests for agent framework updates
Updated test fixtures and expectations to match new agent naming: - Fixed test registry to use correct agent names (setupRepository, keepaTodofile, keepaChangelog) - Updated test assertions to expect new agent names instead of old ones - Added missing category fields to test agent definitions - Enhanced test registry with keepaChangelog agent for complete template testing All 24 tests now pass: - test_core.py: 6 tests ✅ - test_installer.py: 10 tests ✅ - test_registry.py: 8 tests ✅ 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -350,6 +350,7 @@ class ProjectInitializer:
|
||||
# Create basic files
|
||||
self._create_gitignore(project_dir)
|
||||
self._create_readme(project_dir, project_name)
|
||||
self._create_makefile(project_dir, project_name)
|
||||
|
||||
if template.startswith("python"):
|
||||
self._create_pyproject_toml(project_dir, project_name)
|
||||
@@ -468,9 +469,11 @@ dev = [
|
||||
"black>=22.0",
|
||||
"flake8>=5.0",
|
||||
"mypy>=1.0",
|
||||
"kaizen-agentic>=0.1.0",
|
||||
]
|
||||
|
||||
# Note: Add kaizen-agentic dependency when published to PyPI
|
||||
# dev = [..., "kaizen-agentic>=0.1.0"]
|
||||
|
||||
[tool.setuptools.packages.find]
|
||||
where = ["src"]
|
||||
|
||||
@@ -506,3 +509,110 @@ python_functions = ["test_*"]
|
||||
__version__ = "0.1.0"
|
||||
'''
|
||||
(project_dir / f"src/{package_name}/__init__.py").write_text(init_content)
|
||||
|
||||
def _create_makefile(self, project_dir: Path, project_name: str):
|
||||
"""Create Makefile with standard targets."""
|
||||
package_name = project_name.replace('-', '_')
|
||||
makefile_content = f"""# {project_name} - Makefile for development workflow
|
||||
# Generated by Kaizen Agentic
|
||||
|
||||
.PHONY: help setup-complete setup-python setup-tools test lint format clean agents-status agents-update
|
||||
|
||||
# Default target
|
||||
help:
|
||||
@echo "Available targets:"
|
||||
@echo " setup-complete - Complete development environment setup"
|
||||
@echo " setup-python - Set up Python virtual environment and dependencies"
|
||||
@echo " setup-tools - Install development tools"
|
||||
@echo " test - Run test suite"
|
||||
@echo " lint - Run code quality checks"
|
||||
@echo " format - Format code with black"
|
||||
@echo " clean - Clean build artifacts"
|
||||
@echo " agents-status - Show installed agents status"
|
||||
@echo " agents-update - Update agents to latest versions"
|
||||
|
||||
# Virtual environment detection
|
||||
VENV := .venv
|
||||
PYTHON := $(VENV)/bin/python
|
||||
PIP := $(VENV)/bin/pip
|
||||
|
||||
# Complete setup
|
||||
setup-complete: setup-python setup-tools
|
||||
@echo "✅ Development environment setup complete!"
|
||||
@echo "Next steps:"
|
||||
@echo " source $(VENV)/bin/activate # Activate virtual environment"
|
||||
@echo " make test # Run tests"
|
||||
@echo " make lint # Check code quality"
|
||||
|
||||
# Python environment setup
|
||||
setup-python: $(VENV)/bin/activate
|
||||
|
||||
$(VENV)/bin/activate: pyproject.toml
|
||||
python3 -m venv $(VENV)
|
||||
$(PIP) install --upgrade pip
|
||||
$(PIP) install -e ".[dev]"
|
||||
touch $(VENV)/bin/activate
|
||||
|
||||
# Development tools setup
|
||||
setup-tools: $(VENV)/bin/activate
|
||||
@echo "Development tools installed via pyproject.toml"
|
||||
|
||||
# Testing
|
||||
test: $(VENV)/bin/activate
|
||||
$(PYTHON) -m pytest tests/ -v
|
||||
|
||||
test-coverage: $(VENV)/bin/activate
|
||||
$(PYTHON) -m pytest tests/ --cov=src/{package_name} --cov-report=html --cov-report=term-missing
|
||||
|
||||
# Code quality
|
||||
lint: $(VENV)/bin/activate
|
||||
$(PYTHON) -m flake8 src/ tests/
|
||||
$(PYTHON) -m mypy src/
|
||||
|
||||
format: $(VENV)/bin/activate
|
||||
$(PYTHON) -m black src/ tests/
|
||||
|
||||
format-check: $(VENV)/bin/activate
|
||||
$(PYTHON) -m black --check src/ tests/
|
||||
|
||||
# Cleanup
|
||||
clean:
|
||||
rm -rf build/
|
||||
rm -rf dist/
|
||||
rm -rf *.egg-info/
|
||||
rm -rf .pytest_cache/
|
||||
rm -rf .coverage
|
||||
rm -rf htmlcov/
|
||||
find . -type d -name __pycache__ -exec rm -rf {{}} +
|
||||
find . -type f -name "*.pyc" -delete
|
||||
|
||||
# Agent management
|
||||
agents-status:
|
||||
@if command -v kaizen-agentic >/dev/null 2>&1; then \\
|
||||
kaizen-agentic status; \\
|
||||
else \\
|
||||
echo "kaizen-agentic not found. Install with: pip install kaizen-agentic"; \\
|
||||
fi
|
||||
|
||||
agents-update:
|
||||
@if command -v kaizen-agentic >/dev/null 2>&1; then \\
|
||||
kaizen-agentic update; \\
|
||||
else \\
|
||||
echo "kaizen-agentic not found. Install with: pip install kaizen-agentic"; \\
|
||||
fi
|
||||
|
||||
agents-list:
|
||||
@if command -v kaizen-agentic >/dev/null 2>&1; then \\
|
||||
kaizen-agentic list; \\
|
||||
else \\
|
||||
echo "kaizen-agentic not found. Install with: pip install kaizen-agentic"; \\
|
||||
fi
|
||||
|
||||
agents-validate:
|
||||
@if command -v kaizen-agentic >/dev/null 2>&1; then \\
|
||||
kaizen-agentic validate; \\
|
||||
else \\
|
||||
echo "kaizen-agentic not found. Install with: pip install kaizen-agentic"; \\
|
||||
fi
|
||||
"""
|
||||
(project_dir / "Makefile").write_text(makefile_content)
|
||||
|
||||
@@ -256,33 +256,33 @@ class AgentRegistry:
|
||||
"""Get predefined agent templates for different project types."""
|
||||
return {
|
||||
"python-basic": [
|
||||
"setup-repository",
|
||||
"todo-keeper",
|
||||
"changelog-keeper"
|
||||
"setupRepository",
|
||||
"keepaTodofile",
|
||||
"keepaChangelog"
|
||||
],
|
||||
"python-web": [
|
||||
"setup-repository",
|
||||
"setupRepository",
|
||||
"tdd-workflow",
|
||||
"code-refactoring",
|
||||
"todo-keeper",
|
||||
"changelog-keeper",
|
||||
"contributing-keeper"
|
||||
"keepaTodofile",
|
||||
"keepaChangelog",
|
||||
"keepaContributingfile"
|
||||
],
|
||||
"python-cli": [
|
||||
"setup-repository",
|
||||
"setupRepository",
|
||||
"tdd-workflow",
|
||||
"testing-efficiency",
|
||||
"claude-documentation",
|
||||
"todo-keeper",
|
||||
"changelog-keeper"
|
||||
"keepaTodofile",
|
||||
"keepaChangelog"
|
||||
],
|
||||
"python-data": [
|
||||
"setup-repository",
|
||||
"setupRepository",
|
||||
"datamodel-optimization",
|
||||
"testing-efficiency",
|
||||
"requirements-engineering",
|
||||
"todo-keeper",
|
||||
"changelog-keeper"
|
||||
"keepaTodofile",
|
||||
"keepaChangelog"
|
||||
],
|
||||
"comprehensive": [
|
||||
agent.name for agent in self.list_agents()
|
||||
|
||||
@@ -17,6 +17,7 @@ def test_registry(tmp_path):
|
||||
base_agent = """---
|
||||
name: base-agent
|
||||
description: Base test agent
|
||||
category: testing
|
||||
---
|
||||
|
||||
# Base Agent
|
||||
@@ -25,8 +26,9 @@ This is a base agent for testing.
|
||||
"""
|
||||
|
||||
setup_agent = """---
|
||||
name: setup-repository
|
||||
name: setupRepository
|
||||
description: Repository setup agent
|
||||
category: infrastructure
|
||||
---
|
||||
|
||||
# Setup Repository
|
||||
@@ -35,18 +37,31 @@ Sets up repository structure.
|
||||
"""
|
||||
|
||||
todo_agent = """---
|
||||
name: todo-keeper
|
||||
name: keepaTodofile
|
||||
description: TODO management agent
|
||||
category: project-management
|
||||
---
|
||||
|
||||
# TODO Keeper
|
||||
|
||||
Manages TODO files.
|
||||
"""
|
||||
|
||||
changelog_agent = """---
|
||||
name: keepaChangelog
|
||||
description: Changelog management agent
|
||||
category: project-management
|
||||
---
|
||||
|
||||
# Changelog Keeper
|
||||
|
||||
Manages CHANGELOG files.
|
||||
"""
|
||||
|
||||
(agents_dir / "agent-base-agent.md").write_text(base_agent)
|
||||
(agents_dir / "agent-setup-repository.md").write_text(setup_agent)
|
||||
(agents_dir / "agent-todo-keeper.md").write_text(todo_agent)
|
||||
(agents_dir / "agent-setupRepository.md").write_text(setup_agent)
|
||||
(agents_dir / "agent-keepaTodofile.md").write_text(todo_agent)
|
||||
(agents_dir / "agent-keepaChangelog.md").write_text(changelog_agent)
|
||||
|
||||
return AgentRegistry(agents_dir)
|
||||
|
||||
@@ -80,10 +95,10 @@ def test_install_agents_with_dependencies(test_registry, tmp_path):
|
||||
)
|
||||
|
||||
# Install an agent that depends on others
|
||||
results = installer.install_agents(["setup-repository"], config)
|
||||
results = installer.install_agents(["setupRepository"], config)
|
||||
|
||||
assert "setup-repository" in results
|
||||
assert results["setup-repository"] == "INSTALLED"
|
||||
assert "setupRepository" in results
|
||||
assert results["setupRepository"] == "INSTALLED"
|
||||
|
||||
|
||||
def test_list_installed_agents(test_registry, tmp_path):
|
||||
@@ -97,12 +112,12 @@ def test_list_installed_agents(test_registry, tmp_path):
|
||||
|
||||
# Install some agents
|
||||
config = InstallationConfig(target_dir=project_dir, create_backup=False, update_docs=False)
|
||||
installer.install_agents(["base-agent", "todo-keeper"], config)
|
||||
installer.install_agents(["base-agent", "keepaTodofile"], config)
|
||||
|
||||
# Check installed agents
|
||||
installed = installer.list_installed_agents(project_dir)
|
||||
assert "base-agent" in installed
|
||||
assert "todo-keeper" in installed
|
||||
assert "keepaTodofile" in installed
|
||||
assert len(installed) == 2
|
||||
|
||||
|
||||
@@ -132,7 +147,7 @@ def test_remove_agents(test_registry, tmp_path):
|
||||
|
||||
# Install agents first
|
||||
config = InstallationConfig(target_dir=project_dir, create_backup=False, update_docs=False)
|
||||
installer.install_agents(["base-agent", "todo-keeper"], config)
|
||||
installer.install_agents(["base-agent", "keepaTodofile"], config)
|
||||
|
||||
# Remove an agent
|
||||
results = installer.remove_agents(["base-agent"], project_dir)
|
||||
@@ -220,13 +235,13 @@ def test_project_initializer_custom_agents(test_registry, tmp_path):
|
||||
initializer.init_project(
|
||||
project_dir,
|
||||
template="python-basic",
|
||||
agent_names=["base-agent", "todo-keeper"],
|
||||
agent_names=["base-agent", "keepaTodofile"],
|
||||
project_name="custom_project"
|
||||
)
|
||||
|
||||
# Check that specific agents were installed
|
||||
assert (project_dir / "agents" / "agent-base-agent.md").exists()
|
||||
assert (project_dir / "agents" / "agent-todo-keeper.md").exists()
|
||||
assert (project_dir / "agents" / "agent-keepaTodofile.md").exists()
|
||||
|
||||
|
||||
def test_installation_config():
|
||||
|
||||
@@ -173,8 +173,8 @@ def test_agent_registry_get_templates(tmp_path):
|
||||
assert "comprehensive" in templates
|
||||
|
||||
# Check that templates contain expected agents
|
||||
assert "setup-repository" in templates["python-basic"]
|
||||
assert "todo-keeper" in templates["python-basic"]
|
||||
assert "setupRepository" in templates["python-basic"]
|
||||
assert "keepaTodofile" in templates["python-basic"]
|
||||
|
||||
|
||||
def test_agent_registry_validate_agents(tmp_path):
|
||||
|
||||
Reference in New Issue
Block a user