Skip to content

Commit 9b5c098

Browse files
authored
PYTHON-4988: Check C extensions are loaded ONLY in CPython builds (mongodb#2016)
1 parent 1c7a7fe commit 9b5c098

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

.evergreen/run-tests.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ export PIP_PREFER_BINARY=1 # Prefer binary dists by default
3838

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

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

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

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

246247
# Run the tests with coverage if requested and coverage is installed.
247248
# Only cover CPython. PyPy reports suspiciously low coverage.
248-
PYTHON_IMPL=$(python -c "import platform; print(platform.python_implementation())")
249249
if [ -n "$COVERAGE" ] && [ "$PYTHON_IMPL" = "CPython" ]; then
250250
# Keep in sync with combine-coverage.sh.
251251
# coverage >=5 is needed for relative_files=true.

.evergreen/utils.sh

+6-1
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ testinstall () {
7878
PYTHON=$1
7979
RELEASE=$2
8080
NO_VIRTUALENV=$3
81+
PYTHON_IMPL=$(python -c "import platform; print(platform.python_implementation())")
8182

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

8788
$PYTHON -m pip install --upgrade $RELEASE
8889
cd tools
89-
$PYTHON fail_if_no_c.py
90+
91+
if [ "$PYTHON_IMPL" = "CPython" ]; then
92+
$PYTHON fail_if_no_c.py
93+
fi
94+
9095
$PYTHON -m pip uninstall -y pymongo
9196
cd ..
9297

0 commit comments

Comments
 (0)