-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
98 lines (86 loc) · 3.09 KB
/
Makefile
File metadata and controls
98 lines (86 loc) · 3.09 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
.PHONY: check coverage tox all test-cluster test-cluster-all test-cluster-3.10 test-cluster-3.11 test-cluster-3.12 test-cluster-3.13 test-cluster-3.14
SHELL := /bin/bash
help:
@echo "Available targets:"
@echo " check - Run code quality checks (sort, format, lint, mypy)"
@echo " coverage - Run tests with coverage report"
@echo " tox - Run all tests across multiple Python versions"
@echo " test - Run tests with default Python version"
@echo " test-3.10 - Run tests with Python 3.10"
@echo " test-3.11 - Run tests with Python 3.11"
@echo " test-3.12 - Run tests with Python 3.12"
@echo " test-3.13 - Run tests with Python 3.13"
@echo " test-3.14 - Run tests with Python 3.14"
@echo " test-cluster - Run cluster tests with default Python version"
@echo " test-cluster-3.10 - Run cluster tests with Python 3.10"
@echo " test-cluster-3.11 - Run cluster tests with Python 3.11"
@echo " test-cluster-3.12 - Run cluster tests with Python 3.12"
@echo " test-cluster-3.13 - Run cluster tests with Python 3.13"
@echo " test-cluster-3.14 - Run cluster tests with Python 3.14"
@echo " test-cluster-all - Run all cluster tests across multiple Python versions"
@echo " all - Run all checks and tests"
run_test = \
echo "======= TEST $(1) ======="; \
deactivate; \
source $(2)/bin/activate; \
docker compose down; \
docker compose up -d; \
sleep 15; \
pytest; \
docker compose down
run_cluster_test = \
echo "======= CLUSTER TEST $(1) ======="; \
deactivate; \
source $(2)/bin/activate; \
docker compose down; \
docker compose up -d; \
sleep 15; \
pytest -m cluster tests/test_redis_cluster.py -v; \
docker compose down
test:
$(call run_test,3.9,.venv)
test-3.10:
$(call run_test,3.10,.venv-3.10)
test-3.11:
$(call run_test,3.11,.venv-3.11)
test-3.12:
$(call run_test,3.12,.venv-3.12)
test-3.13:
$(call run_test,3.13,.venv-3.13)
test-3.14:
$(call run_test,3.14,.venv-3.14)
tox: test test-3.10 test-3.11 test-3.12 test-3.13 test-3.14
# Cluster test targets
test-cluster:
$(call run_cluster_test,3.9,.venv)
test-cluster-3.10:
$(call run_cluster_test,3.10,.venv-3.10)
test-cluster-3.11:
$(call run_cluster_test,3.11,.venv-3.11)
test-cluster-3.12:
$(call run_cluster_test,3.12,.venv-3.12)
test-cluster-3.13:
$(call run_cluster_test,3.13,.venv-3.13)
test-cluster-3.14:
$(call run_cluster_test,3.14,.venv-3.14)
test-cluster-all: test-cluster test-cluster-3.10 test-cluster-3.11 test-cluster-3.12 test-cluster-3.13 test-cluster-3.14
check:
-@source .venv/bin/activate
@echo "======= SSORT ======="
@ssort ./call_gate
@echo "======= RUFF FORMAT ======="
@ruff format ./call_gate
@ruff format ./tests
@echo "======= RUFF LINT ======="
@ruff check ./call_gate --fix
@ruff check ./tests --fix
@echo "======= MYPY ======="
@mypy ./call_gate --install-types --non-interactive
coverage:
-@source .venv/bin/activate
docker compose down
docker compose up -d
sleep 15
pytest -m "not cluster" --cov=./call_gate --cov-branch --cov-report=xml --ignore=tests/test_asgi_wsgi.py --ignore=tests/cluster/ ./tests --retries=3
@echo "Find html report at ./tests/code_coverage/index.html"
all: check coverage tox