Skip to content

Instantly share code, notes, and snippets.

@JoshRosen
Last active December 28, 2017 01:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save JoshRosen/60d590b1cdc271d332e5 to your computer and use it in GitHub Desktop.
Save JoshRosen/60d590b1cdc271d332e5 to your computer and use it in GitHub Desktop.
[run]
branch = true
parallel = true
data_file = ${COVERAGE_DIR}/coverage_data/coverage
[html]
ignore_errors = true
#!/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/*"
import coverage
coverage.process_startup()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment