11# saml2aws-multi Makefile - Unit Testing Focus
22# Provides targets for running unit tests locally
33
4- .PHONY : help test test-coverage clean install-test-deps yamllint build check-uv
4+ .PHONY : help test test-coverage clean clean-all install-test-deps yamllint build check-poetry setup-venv update-deps lock
55
66# Default target
77help : # # Show this help message
88 @echo " Available targets:"
99 @grep -E ' ^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST ) | sort | awk ' BEGIN {FS = ":.*?## "}; {printf " \033[36m%-20s\033[0m %s\n", $$1, $$2}'
1010
1111# Variables
12- UV := uv
13- PYTHON := $(UV ) run python
14- PIP := $(UV ) run pip
15- PYTEST := $(UV ) run pytest
16- BUILD := $(UV ) run python -m build
12+ POETRY := poetry
13+ PYTHON := $(POETRY ) run python
14+ PYTEST := $(POETRY ) run pytest
15+ BUILD := $(POETRY ) build
1716
18- # Check if uv is available, install if not
19- check-uv :
20- @which uv > /dev/null || (echo " Installing uv..." && pip install uv)
17+ # Check if poetry is available, install if not
18+ check-poetry :
19+ @which poetry > /dev/null || (echo " Installing Poetry..." && pip install --user poetry && echo " Poetry installed successfully!" )
20+
21+ # Configure Poetry to use project-local venv (run once)
22+ setup-venv : check-poetry # # Configure Poetry to use .venv in project directory
23+ @echo " Configuring Poetry for project-local virtualenv..."
24+ $(POETRY ) config virtualenvs.in-project true
25+ @echo " Poetry will now create .venv/ in the project directory"
26+ @echo " This isolates dependencies from your global Python environment"
2127
2228# Installation targets
23- install-test-deps : check-uv # # Install test dependencies
29+ install-test-deps : check-poetry # # Install test dependencies
2430 @echo " Installing test dependencies..."
25- $(PIP ) install -e " .[ test] "
31+ $(POETRY ) install --with test
2632 @echo " Dependencies installed."
2733
28- install-deps : check-uv # # Install project dependencies
34+ install-deps : check-poetry # # Install project dependencies
2935 @echo " Installing project dependencies..."
30- $(PIP ) install -e .
36+ $(POETRY ) install
3137 @echo " Dependencies installed."
3238
3339# Build targets
34- build : check-uv # # Build the package
40+ build : check-poetry # # Build the package
3541 @echo " Building package..."
3642 $(BUILD )
3743 @echo " Package built successfully."
3844
3945# Run targets (removed - awslogin is an interactive CLI tool)
4046
41-
4247# Testing targets
4348test : install-test-deps # # Run unit tests without coverage
4449 @echo " Running unit tests..."
@@ -52,6 +57,17 @@ test-coverage: install-test-deps ## Run unit tests with coverage reporting
5257yamllint : # # Run yamllint on GitHub workflow files
5358 yamllint -c .github/linters/.yaml-lint.yaml .github/
5459
60+ # Dependency management
61+ update-deps : check-poetry # # Update dependencies to latest compatible versions
62+ @echo " Updating dependencies..."
63+ $(POETRY ) update
64+ @echo " Dependencies updated in poetry.lock"
65+
66+ lock : check-poetry # # Regenerate poetry.lock from pyproject.toml
67+ @echo " Regenerating lock file..."
68+ $(POETRY ) lock --no-update
69+ @echo " Lock file regenerated"
70+
5571# Cleanup targets
5672clean : # # Clean test artifacts, build artifacts and temporary files
5773 rm -rf .coverage*
@@ -60,9 +76,17 @@ clean: ## Clean test artifacts, build artifacts and temporary files
6076 rm -rf htmlcov/
6177 rm -rf build/
6278 rm -rf dist/
79+ rm -rf eggs/
80+ rm -rf .eggs/
6381 rm -rf * .egg-info/
82+ rm -rf * .egg
83+ rm -rf .pytest_cache/
6484 find . -type d -name __pycache__ -exec rm -rf {} +
65- find . -type f -name " *.pyc" -delete
85+ find . -type f -name " *.py[cod]" -delete
86+
87+ clean-all : # # Clean everything including virtual environment
88+ $(MAKE ) clean
89+ rm -rf .venv/
6690
6791# Default target when no target is specified
6892.DEFAULT_GOAL := help
0 commit comments