Skip to content

Commit

Permalink
Edits to code coverage setup
Browse files Browse the repository at this point in the history
  • Loading branch information
caleb-sitton-inl committed Jul 16, 2024
1 parent 091e927 commit ad2472d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
uses: actions/checkout@v3
- run: pwd
- run: WD=`(cd ../../.. && pwd)` && export RAVEN_LIBS_NAME="raven_libs_"`basename $WD` && ./initalize_tests.sh
- run: >
- run: > # The overhead time added by checking coverage is currently about 19-23%. Reducing the frequency of coverage checks may be preferable if this increases.
source raven/scripts/establish_conda_env.sh --load &&
./check_py_coverage.sh &&
COV_PCT=`coverage report --format=total` &&
Expand Down
14 changes: 6 additions & 8 deletions check_py_coverage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,20 +55,18 @@ DISPLAY_VAR=`(echo $DISPLAY)`
# reset it
export DISPLAY=

EXTRA="--rcfile=$SRC_DIR/../tests/.coveragerc --source=$SRC_DIR --parallel-mode"
export COVERAGE_RCFILE="$SRC_DIR/../tests/.coveragerc" # all coverage commands should automatically reference this file now
EXTRA="--source=$SRC_DIR --parallel-mode"
export COVERAGE_FILE=`pwd`/.coverage

coverage erase --rcfile="$SRC_DIR/../tests/.coveragerc"
($SRC_DIR/../run_tests "$@" --python-command="coverage run $EXTRA " || echo run_test done but some tests failed)
coverage erase
($SRC_DIR/../run_tests "$@" --python-command="coverage run $EXTRA " || echo run_tests done but some tests failed)

#get DISPLAY BACK
DISPLAY=$DISPLAY_VAR

## Go to the final directory and generate the html documents
cd $SCRIPT_DIR/tests/
## Prepare data and generate the html documents
pwd
rm -f .cov_dirs
for FILE in `find . -name '.coverage.*'`; do dirname $FILE; done | sort | uniq > .cov_dirs
coverage combine `cat .cov_dirs`
coverage combine
coverage html

10 changes: 6 additions & 4 deletions run_tests
Original file line number Diff line number Diff line change
Expand Up @@ -75,17 +75,19 @@ FAILED=()
echo
echo "********************************************************************************"
echo
echo 'Running FORCE tests ...'

case $TEST_SET in
0)
TEST_DIR=tests/unit_tests
TEST_DIR=$SCRIPT_DIR/tests/unit_tests
echo Running FORCE unit tests from $TEST_DIR directory ...
;;
1)
TEST_DIR=tests/integration_tests
TEST_DIR=$SCRIPT_DIR/tests/integration_tests
echo Running FORCE integration tests from $TEST_DIR directory ...
;;
2)
TEST_DIR=tests
TEST_DIR=$SCRIPT_DIR/tests
echo Running FORCE unit and integration tests from $TEST_DIR directory ...
;;
esac

Expand Down

0 comments on commit ad2472d

Please sign in to comment.