From 9692c4709e2f4c81e2f761f07191bc7dc8f41e56 Mon Sep 17 00:00:00 2001 From: Stephen Shirley Date: Wed, 26 Aug 2015 10:26:00 +0200 Subject: [PATCH] Only print coverage report to console on success. This makes it much easier to see errors when they happen. Also: - Make ./scion.sh test and ./scion.sh coverage work with test filenames directly. E.g., this now works: ./scion.sh coverage test/lib_zookeeper_test.py - Cleaned up .gitignore a bit, making patterns anchored at the root of the repository when applicable (as this was hiding some issues). --- .coveragerc | 5 +++++ .gitignore | 21 ++++++++++----------- scion.sh | 6 +++--- 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/.coveragerc b/.coveragerc index 7db2340d26..0748006235 100644 --- a/.coveragerc +++ b/.coveragerc @@ -3,3 +3,8 @@ exclude_lines = pragma: no cover def __repr__ def __str__ + raise NotImplementedError +[run] +omit = external/* +[html] +title = SCION unit test coverage diff --git a/.gitignore b/.gitignore index 6309fc95ab..5bcb5e8bb4 100644 --- a/.gitignore +++ b/.gitignore @@ -26,11 +26,10 @@ Thumbs.db # SCION generated files # ######################### -logs/* -topology/ISD* -topology/SIM -topology/conf-gen -traces/* +/logs/ +/topology/ISD*/ +/topology/SIM/ +/traces/ # Python generated files # @@ -45,19 +44,19 @@ __pycache__ # Crypto library generated files # ######################### -lib/crypto/python-tweetnacl-20140309/build/ +/lib/crypto/python-tweetnacl-20140309/build/ # Documentation and Environment files ######################### -sphinx-doc/_build/ -venv/ +/sphinx-doc/_build/ +/venv/ # Docker working directory ########################## -docker/_build/ +/docker/_build/ # Test coverage ########################## -.coverage -htmlcov/ +/.coverage +/htmlcov/ diff --git a/scion.sh b/scion.sh index 551a10d6fd..8d20c97a9a 100755 --- a/scion.sh +++ b/scion.sh @@ -42,13 +42,13 @@ cmd_status() { } cmd_test(){ - PYTHONPATH=. nosetests -w test "$@" + PYTHONPATH=. nosetests "$@" } cmd_coverage(){ set -e - PYTHONPATH=. nosetests --with-cov -w test "$@" - coverage html --omit 'external/*' + PYTHONPATH=. nosetests --with-cov --cov-report html "$@" + coverage report echo "Coverage report here: file://$PWD/htmlcov/index.html" }