Measure coverage for parallel processes
This commit is contained in:
parent
af8c193b52
commit
91cebe7b67
@ -1,4 +1,11 @@
|
|||||||
# http://nedbatchelder.com/code/coverage/config.html
|
# http://nedbatchelder.com/code/coverage/config.html
|
||||||
|
[run]
|
||||||
|
concurrency = multiprocessing
|
||||||
|
parallel = True
|
||||||
|
branch = True
|
||||||
|
|
||||||
|
[report]
|
||||||
|
include = src/*
|
||||||
|
|
||||||
[paths]
|
[paths]
|
||||||
source = .
|
source = .
|
||||||
|
12
Makefile
12
Makefile
@ -5,6 +5,8 @@ PKGNAME = lorax
|
|||||||
VERSION = $(shell awk '/Version:/ { print $$2 }' $(PKGNAME).spec)
|
VERSION = $(shell awk '/Version:/ { print $$2 }' $(PKGNAME).spec)
|
||||||
RELEASE = $(shell awk '/Release:/ { print $$2 }' $(PKGNAME).spec | sed -e 's|%.*$$||g')
|
RELEASE = $(shell awk '/Release:/ { print $$2 }' $(PKGNAME).spec | sed -e 's|%.*$$||g')
|
||||||
TAG = lorax-$(VERSION)-$(RELEASE)
|
TAG = lorax-$(VERSION)-$(RELEASE)
|
||||||
|
PW_DIR ?= $(shell pwd)
|
||||||
|
USER_SITE_PACKAGES ?= $(shell sudo $(PYTHON) -m site --user-site)
|
||||||
|
|
||||||
|
|
||||||
default: all
|
default: all
|
||||||
@ -28,11 +30,13 @@ check:
|
|||||||
# /api/docs/ tests require we have the documentation already built
|
# /api/docs/ tests require we have the documentation already built
|
||||||
test: docs
|
test: docs
|
||||||
@echo "*** Running tests ***"
|
@echo "*** Running tests ***"
|
||||||
sudo PYTHONPATH=$(PYTHONPATH):./src/ $(PYTHON) -m nose -v --with-coverage --cover-erase --cover-branches \
|
sudo mkdir -p $(USER_SITE_PACKAGES)
|
||||||
--cover-package=pylorax --cover-inclusive \
|
sudo cp ./tests/usercustomize.py $(USER_SITE_PACKAGES)
|
||||||
./src/pylorax/ ./tests/pylorax/
|
sudo COVERAGE_PROCESS_START=$(PW_DIR)/.coveragerc PYTHONPATH=$(PYTHONPATH):./src/ \
|
||||||
|
$(PYTHON) -m nose -v ./src/pylorax/ ./tests/pylorax/
|
||||||
|
sudo rm -rf $(USER_SITE_PACKAGES)
|
||||||
|
|
||||||
|
coverage combine
|
||||||
coverage report -m
|
coverage report -m
|
||||||
[ -f "/usr/bin/coveralls" ] && [ -n "$(COVERALLS_REPO_TOKEN)" ] && coveralls || echo
|
[ -f "/usr/bin/coveralls" ] && [ -n "$(COVERALLS_REPO_TOKEN)" ] && coveralls || echo
|
||||||
|
|
||||||
|
8
tests/usercustomize.py
Normal file
8
tests/usercustomize.py
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
# Enable Python coverage for subprocesses. See:
|
||||||
|
# http://nedbatchelder.com/code/coverage/subprocess.html
|
||||||
|
|
||||||
|
try:
|
||||||
|
import coverage
|
||||||
|
coverage.process_startup()
|
||||||
|
except ImportError:
|
||||||
|
pass
|
Loading…
Reference in New Issue
Block a user