forked from mindsdb/mindsdb
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
90 lines (74 loc) · 3.3 KB
/
Makefile
File metadata and controls
90 lines (74 loc) · 3.3 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
PYTEST_ARGS = -v -rs --disable-warnings -n auto --dist loadfile
PYTEST_ARGS_DEBUG = --runslow -vs -rs
DSI_PYTEST_ARGS = --run-dsi-tests
DSI_REPORT_ARGS = --json-report --json-report-file=reports/report.json
SHELL := /usr/bin/env bash
install_mindsdb:
pip install -e .
pip install -r requirements/requirements-dev.txt
pre-commit install
install_handler:
@if [[ -n "$(HANDLER_NAME)" ]]; then\
pip install -e .[$(HANDLER_NAME)];\
else\
echo 'Please set $$HANDLER_NAME to the handler to install.';\
fi
precommit:
pre-commit install
pre-commit run --files $$(git diff --cached --name-only)
format:
pre-commit run --hook-stage manual
run_mindsdb:
python -m mindsdb
check:
python tests/scripts/check_requirements.py
python tests/scripts/check_print_statements.py
pre-commit install
pre-commit run --files $$(git diff --cached --name-only)
build_docker:
docker buildx build -t mdb --load -f docker/mindsdb.Dockerfile .
run_docker: build_docker
docker run -it -p 47334:47334 mdb
integration_tests:
pytest $(PYTEST_ARGS) tests/integration/ -k "not test_auth"
pytest $(PYTEST_ARGS) tests/integration/ -k test_auth # Run this test separately because it alters the auth requirements, which breaks other tests
integration_tests_slow:
pytest --runslow $(PYTEST_ARGS) tests/integration/ -k "not test_auth"
pytest --runslow $(PYTEST_ARGS) tests/integration/ -k test_auth
integration_tests_debug:
pytest $(PYTEST_ARGS_DEBUG) tests/integration/
datasource_integration_tests:
@echo "--- Running Datasource Integration (DSI) Tests ---"
# Ensure the reports directory exists before running tests
mkdir -p reports
# Added DSI_REPORT_ARGS to generate JSON report
pytest $(PYTEST_ARGS) $(DSI_PYTEST_ARGS) $(DSI_REPORT_ARGS) tests/integration/handlers/
datasource_integration_tests_debug:
@echo "--- Running Datasource Integration (DSI) Tests (Debug) ---"
mkdir -p reports
pytest $(PYTEST_ARGS_DEBUG) $(DSI_PYTEST_ARGS) $(DSI_REPORT_ARGS) tests/integration/handlers/
unit_tests:
# We have to run executor tests separately because they do weird things that break everything else
env PYTHONPATH=./ pytest $(PYTEST_ARGS) tests/unit/executor/
@set -o pipefail; \
mkdir -p reports; \
COVERAGE_FILE=.coverage.unit PYTHONPATH=./ pytest $(PYTEST_ARGS) --ignore=tests/unit/executor tests/unit/ \
--junitxml=pytest.xml \
--cov=mindsdb \
--cov-report=term \
--cov-report=xml:coverage.xml \
--cov-branch | tee pytest-coverage.txt
unit_tests_slow:
env PYTHONPATH=./ pytest --runslow $(PYTEST_ARGS) tests/unit/executor/ # We have to run executor tests separately because they do weird things that break everything else
@set -o pipefail; \
mkdir -p reports; \
COVERAGE_FILE=.coverage.unit PYTHONPATH=./ pytest --runslow $(PYTEST_ARGS) --ignore=tests/unit/executor tests/unit/ \
--junitxml=pytest.xml \
--cov=mindsdb \
--cov-report=term \
--cov-report=xml:coverage.xml \
--cov-branch | tee pytest-coverage.txt
unit_tests_debug:
env PYTHONPATH=./ pytest $(PYTEST_ARGS_DEBUG) tests/unit/executor/
pytest $(PYTEST_ARGS_DEBUG) --ignore=tests/unit/executor tests/unit/
.PHONY: install_mindsdb install_handler precommit format run_mindsdb check build_docker run_docker integration_tests integration_tests_slow integration_tests_debug datasource_integration_tests datasource_integration_tests_debug unit_tests unit_tests_slow unit_tests_debug