mirror of
https://github.com/valitydev/grafanalib.git
synced 2024-11-06 02:05:19 +00:00
Generate test coverage report in CI (#111)
Fail if our test coverage goes down.
This commit is contained in:
parent
d5151b78b9
commit
0679cea91c
5
.coveragerc
Normal file
5
.coveragerc
Normal file
@ -0,0 +1,5 @@
|
||||
[run]
|
||||
branch = True
|
||||
include =
|
||||
grafanalib/*.py
|
||||
grafanalib/**/*.py
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -9,3 +9,4 @@ dist/
|
||||
/.cache
|
||||
.ensure-*
|
||||
/.tox
|
||||
/.coverage
|
||||
|
7
Makefile
7
Makefile
@ -1,4 +1,4 @@
|
||||
.PHONY: all clean clean-deps lint test deps
|
||||
.PHONY: all clean clean-deps lint test deps coverage
|
||||
.DEFAULT_GOAL := all
|
||||
|
||||
# Boiler plate for bulding Docker containers.
|
||||
@ -51,7 +51,7 @@ endif
|
||||
images:
|
||||
$(info $(IMAGE_NAMES))
|
||||
|
||||
all: $(UPTODATE_FILES) test lint
|
||||
all: $(UPTODATE_FILES) test lint coverage
|
||||
|
||||
deps: setup.py .ensure-tox tox.ini
|
||||
|
||||
@ -65,6 +65,9 @@ lint: .ensure-flake8
|
||||
test: .ensure-tox
|
||||
$(TOX) --skip-missing-interpreters
|
||||
|
||||
coverage:
|
||||
$(TOX) -e coverage
|
||||
|
||||
clean:
|
||||
$(SUDO) docker rmi $(IMAGE_NAMES) >/dev/null 2>&1 || true
|
||||
rm -rf $(UPTODATE_FILES)
|
||||
|
10
tox.ini
10
tox.ini
@ -10,3 +10,13 @@ envlist = py27, py34, py35, py36
|
||||
commands = pytest --junitxml=junit-{envname}.xml
|
||||
deps =
|
||||
pytest
|
||||
|
||||
[testenv:coverage]
|
||||
deps =
|
||||
coverage
|
||||
pytest
|
||||
commands =
|
||||
python -m coverage run --rcfile=.coveragerc -m pytest --strict --maxfail=1 --ff {posargs}
|
||||
# Had 88% test coverage at time of introducing coverage ratchet.
|
||||
# This number must only go up.
|
||||
python -m coverage report --rcfile=.coveragerc --show-missing --fail-under=88
|
||||
|
Loading…
Reference in New Issue
Block a user