| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
PACKAGE=forbiddenfruit |
| 9 |
CUSTOM_PIP_INDEX= |
| 10 |
export FFRUIT_EXTENSION=true |
| 11 |
|
| 12 |
|
| 13 |
all: unit functional integration |
| 14 |
|
| 15 |
unit: |
| 16 |
@make run_test suite=unit |
| 17 |
|
| 18 |
functional: |
| 19 |
@make run_test suite=functional |
| 20 |
|
| 21 |
integration: |
| 22 |
@make run_test suite=integration |
| 23 |
|
| 24 |
run_test: |
| 25 |
@if [ -d tests/$(suite) ]; then \ |
| 26 |
echo "Running \033[0;32m$(suite)\033[0m test suite"; \ |
| 27 |
make prepare; \ |
| •28 |
pytest --cov=$(PACKAGE) -vv tests/$(suite) ; \ |
| 29 |
fi |
| 30 |
|
| 31 |
prepare: clean install_deps build_test_stub |
| 32 |
|
| 33 |
install_deps: |
| 34 |
@if [ -z $$SKIP_DEPS ]; then \ |
| 35 |
echo "Installing missing dependencies..."; \ |
| 36 |
[ -e requirements.txt ] && pip install -r requirements.txt &> .build.log; \ |
| 37 |
[ -e development.txt ] && pip install -r development.txt &> .build.log; \ |
| 38 |
fi |
| 39 |
|
| 40 |
build_test_stub: |
| 41 |
@python setup.py build |
| 42 |
@find ./build -name '*.so' -exec mv {} tests/unit \; |
| 43 |
|
| 44 |
clean: |
| 45 |
@echo "Removing garbage..." |
| 46 |
@find . -name '*.pyc' -delete |
| 47 |
@find . -name '*.so' -delete |
| 48 |
@find . -name __pycache__ -delete |
| 49 |
@rm -rf .coverage *.egg-info *.log build dist MANIFEST |
| 50 |
|
| 51 |
publish: |
| 52 |
@if [ -e "$$HOME/.pypirc" ]; then \ |
| 53 |
echo "Uploading to '$(CUSTOM_PIP_INDEX)'"; \ |
| 54 |
python setup.py sdist upload -r "$(CUSTOM_PIP_INDEX)"; \ |
| 55 |
else \ |
| 56 |
echo "You should create a file called \`.pypirc' under your home dir.\n"; \ |
| 57 |
echo "That's the right place to configure \`pypi' repos.\n"; \ |
| 58 |
echo "Read more about it here: https://github.com/Yipit/yipit/blob/dev/docs/rfc/RFC00007-python-packages.md"; \ |
| 59 |
exit 1; \ |
| 60 |
fi |