Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .evergreen/combine-coverage.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash
#
# Coverage combine merges (and removes) all the coverage files and
# generates a new .coverage file in the current directory.

set -o xtrace # Write all commands first to stderr
set -o errexit # Exit the script with error if any of the commands fail

. .evergreen/utils.sh

if [ -z "$PYTHON_BINARY" ]; then
PYTHON_BINARY=$(find_python3)
fi

createvirtualenv "$PYTHON_BINARY" covenv
# coverage 7.3 dropped support for Python 3.7, keep in sync with run-tests.sh
pip install -q "coverage<7.3"

pip list
ls -la coverage/
Comment on lines +19 to +20
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these two just for capturing the information in our logs?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep


python -m coverage combine coverage/coverage.*
python -m coverage html -d htmlcov
7 changes: 1 addition & 6 deletions .evergreen/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,7 @@ functions:
working_dir: "src"
script: |
${PREPARE_SHELL}
set -o xtrace
# Coverage combine merges (and removes) all the coverage files and
# generates a new .coverage file in the current directory.
ls -la coverage/
/opt/python/3.7/bin/python3 -m coverage combine coverage/coverage.*
/opt/python/3.7/bin/python3 -m coverage html -d htmlcov
bash .evergreen/combine-coverage.sh
# Upload the resulting html coverage report.
- command: shell.exec
params:
Expand Down
3 changes: 2 additions & 1 deletion .evergreen/run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,8 @@ python -c 'import sys; print(sys.version)'
# Only cover CPython. PyPy reports suspiciously low coverage.
PYTHON_IMPL=$($PYTHON -c "import platform; print(platform.python_implementation())")
if [ -n "$COVERAGE" ] && [ "$PYTHON_IMPL" = "CPython" ]; then
python -m pip install pytest-cov "coverage"
# coverage 7.3 dropped support for Python 3.7, keep in sync with combine-coverage.sh.
python -m pip install pytest-cov "coverage<7.3"
Comment on lines +261 to +262
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we see a world where we have a version of python or dependent libraries that's incompatible with coverage<7.3? I don't imagine that's likely considering the python release schedules, and our support timelines but just curious.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eventually, yes. We'll do a grep for Python 3.7 when we drop support for it, and should update this min version.

TEST_ARGS="$TEST_ARGS --cov pymongo --cov-branch --cov-report term-missing:skip-covered"
fi

Expand Down