-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
55 lines (44 loc) · 1.32 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
51
52
53
54
55
SHELL := /bin/bash
.PHONY: all clean
# Define the Python interpreter
PYTHON = python3
# Define the test commands
TEST_CMD = $(PYTHON) -m unittest discover -p 'test_*.py'
COVERAGE_CMD = poetry run coverage run --source=. -m unittest discover -p 'test_*.py'
COVERAGE_REPORT_CMD = poetry run coverage report -m
COVERAGE_XML_CMD = poetry run coverage xml
COVERAGE_HTML_CMD = poetry run coverage html
help:
@$(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | sort | egrep -v -e '^[^[:alnum:]]' -e '^$@$$'
compile:
jupyter nbconvert --to script example.ipynb
profile:
pyinstrument example.py
# Default target
.PHONY: test
test:
$(TEST_CMD)
# Target to run tests with verbose output
.PHONY: test_verbose
test_verbose:
$(TEST_CMD) -v
# Target to run tests with coverage report
.PHONY: test_coverage
test_coverage:
$(COVERAGE_CMD)
$(COVERAGE_REPORT_CMD)
# Clean up coverage files
.PHONY: clean
clean:
find . | grep -E "(__pycache__|\.pyc$)" | xargs rm -rf
rm -rf .coverage*
# Run all tests and generate HTML coverage report
.PHONY: test_html_report
test_html_report:
$(COVERAGE_CMD)
$(COVERAGE_HTML_CMD)
# Run all tests and generate XML coverage report
.PHONY: test_xml_report
test_xml_report:
$(COVERAGE_CMD)
$(COVERAGE_XML_CMD)