Skip to content

Instantly share code, notes, and snippets.

@techjacker
Created May 5, 2017 09:24
Show Gist options
  • Save techjacker/7946eabf5a63e44804ef3826ab361b49 to your computer and use it in GitHub Desktop.
Save techjacker/7946eabf5a63e44804ef3826ab361b49 to your computer and use it in GitHub Desktop.
Travis config for tests + coverage + linting
language: python
python:
- "3.6"
install:
- make deps
script:
- make lint
- make test
- make coverage
PYTHON = python3.6
INSTALL_OPTS = `$(PYTHON) -c "import sys; print('' if hasattr(sys, 'real_prefix') else '--user')"`
COVERAGE_MIN = 40
install:
$(PYTHON) -c "import setuptools"
$(PYTHON) setup.py install $(INSTALL_OPTS)
rm -rf tmp
uninstall:
cd ..; $(PYTHON) -m pip uninstall -y -v $(shell basename $(PWD))
name:
@echo $(shell basename $(PWD))
deps-update:
@pip install -r requirements-to-freeze.txt --upgrade
@pip freeze > requirements.txt
deps:
@pip install -r requirements.txt
@pre-commit install
clean:
@pip uninstall -yr requirements.txt
@pip freeze > requirements.txt
lint:
@pre-commit run \
--allow-unstaged-config \
--all-files \
--verbose
autopep8:
@autopep8 . --recursive --in-place --pep8-passes 2000 --verbose
autopep8-stats:
@pep8 --quiet --statistics .
test:
@pytest
coverage:
@pytest --cov-fail-under $(COVERAGE_MIN) --cov=$(shell basename $(PWD)) tests/
debug:
@pytest --pdb
.PHONY: install deps lint test* debug clean
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment