From 84161e77a94b52570d8b601f732ab746660437c1 Mon Sep 17 00:00:00 2001 From: Bernd Worsch Date: Mon, 22 Sep 2025 02:07:05 +0200 Subject: [PATCH] fix: update Makefile targets to use venv Python with PYTHONPATH MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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 --- Makefile | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/Makefile b/Makefile index 828b8837..9d06b8d6 100644 --- a/Makefile +++ b/Makefile @@ -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