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:
34
Makefile
34
Makefile
@@ -93,10 +93,10 @@ dev: install
|
|||||||
test: $(VENV)/bin/activate
|
test: $(VENV)/bin/activate
|
||||||
@echo "🧪 Running tests..."
|
@echo "🧪 Running tests..."
|
||||||
@if [ -f $(VENV)/bin/pytest ]; then \
|
@if [ -f $(VENV)/bin/pytest ]; then \
|
||||||
$(VENV)/bin/pytest tests/ -v; \
|
PYTHONPATH=. $(VENV)/bin/pytest tests/ -v; \
|
||||||
else \
|
else \
|
||||||
$(VENV_PYTHON) -m pytest tests/ -v 2>/dev/null || \
|
PYTHONPATH=. $(VENV_PYTHON) -m pytest tests/ -v 2>/dev/null || \
|
||||||
$(VENV_PYTHON) -m unittest discover tests/ -v; \
|
PYTHONPATH=. $(VENV_PYTHON) -m unittest discover tests/ -v; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Build the package
|
# Build the package
|
||||||
@@ -229,20 +229,20 @@ WORKSPACE_DIR := .markitect_workspace
|
|||||||
CURRENT_ISSUE_FILE := $(WORKSPACE_DIR)/current_issue.json
|
CURRENT_ISSUE_FILE := $(WORKSPACE_DIR)/current_issue.json
|
||||||
|
|
||||||
# List all gitea issues
|
# List all gitea issues
|
||||||
list-issues:
|
list-issues: $(VENV)/bin/activate
|
||||||
@python3 tddai_cli.py list-issues
|
@PYTHONPATH=. $(VENV_PYTHON) tddai_cli.py list-issues
|
||||||
|
|
||||||
# Show detailed view of a specific issue
|
# Show detailed view of a specific issue
|
||||||
show-issue:
|
show-issue: $(VENV)/bin/activate
|
||||||
@if [ -z "$(NUM)" ]; then \
|
@if [ -z "$(NUM)" ]; then \
|
||||||
echo "❌ Please specify issue number: make show-issue NUM=5"; \
|
echo "❌ Please specify issue number: make show-issue NUM=5"; \
|
||||||
exit 1; \
|
exit 1; \
|
||||||
fi
|
fi
|
||||||
@python3 tddai_cli.py show-issue $(NUM)
|
@PYTHONPATH=. $(VENV_PYTHON) tddai_cli.py show-issue $(NUM)
|
||||||
|
|
||||||
# List only open issues (active backlog)
|
# List only open issues (active backlog)
|
||||||
list-open-issues:
|
list-open-issues: $(VENV)/bin/activate
|
||||||
@python3 tddai_cli.py list-open-issues
|
@PYTHONPATH=. $(VENV_PYTHON) tddai_cli.py list-open-issues
|
||||||
|
|
||||||
# Generate test skeleton from gitea issue (requires Claude Code)
|
# Generate test skeleton from gitea issue (requires Claude Code)
|
||||||
test-from-issue:
|
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"
|
@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 working on an issue (creates workspace)
|
||||||
start-issue:
|
start-issue: $(VENV)/bin/activate
|
||||||
@if [ -z "$(NUM)" ]; then \
|
@if [ -z "$(NUM)" ]; then \
|
||||||
echo "❌ Please specify issue number: make start-issue NUM=1"; \
|
echo "❌ Please specify issue number: make start-issue NUM=1"; \
|
||||||
exit 1; \
|
exit 1; \
|
||||||
fi
|
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 to current issue workspace
|
||||||
add-test:
|
add-test: $(VENV)/bin/activate
|
||||||
@python3 tddai_cli.py add-test
|
@PYTHONPATH=. $(VENV_PYTHON) tddai_cli.py add-test
|
||||||
|
|
||||||
# Show current workspace status
|
# Show current workspace status
|
||||||
workspace-status:
|
workspace-status: $(VENV)/bin/activate
|
||||||
@python3 tddai_cli.py workspace-status
|
@PYTHONPATH=. $(VENV_PYTHON) tddai_cli.py workspace-status
|
||||||
|
|
||||||
# Complete issue work (move tests to main and cleanup)
|
# Complete issue work (move tests to main and cleanup)
|
||||||
finish-issue:
|
finish-issue: $(VENV)/bin/activate
|
||||||
@python3 tddai_cli.py finish-issue
|
@PYTHONPATH=. $(VENV_PYTHON) tddai_cli.py finish-issue
|
||||||
|
|||||||
Reference in New Issue
Block a user