Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PYTHON-4988: Check C extensions are loaded ONLY in CPython builds #2016

Merged
merged 1 commit into from
Nov 25, 2024
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
4 changes: 2 additions & 2 deletions .evergreen/run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export PIP_PREFER_BINARY=1 # Prefer binary dists by default

set +x
python -c "import sys; sys.exit(sys.prefix == sys.base_prefix)" || (echo "Not inside a virtual env!"; exit 1)
PYTHON_IMPL=$(python -c "import platform; print(platform.python_implementation())")

# Try to source local Drivers Secrets
if [ -f ./secrets-export.sh ]; then
Expand All @@ -48,7 +49,7 @@ else
fi

# Ensure C extensions have compiled.
if [ -z "${NO_EXT:-}" ]; then
if [ -z "${NO_EXT:-}" ] && [ "$PYTHON_IMPL" = "CPython" ]; then
python tools/fail_if_no_c.py
fi

Expand Down Expand Up @@ -245,7 +246,6 @@ python -c 'import sys; print(sys.version)'

# Run the tests with coverage if requested and coverage is installed.
# 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
# Keep in sync with combine-coverage.sh.
# coverage >=5 is needed for relative_files=true.
Expand Down
7 changes: 6 additions & 1 deletion .evergreen/utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ testinstall () {
PYTHON=$1
RELEASE=$2
NO_VIRTUALENV=$3
PYTHON_IMPL=$(python -c "import platform; print(platform.python_implementation())")

if [ -z "$NO_VIRTUALENV" ]; then
createvirtualenv $PYTHON venvtestinstall
Expand All @@ -86,7 +87,11 @@ testinstall () {

$PYTHON -m pip install --upgrade $RELEASE
cd tools
$PYTHON fail_if_no_c.py

if [ "$PYTHON_IMPL" = "CPython" ]; then
$PYTHON fail_if_no_c.py
fi

$PYTHON -m pip uninstall -y pymongo
cd ..

Expand Down
Loading