-
Notifications
You must be signed in to change notification settings - Fork 10
/
Makefile
50 lines (38 loc) · 1 KB
/
Makefile
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
OS := $(shell uname -s)
ifeq ($(OS), Linux)
NPROCS := $(shell grep -c ^processor /proc/cpuinfo)
else ifeq ($(OS), Darwin)
NPROCS := 2
else
NPROCS := 0
endif # $(OS)
ifeq ($(NPROCS), 2)
CONCURRENCY := 2
else ifeq ($(NPROCS), 1)
CONCURRENCY := 1
else ifeq ($(NPROCS), 3)
CONCURRENCY := 3
else ifeq ($(NPROCS), 0)
CONCURRENCY := 0
else
CONCURRENCY := $(shell echo "$(NPROCS) 2" | awk '{printf "%.0f", $$1 / $$2}')
endif
.PHONY: lint style black test test_ci coverage clean
all_check: style lint
lint:
pylint -rn qopt_best_practices test
black:
python -m black qopt_best_practices test
style:
python -m black --check qopt_best_practices test
test:
python -m unittest discover -v test
test_ci:
echo "Detected $(NPROCS) CPUs running with $(CONCURRENCY) workers"
python -m stestr run --concurrency $(CONCURRENCY)
coverage:
python -m coverage3 run --source qopt_best_practices -m unittest discover -s test -q
python -m coverage3 report
coverage_erase:
python -m coverage erase
clean: coverage_erase;