Skip to content

Instantly share code, notes, and snippets.

@dimitrov
Created June 18, 2013 20:03
Show Gist options
  • Save dimitrov/5808780 to your computer and use it in GitHub Desktop.
Save dimitrov/5808780 to your computer and use it in GitHub Desktop.
An example Makefile for a python project
PACKAGE=mypackage
MIN_COVERAGE=90
# NOTE: Be careful, rm -rf will be called on this!
COVERAGE_HTML_DIR=coverage/
VERBOSITY=2
.PHONY: all dev install test coverage clean
all: test
dev:
pip install -r requirements.txt
python setup.py develop
install:
python setup.py install
test:
nosetests --verbosity=$(VERBOSITY)
coverage:
nosetests --verbosity=$(VERBOSITY) \
--with-coverage \
--cover-erase \
--cover-package=$(PACKAGE) \
--cover-html \
--cover-html-dir=$(COVERAGE_HTML_DIR) \
--cover-min-percentage=$(MIN_COVERAGE)
@echo
@echo "Coverage report: file://`pwd`/$(COVERAGE_HTML_DIR)index.html"
clean:
find . -type f -name '*.pyc' -delete
find . -type f -name '*.pyo' -delete
find . -type f -name '*~' -delete
find . -type f -name '.coverage' -delete
rm -rf $(COVERAGE_HTML_DIR)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment