Use pytest in the Makefile

This commit is contained in:
filipstrand 2024-10-10 00:00:32 +02:00
parent 78e2b726fb
commit e8edac5287

View File

@ -2,6 +2,7 @@
PYTHON_VERSION = 3.11 PYTHON_VERSION = 3.11
VENV_DIR = .venv VENV_DIR = .venv
PYTHON = $(VENV_DIR)/bin/python
# Default target # Default target
.PHONY: all .PHONY: all
@ -39,6 +40,14 @@ ensure-ruff:
uv tool install ruff; \ uv tool install ruff; \
fi fi
# ensure pytest is available
.PHONY: ensure-pytest
ensure-pytest:
@if ! $(PYTHON) -c "import pytest" 2>/dev/null; then \
echo "pytest required for testing. Installing pytest..."; \
uv pip install pytest; \
fi
# Create virtual environment with uv # Create virtual environment with uv
.PHONY: venv-init .PHONY: venv-init
venv-init: expect-arm64 expect-uv venv-init: expect-arm64 expect-uv
@ -81,10 +90,9 @@ check: ensure-ruff
# Run tests # Run tests
.PHONY: test .PHONY: test
test: test: ensure-pytest
# 🏗️ Running tests... # 🏗️ Running tests...
# mock success stub for future test suite 😜 $(PYTHON) -m pytest
@true
# ✅ Tests completed # ✅ Tests completed
# Clean up # Clean up