Files

51 lines
1.0 KiB
Makefile
Raw Permalink Normal View History

2019-08-08 02:49:05 +02:00
.PHONY: standard-tests vendor-tests
2019-08-08 09:42:49 +08:00
PY_VERSION=$(shell python -c "import sys; print('%d.%d'% sys.version_info[0:2])")
VALID=$(shell python -c "print($(PY_VERSION) >= 3.6)")
ifeq ($(OS),Windows_NT)
BIN=venv/Scripts
else
2019-08-09 00:02:29 +02:00
BIN=venv/bin
2019-08-08 09:42:49 +08:00
endif
ifeq (True,$(VALID))
PYTHON=python
else
PYTHON=python3
endif
2019-08-08 02:49:05 +02:00
standard-tests: venv
2019-08-08 09:42:49 +08:00
$(BIN)/pytest tests/standard
2019-08-08 02:49:05 +02:00
vendor-tests: venv
2019-08-08 09:42:49 +08:00
$(BIN)/pytest tests/vendor
2019-08-08 02:49:05 +02:00
# setup development environment
venv:
2019-08-08 09:42:49 +08:00
$(PYTHON) -m venv venv
2019-08-09 11:52:17 +08:00
$(BIN)/python -m pip install -U pip
2019-08-08 09:42:49 +08:00
$(BIN)/pip install -U -r requirements.txt
$(BIN)/pip install -U -r dev-requirements.txt
2019-08-09 00:02:29 +02:00
$(BIN)/pre-commit install
2019-08-08 02:49:05 +02:00
# re-run if dependencies change
update:
2019-08-09 11:52:17 +08:00
$(BIN)/python -m pip install -U pip
2019-08-08 09:42:49 +08:00
$(BIN)/pip install -U -r requirements.txt
$(BIN)/pip install -U -r dev-requirements.txt
2019-08-08 03:05:15 +02:00
# ensure this passes before commiting
check:
2019-08-08 09:42:49 +08:00
$(BIN)/black --check tests/
2019-08-13 22:48:54 +02:00
$(BIN)/isort --check-only --recursive tests/
2019-08-08 03:05:15 +02:00
# automatic code fixes
2019-08-13 22:48:54 +02:00
fix: black isort
2019-08-08 03:05:15 +02:00
black:
2019-08-08 09:42:49 +08:00
$(BIN)/black tests/
2019-08-13 22:40:20 +02:00
isort:
$(BIN)/isort -y --recursive tests/