-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
68 lines (55 loc) · 1.89 KB
/
Makefile
File metadata and controls
68 lines (55 loc) · 1.89 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
59
60
61
62
63
64
65
66
67
68
.PHONY: test test-verbose test-coverage install-dev clean lint format type-check
# Python command (try python3 first, fallback to python)
PYTHON := $(shell command -v python3 2> /dev/null || echo python)
# Install development dependencies
install-dev:
$(PYTHON) -m pip install -e ".[dev]"
# Run tests (fallback to unittest if pytest not available)
test:
@if $(PYTHON) -c "import pytest" 2>/dev/null; then \
$(PYTHON) -m pytest; \
else \
echo "pytest not found, using unittest instead..."; \
$(PYTHON) -m unittest test_kee -v; \
fi
# Run tests with verbose output
test-verbose:
$(PYTHON) -m pytest -v
# Run tests with coverage
test-coverage:
$(PYTHON) -m pytest --cov=kee --cov-report=html --cov-report=term
# Run specific test
test-unit:
$(PYTHON) -m pytest -m unit
# Run unittest instead of pytest (fallback)
test-unittest:
$(PYTHON) -m unittest test_kee -v
# Run linting
lint:
$(PYTHON) -m flake8 kee.py test_kee.py --max-line-length=100 --ignore=E501,W503
# Format code
format:
$(PYTHON) -m black kee.py test_kee.py
# Type checking
type-check:
$(PYTHON) -m mypy kee.py --ignore-missing-imports
# Clean up
clean:
rm -rf __pycache__ .pytest_cache htmlcov .coverage *.egg-info build dist
# Run all checks
check: lint type-check test-unittest
# Help
help:
@echo "Available targets:"
@echo " install-dev - Install development dependencies"
@echo " test - Run tests with pytest"
@echo " test-unittest - Run tests with unittest (no extra deps)"
@echo " test-verbose - Run tests with verbose output"
@echo " test-coverage - Run tests with coverage report"
@echo " lint - Run linting"
@echo " format - Format code"
@echo " type-check - Run type checking"
@echo " clean - Clean up generated files"
@echo " check - Run all checks (lint, type-check, test)"
@echo ""
@echo "Python command being used: $(PYTHON)"