File tree Expand file tree Collapse file tree 5 files changed +22
-12
lines changed Expand file tree Collapse file tree 5 files changed +22
-12
lines changed Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ set -o errexit # Exit the script with error if any of the commands fail
3+
4+ # Supported/used environment variables:
5+ # C_EXTENSIONS Pass --no_ext to skip installing the C extensions.
6+
7+ PYTHON_IMPL=$( python -c " import platform; print(platform.python_implementation())" )
8+ if [ -z " $C_EXTENSIONS " ] && [ " $PYTHON_IMPL " = " CPython" ]; then
9+ PYMONGO_C_EXT_MUST_BUILD=1 python setup.py build_ext -i
10+ python tools/fail_if_no_c.py
11+ fi
Original file line number Diff line number Diff line change @@ -14,7 +14,6 @@ export TEST_PATH="${PROJECT_DIRECTORY}/driver-performance-test-data"
1414export OUTPUT_FILE=" ${PROJECT_DIRECTORY} /results.json"
1515
1616export PYTHON_BINARY=/opt/mongodbtoolchain/v3/bin/python3
17- export C_EXTENSIONS=1
1817export PERF_TEST=1
1918
2019bash ./.evergreen/tox.sh -m test-eg
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ set -o xtrace
88# AUTH Set to enable authentication. Defaults to "noauth"
99# SSL Set to enable SSL. Defaults to "nossl"
1010# GREEN_FRAMEWORK The green framework to test with, if any.
11- # C_EXTENSIONS If non-empty, c extensions are enabled .
11+ # C_EXTENSIONS Pass --no_ext to skip installing the C extensions .
1212# COVERAGE If non-empty, run the test suite with coverage.
1313# COMPRESSORS If non-empty, install appropriate compressor.
1414# LIBMONGOCRYPT_URL The URL to download libmongocrypt.
272272PIP_QUIET=0 python -m pip list
273273
274274if [ -z " $GREEN_FRAMEWORK " ]; then
275- if [ -z " $C_EXTENSIONS " ] && [ " $PYTHON_IMPL " = " CPython" ]; then
276- python setup.py build_ext -i
277- # This will set a non-zero exit status if either import fails,
278- # causing this script to exit.
279- python -c " from bson import _cbson; from pymongo import _cmessage"
280- fi
275+ .evergreen/check-c-extensions.sh
281276 python -m pytest -v --durations=5 --maxfail=10 $TEST_ARGS
282277else
283278 python green_framework_test.py $GREEN_FRAMEWORK -v $TEST_ARGS
Original file line number Diff line number Diff line change @@ -68,7 +68,7 @@ def run(self):
6868 try :
6969 build_ext .run (self )
7070 except Exception :
71- if "TOX_ENV_NAME" in os .environ :
71+ if os .environ . get ( "PYMONGO_C_EXT_MUST_BUILD" ) :
7272 raise
7373 e = sys .exc_info ()[1 ]
7474 sys .stdout .write ("%s\n " % str (e ))
@@ -86,7 +86,7 @@ def build_extension(self, ext):
8686 try :
8787 build_ext .build_extension (self , ext )
8888 except Exception :
89- if "TOX_ENV_NAME" in os .environ :
89+ if os .environ . get ( "PYMONGO_C_EXT_MUST_BUILD" ) :
9090 raise
9191 e = sys .exc_info ()[1 ]
9292 sys .stdout .write ("%s\n " % str (e ))
@@ -120,7 +120,10 @@ def build_extension(self, ext):
120120
121121
122122if "--no_ext" in sys .argv or os .environ .get ("NO_EXT" ):
123- sys .argv .remove ("--no_ext" )
123+ try :
124+ sys .argv .remove ("--no_ext" )
125+ except ValueError :
126+ pass
124127 ext_modules = []
125128elif sys .platform .startswith ("java" ) or sys .platform == "cli" or "PyPy" in sys .version :
126129 sys .stdout .write (
Original file line number Diff line number Diff line change @@ -48,9 +48,11 @@ labels = # Use labels and -m instead of -e so that tox -m <label> fails instantl
4848description = run base set of unit tests with no extra functionality
4949extras =
5050 test
51+ allowlist_externals =
52+ .evergreen/check-c-extensions.sh
5153commands =
5254 python --version
53- python setup.py build_ext -i
55+ .evergreen/check-c-extensions.sh
5456 pytest -v --durations =5 --maxfail =10 {posargs}
5557
5658[testenv:test-eg]
You can’t perform that action at this time.
0 commit comments