From 0daed7f1125eda8be9465f7a635e1e452d432d24 Mon Sep 17 00:00:00 2001 From: Jacques Joubert Date: Thu, 14 Feb 2019 17:16:15 +0200 Subject: [PATCH] Setup code coverage --- .travis.yml | 2 +- .coveragerc => scripts/.coveragerc | 0 scripts/c2 | 27 --------------------------- coverage => scripts/coverage | 6 +++--- 4 files changed, 4 insertions(+), 31 deletions(-) rename .coveragerc => scripts/.coveragerc (100%) delete mode 100644 scripts/c2 rename coverage => scripts/coverage (77%) diff --git a/.travis.yml b/.travis.yml index cbd8ea7ba..c585afaec 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,4 +15,4 @@ git: script: - python -m unittest discover - pylint mlfinlab --rcfile=.pylintrc -f text - - bash coverage \ No newline at end of file + - bash ./scripts/coverage \ No newline at end of file diff --git a/.coveragerc b/scripts/.coveragerc similarity index 100% rename from .coveragerc rename to scripts/.coveragerc diff --git a/scripts/c2 b/scripts/c2 deleted file mode 100644 index b7769bd03..000000000 --- a/scripts/c2 +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash -echo "----Running Code Coverage----" - -# Remove multiprocessing coverage files in case a previous combine wasn't performed -rm .coverage.* -rm -fR cover/ -# Remove the main coverage file (.coverage) -coverage erase - -# Discover and run all tests -coverage run --concurrency=multiprocessing ./scripts/run_tests.py discover -v - -coverage combine -res_combine=$? -if [ $res_combine -ne 0 ] -then - echo -e "Travis Build FAILURE: Coverage combine failed" - exit 1 -fi - -coverage report --fail-under=100 -coverage_report=$? -if [ $coverage_report -ne 0 ] -then - echo -e "Travis Build FAILURE: Coverage percentage failed" - exit 1 -fi diff --git a/coverage b/scripts/coverage similarity index 77% rename from coverage rename to scripts/coverage index 22e480327..188b0bf03 100755 --- a/coverage +++ b/scripts/coverage @@ -1,13 +1,13 @@ #!/bin/bash -# Note: To run specific modules for code coverage, run this command, e.g.: -# coverage run -m unittest mlfinlab.tests.unit.test_mod1 mlfinlab.tests.unit.test_mod2 +echo "----Running Code Coverage----" # Remove multiprocessing coverage files in case a previous combine wasn't performed rm .coverage.* rm -fR cover/ # Remove the main coverage file (.coverage) coverage erase + # Discover and run all tests coverage run --concurrency=multiprocessing ./scripts/run_tests.py discover -v @@ -25,4 +25,4 @@ if [ $coverage_report -ne 0 ] then echo -e "Travis Build FAILURE: Coverage percentage failed" exit 1 -fi +fi \ No newline at end of file