Skip to content

Commit 7691266

Browse files
committed
Add explicit logging for Rust extension usage in tests
Enhanced the logging in run_tests.py to clearly show: - Whether PYMONGO_USE_RUST and PYMONGO_BUILD_RUST are set - Which BSON implementation is actually in use (rust/c/python) - Clear indication of which extension is ACTIVE This makes it easier to verify that the Rust extension is being used when expected, especially for the 'perf rust' tests.
1 parent e8be459 commit 7691266

1 file changed

Lines changed: 16 additions & 2 deletions

File tree

.evergreen/scripts/run_tests.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,12 +152,26 @@ def run() -> None:
152152
handle_pymongocrypt()
153153

154154
# Check if Rust extension is being used
155+
LOGGER.info(f"PYMONGO_USE_RUST={os.environ.get('PYMONGO_USE_RUST', 'not set')}")
156+
LOGGER.info(f"PYMONGO_BUILD_RUST={os.environ.get('PYMONGO_BUILD_RUST', 'not set')}")
157+
155158
if os.environ.get("PYMONGO_USE_RUST") or os.environ.get("PYMONGO_BUILD_RUST"):
156159
try:
157160
import bson
158161

159-
LOGGER.info(f"BSON implementation: {bson.get_bson_implementation()}")
160-
LOGGER.info(f"Has Rust: {bson.has_rust()}, Has C: {bson.has_c()}")
162+
impl = bson.get_bson_implementation()
163+
has_rust = bson.has_rust()
164+
has_c = bson.has_c()
165+
166+
LOGGER.info(f"BSON implementation in use: {impl}")
167+
LOGGER.info(f"Has Rust: {has_rust}, Has C: {has_c}")
168+
169+
if impl == "rust":
170+
LOGGER.info("✓ Rust extension is ACTIVE")
171+
elif impl == "c":
172+
LOGGER.info("✓ C extension is ACTIVE")
173+
else:
174+
LOGGER.info("✓ Pure Python implementation is ACTIVE")
161175
except Exception as e:
162176
LOGGER.warning(f"Could not check BSON implementation: {e}")
163177

0 commit comments

Comments
 (0)