PYTHON-4002 No module named coverage.__main__ (#1398)

This commit is contained in:
Steven Silvester 2023-10-17 09:28:15 -05:00 committed by GitHub
parent 1cbd192a84
commit fbf29374bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 26 additions and 7 deletions

View File

@ -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/
python -m coverage combine coverage/coverage.*
python -m coverage html -d htmlcov

View File

@ -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:

View File

@ -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"
TEST_ARGS="$TEST_ARGS --cov pymongo --cov-branch --cov-report term-missing:skip-covered"
fi