-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
58 lines (43 loc) · 1.87 KB
/
Makefile
File metadata and controls
58 lines (43 loc) · 1.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
SHELL := /usr/bin/env bash
# Python and Docker settings
VENV := .venv
# Use venv if it exists, otherwise use system python
PYTHON := $(if $(wildcard $(VENV)/bin/python),$(VENV)/bin/python,python3)
PIP := $(if $(wildcard $(VENV)/bin/pip),$(VENV)/bin/pip,pip3)
DOCKER_IMAGE := test-gmnx
DOCKER_TAG := latest
# Test settings
TEST_DIR := tests
COVERAGE_DIR := htmlcov
.PHONY: help test test-unit test-docker test-all clean install-deps build test-coverage
help: ## Show this help message
@echo "Available targets:"
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-15s\033[0m %s\n", $$1, $$2}'
install-deps: ## Install Python dependencies
@if [ ! -d "$(VENV)" ]; then python3 -m venv $(VENV); fi
$(PIP) install -r requirements.txt
build: ## Build Docker image for testing
docker build -t $(DOCKER_IMAGE):$(DOCKER_TAG) .
test-unit: ## Run unit tests only
$(PYTHON) -m pytest $(TEST_DIR)/test_ask.py -v
test-docker: build ## Run Docker container tests
$(PYTHON) -m pytest $(TEST_DIR)/test_docker.py -v
test: ## Run all tests
$(PYTHON) -m pytest $(TEST_DIR)/ -v
test-coverage: ## Run tests with coverage report
$(PYTHON) -m pytest $(TEST_DIR)/ --cov=. --cov-report=html --cov-report=term
@echo "Coverage report generated in $(COVERAGE_DIR)/index.html"
test-all: test test-coverage ## Run all tests with coverage
clean: ## Clean up test artifacts
rm -rf $(COVERAGE_DIR)
rm -rf .pytest_cache
rm -rf __pycache__
rm -rf .coverage
docker rmi $(DOCKER_IMAGE):$(DOCKER_TAG) 2>/dev/null || true
# Quick test commands for development
quick-test: ## Quick test without Docker (unit tests only)
$(PYTHON) -m pytest $(TEST_DIR)/test_ask.py -v --tb=short
lint: ## Run basic linting
$(PYTHON) -m flake8 ask.py tests/ --max-line-length=100 --ignore=E501,W503
format: ## Format code with black
$(PYTHON) -m black ask.py tests/ --line-length=100