diff --git a/.coveragerc b/.coveragerc new file mode 100644 index 0000000000000000000000000000000000000000..67737dcbf8ba279d8035d605a1dd71b071003611 --- /dev/null +++ b/.coveragerc @@ -0,0 +1,2 @@ +[run] +source = ./lib diff --git a/.gitignore b/.gitignore index ff6d4d92505a4bebe2b4fd32dea9d5f4c495f1a6..781c24927e26726292fd28275d50c22cc0d3ba18 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ !.gitignore .directory +.coverage *~ *.aux *.log diff --git a/Makefile b/Makefile index 57e986ce6113d033c6529aeb158287833ad22954..54c38f537120e5956b0a825d5e738cbadf25f20f 100644 --- a/Makefile +++ b/Makefile @@ -41,6 +41,7 @@ VENV_PATH ?= venv PYTHON = python3 PIP = pip NOSETESTS = nosetests +COVERAGE = coverage TWINE = twine PYBABEL = pybabel @@ -149,6 +150,7 @@ help: @echo " * $(GREEN)pyflakes$(NC): check project with pyflakes" @echo " * $(GREEN)pylint$(NC): check project with pylint" @echo " * $(GREEN)test$(NC): run unit tests with nosetest" + @echo " * $(GREEN)coverage$(NC): check test code coverage with nosetest and coverage" @echo "" @echo " * $(GREEN)build-webui$(NC): setup web interface locally" @echo " * $(GREEN)build-package-whl$(NC): actually generate Python package" @@ -499,7 +501,7 @@ cpybabel-compile: FORCE $(PYBABEL) compile -d $${class}translations; \ done -#\ +#\ # Alternative solution that uses the hawat-cli utility: # APP_ROOT_PATH=$(shell realpath ./chroot) hawat-cli intl init $(INIT_LOCALE) # @@ -593,6 +595,11 @@ test: @echo "Python version: `$(PYTHON) --version`" APP_ROOT_PATH=$(shell realpath ./chroot) PYTHONPATH=$(DIR_LIB) $(NOSETESTS) +coverage: + @echo "\n$(GREEN)*** Checking test code coverage with nosetests and coverage ***$(NC)\n" + @echo "Python version: `$(PYTHON) --version`" + APP_ROOT_PATH=$(shell realpath ./chroot) PYTHONPATH=$(DIR_LIB) $(COVERAGE) run -m nose + #------------------------------------------------------------------------------- diff --git a/conf/requirements-dev.pip b/conf/requirements-dev.pip index edfbacdb7260fe360050a1b767b163608bdda7b4..21e43387f24228d25549069b7a738ec34546feef 100644 --- a/conf/requirements-dev.pip +++ b/conf/requirements-dev.pip @@ -1,6 +1,7 @@ setuptools==41.6.0 wheel==0.33.6 nose==1.3.7 +coverage==5.0.3 pyflakes==2.1.1 pylint==2.4.3 sphinx==2.2.1 diff --git a/conf/requirements-latest-dev.pip b/conf/requirements-latest-dev.pip index b96ad76ccd3843b3d37ad49e5d63e4f7bc9a8b20..45d3952771089153e735e771fa1ca1d7a7bd565a 100644 --- a/conf/requirements-latest-dev.pip +++ b/conf/requirements-latest-dev.pip @@ -1,6 +1,7 @@ setuptools wheel nose +coverage pyflakes pylint sphinx