Last active
December 28, 2017 01:33
-
-
Save JoshRosen/60d590b1cdc271d332e5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[run] | |
branch = true | |
parallel = true | |
data_file = ${COVERAGE_DIR}/coverage_data/coverage | |
[html] | |
ignore_errors = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Note: case sensitivity can break things here. The path comparision in | |
# coverage is case-sensitive, so you need to be careful to use a properly | |
# normalized SPARK_HOME path if you're running on a case-insensitive filesystem | |
if [ -z "$SPARK_HOME" ]; then | |
echo "ERROR: SPARK_HOME must point to a Spark source checkout." | |
exit 1 | |
fi | |
# Ensure that coverage is installed for all of the Python versions that we're | |
# going to test against: | |
# | |
if [ $(which python2.6) ]; then | |
python2.6 -c "import coverage" || { echo 'must install coverage for python2.6' ; exit 1; } | |
fi | |
# TODO: include other python versions. We should really refactor the run-tests | |
# script to be paramterized by the Python version in order to make it easier to | |
# run all of the tests against just one version. | |
export COVERAGE_DIR="$(cd "`dirname "$0"`"; pwd)" | |
mkdir -p "$COVERAGE_DIR/coverage_data" | |
# So our siteconfig.py is included: | |
export PYTHONPATH="$(cd "`dirname "$0"`"; pwd):$PYTHONPATH" | |
export COVERAGE_PROCESS_START="$(cd "`dirname "$0"`"; pwd)/.coveragerc" | |
$SPARK_HOME/python/run-tests | |
# Don't run coverage for the coverage command itself | |
unset COVERAGE_PROCESS_START | |
coverage combine | |
coverage report --include "$SPARK_HOME/python/pyspark/*" | |
coverage html -i --include "$SPARK_HOME/python/pyspark/*" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import coverage | |
coverage.process_startup() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment