fix: update Makefile targets to use venv Python with PYTHONPATH

- Fix test target to run with PYTHONPATH=. for tddai module discovery
- Update all tddai CLI targets to use $(VENV_PYTHON) instead of python3
- Add PYTHONPATH=. to all CLI commands for proper module resolution
- Ensure all targets depend on $(VENV)/bin/activate

Resolves issue where 'make test' was failing due to module import errors.
All 20 tests now pass successfully.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-09-22 02:07:05 +02:00
parent 5155a548eb
commit 84161e77a9

View File

@@ -93,10 +93,10 @@ dev: install
test: $(VENV)/bin/activate
@echo "🧪 Running tests..."
@if [ -f $(VENV)/bin/pytest ]; then \
$(VENV)/bin/pytest tests/ -v; \
PYTHONPATH=. $(VENV)/bin/pytest tests/ -v; \
else \
$(VENV_PYTHON) -m pytest tests/ -v 2>/dev/null || \
$(VENV_PYTHON) -m unittest discover tests/ -v; \
PYTHONPATH=. $(VENV_PYTHON) -m pytest tests/ -v 2>/dev/null || \
PYTHONPATH=. $(VENV_PYTHON) -m unittest discover tests/ -v; \
fi
# Build the package
@@ -229,20 +229,20 @@ WORKSPACE_DIR := .markitect_workspace
CURRENT_ISSUE_FILE := $(WORKSPACE_DIR)/current_issue.json
# List all gitea issues
list-issues:
@python3 tddai_cli.py list-issues
list-issues: $(VENV)/bin/activate
@PYTHONPATH=. $(VENV_PYTHON) tddai_cli.py list-issues
# Show detailed view of a specific issue
show-issue:
show-issue: $(VENV)/bin/activate
@if [ -z "$(NUM)" ]; then \
echo "❌ Please specify issue number: make show-issue NUM=5"; \
exit 1; \
fi
@python3 tddai_cli.py show-issue $(NUM)
@PYTHONPATH=. $(VENV_PYTHON) tddai_cli.py show-issue $(NUM)
# List only open issues (active backlog)
list-open-issues:
@python3 tddai_cli.py list-open-issues
list-open-issues: $(VENV)/bin/activate
@PYTHONPATH=. $(VENV_PYTHON) tddai_cli.py list-open-issues
# Generate test skeleton from gitea issue (requires Claude Code)
test-from-issue:
@@ -268,21 +268,21 @@ test-from-issue:
@curl -s "$(ISSUES_API)/$(NUM)" | jq -r 'if .title then "✅ Issue #$(NUM): " + .title + "\n\n🧪 Generating test skeleton...\n Please ask Claude Code to generate a test for this issue:\n\n Command: '"'"'Generate a test skeleton for issue #$(NUM)'"'"'\n\n📋 Issue Details:\n Title: " + .title + "\n Description: " + .body + "\n\n📝 Test Requirements:\n - Follow TDD principles (test first, then implementation)\n - Use pytest framework (existing project convention)\n - Place test in tests/ directory\n - Name test file: test_issue_$(NUM)_*.py\n - Include docstring referencing issue #$(NUM)\n - Test should initially fail (red state)\n\n💡 After generation, run '"'"'make test'"'"' to verify test fails initially" else "❌ Issue #$(NUM) not found or API error\n Use '"'"'make list-open-issues'"'"' to see available issues" end' 2>/dev/null || echo "❌ Issue #$(NUM) not found or API error"
# Start working on an issue (creates workspace)
start-issue:
start-issue: $(VENV)/bin/activate
@if [ -z "$(NUM)" ]; then \
echo "❌ Please specify issue number: make start-issue NUM=1"; \
exit 1; \
fi
@python3 tddai_cli.py start-issue $(NUM)
@PYTHONPATH=. $(VENV_PYTHON) tddai_cli.py start-issue $(NUM)
# Add test to current issue workspace
add-test:
@python3 tddai_cli.py add-test
add-test: $(VENV)/bin/activate
@PYTHONPATH=. $(VENV_PYTHON) tddai_cli.py add-test
# Show current workspace status
workspace-status:
@python3 tddai_cli.py workspace-status
workspace-status: $(VENV)/bin/activate
@PYTHONPATH=. $(VENV_PYTHON) tddai_cli.py workspace-status
# Complete issue work (move tests to main and cleanup)
finish-issue:
@python3 tddai_cli.py finish-issue
finish-issue: $(VENV)/bin/activate
@PYTHONPATH=. $(VENV_PYTHON) tddai_cli.py finish-issue