Skip to content

Commit 9d562f0

Browse files
committed
PYTHON-2781 Fix Python 3.4 CI testing with coverage
1 parent 99e21c3 commit 9d562f0

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

.evergreen/run-tests.sh

+6-6
Original file line numberDiff line numberDiff line change
@@ -199,14 +199,14 @@ $PYTHON -c 'import sys; print(sys.version)'
199199

200200
# Run the tests with coverage if requested and coverage is installed.
201201
# Only cover CPython. Jython and PyPy report suspiciously low coverage.
202-
COVERAGE_OR_PYTHON="$PYTHON"
202+
# Also skip CPython 3.4. It's not supported by coverage 5+, which uses
203+
# a new and incompatible data format.
204+
PYTHON_VERSION=$($PYTHON -c 'import sys; print(".".join(map(str, sys.version_info[:2])))')
203205
COVERAGE_ARGS=""
204-
if [ -n "$COVERAGE" -a $PYTHON_IMPL = "CPython" ]; then
205-
COVERAGE_BIN="$(dirname "$PYTHON")/coverage"
206-
if $COVERAGE_BIN --version; then
206+
if [ -n "$COVERAGE" -a $PYTHON_IMPL = "CPython" -a $PYTHON_VERSION != "3.4" ]; then
207+
if $PYTHON -m coverage --version; then
207208
echo "INFO: coverage is installed, running tests with coverage..."
208-
COVERAGE_OR_PYTHON="$COVERAGE_BIN"
209-
COVERAGE_ARGS="run --branch"
209+
COVERAGE_ARGS="-m coverage run --branch"
210210
else
211211
echo "INFO: coverage is not installed, running tests without coverage..."
212212
fi

0 commit comments

Comments
 (0)