From 058057a228d733f0db9f16b8fd60ec0d7ba977f1 Mon Sep 17 00:00:00 2001 From: Jack Viljoen Date: Tue, 26 Nov 2019 11:46:53 +0200 Subject: [PATCH] Add coverage commands to tox & Makefile --- Makefile | 17 ++++++++++++++++- requirements-dev.txt | 1 + tox.ini | 17 ++++++++++++++++- 3 files changed, 33 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 6579dee..b9d18b6 100644 --- a/Makefile +++ b/Makefile @@ -1,15 +1,18 @@ -.PHONY: help clean clean-pyc clean-build lint test test-all build upload +.PHONY: help clean clean-all clean-pyc clean-build clean-caches lint test coverage test-all build upload help: @echo "clean - remove Python file & build artifacts" @echo "lint - run linters to check the code style and formatting" @echo "test - run tests with the default Python" + @echo "coverage - generate test coverage report with the default Python" @echo "test-all - run tests in multiple environments" @echo "build - package" @echo "upload - release package to PyPI" clean: clean-build clean-pyc +clean-all: clean clean-caches + clean-build: rm -fr build/ rm -fr dist/ @@ -22,6 +25,13 @@ clean-pyc: find . -name __pycache__ -type d -exec rmdir {} + rm -fr .cache/ +clean-caches: + rm -fr .eggs/ + rm -fr .hypothesis/ + rm -fr .pytest_cache/ + rm -fr .tox/ + rm -fr htmlcov/ + lint: flake8 lttb tests black --check . @@ -29,6 +39,11 @@ lint: test: pytest -n 2 +coverage: + coverage run -m pytest + coverage html + coverage erase + test-all: PYENV_VERSION="" tox -p 2 diff --git a/requirements-dev.txt b/requirements-dev.txt index 49f948d..1a0fca8 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,4 +1,5 @@ black +coverage flake8 flake8-bugbear hypothesis[numpy] diff --git a/tox.ini b/tox.ini index cf8a47a..f6f7314 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py27, py35, py38 +envlist = py27, py35, py38, coverage [testenv] deps = @@ -11,6 +11,21 @@ deps = commands = pytest +[testenv:coverage] +deps = + pytest + coverage + hypothesis + +commands = + coverage run -m pytest + coverage report + coverage erase + +[coverage:run] +branch = true +source = lttb + [flake8] max-line-length = 80 select = C,E,F,W,B,B950 -- 2.45.2