Add venv detection for Python 3.13 in js tests

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Fixed
    • Priority: Major - P3
    • 8.3.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • DevProd Correctness
    • Fully Compatible
    • Correctness 2026-01-26
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Add venv detection for Python 3.13 in js tests

      Problem

      The getPython3Binary() function in jstests/libs/python.js hardcodes a check for Python 3.10 to detect virtual environments. After upgrading to Python 3.13 (v5 toolchain), this detection fails, causing tests that require Python dependencies to fail with ModuleNotFoundError.

      Current Behavior

      getPython3Binary() checks if python --version returns Python 3.10:

      const usingPython310 = /Python 3\.10/.exec(pythonVersion);
      if (usingPython310) {
          jsTest.log.info("Found python 3.10 by default. Likely this is because we are using a virtual environment.");
          return "python";
      }
      

      If not 3.10, it assumes no venv exists and uses bare toolchain Python (/opt/mongodbtoolchain/v5/bin/python3.13) which has no packages installed.

      Example Failure

      [js_test:client_source_authentication_restriction_mode] sh420703| Traceback (most recent call last):
      [js_test:client_source_authentication_restriction_mode] sh420703|   File "/data/mci/.../jstests/sharding/libs/proxy_protocol_server.py", line 18, in <module>
      [js_test:client_source_authentication_restriction_mode] sh420703|     from proxyprotocol.server.main import main
      [js_test:client_source_authentication_restriction_mode] sh420703| ModuleNotFoundError: No module named 'proxyprotocol'
      

            Assignee:
            Nicholas Jefferies
            Reporter:
            Nicholas Jefferies
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: