From 0812d203e5b79e8ff00c0fd894e4ff04c252c276 Mon Sep 17 00:00:00 2001 From: "Gerber, Mike" Date: Wed, 4 Dec 2019 16:50:08 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Add=20test=20targets=20back=20ag?= =?UTF-8?q?ain=3F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Makefile | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/Makefile b/Makefile index 5efbb2d..d184ff5 100644 --- a/Makefile +++ b/Makefile @@ -14,6 +14,12 @@ help: @echo " calamari Clone calamari repo" @echo " calamari_models Clone calamari_models repo" @echo " calamari/build pip install calamari" + @echo " deps-test Install testing python deps via pip + @echo " repo/assets Clone OCR-D/assets to ./repo/assets" + @echo " test/assets Setup test assets" + @echo " assets-clean Remove symlinks in test/assets" + @echo " test Run unit tests" + @echo " coverage Run unit tests and determine test coverage" @echo "" @echo " Variables" @echo "" @@ -40,3 +46,42 @@ calamari_models: # pip install calamari calamari/build: calamari calamari_models cd calamari && $(PIP_INSTALL) . + + +# +# Assets and Tests +# + +# Install testing python deps via pip +deps-test: + $(PIP) install -r requirements_test.txt + + +# Clone OCR-D/assets to ./repo/assets +repo/assets: + mkdir -p $(dir $@) + git clone https://github.com/OCR-D/assets "$@" + + +# Setup test assets +test/assets: repo/assets + mkdir -p $@ + cp -r -t $@ repo/assets/data/* + +# Remove symlinks in test/assets +assets-clean: + rm -rf test/assets + +# Run unit tests +test: test/assets calamari_models + # declare -p HTTP_PROXY + $(PYTHON) -m pytest --continue-on-collection-errors test $(PYTEST_ARGS) + +# Run unit tests and determine test coverage +coverage: test/assets calamari_models + coverage erase + make test PYTHON="coverage run" + coverage report + coverage html + +.PHONY: assets-clean test