Skip to content

Commit 03abc67

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 9567e6f commit 03abc67

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
@@ -154,12 +154,26 @@ def run() -> None:
154154
handle_pymongocrypt()
155155

156156
# Check if Rust extension is being used
157+
LOGGER.info(f"PYMONGO_USE_RUST={os.environ.get('PYMONGO_USE_RUST', 'not set')}")
158+
LOGGER.info(f"PYMONGO_BUILD_RUST={os.environ.get('PYMONGO_BUILD_RUST', 'not set')}")
159+
157160
if os.environ.get("PYMONGO_USE_RUST") or os.environ.get("PYMONGO_BUILD_RUST"):
158161
try:
159162
import bson
160163

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

0 commit comments

Comments
 (0)