Skip to content

Commit 1f308c8

Browse files
authored
PYTHON-5480 Update Python 3.9-specific tests to use Python 3.10 (#2560)
1 parent eb0cedd commit 1f308c8

12 files changed

+479
-451
lines changed

.evergreen/generated_configs/tasks.yml

Lines changed: 426 additions & 426 deletions
Large diffs are not rendered by default.

.evergreen/generated_configs/variants.yml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -142,17 +142,16 @@ buildvariants:
142142
- rhel87-small
143143

144144
# Disable test commands tests
145-
- name: disable-test-commands-rhel8-python3.9
145+
- name: disable-test-commands-rhel8
146146
tasks:
147147
- name: .test-standard .server-latest
148-
display_name: Disable test commands RHEL8 Python3.9
148+
display_name: Disable test commands RHEL8
149149
run_on:
150150
- rhel87-small
151151
expansions:
152152
AUTH: auth
153153
SSL: ssl
154154
DISABLE_TEST_COMMANDS: "1"
155-
PYTHON_BINARY: /opt/python/3.9/bin/python3
156155

157156
# Doctests tests
158157
- name: doctests-rhel8
@@ -491,14 +490,14 @@ buildvariants:
491490
SUB_TEST_NAME: pyopenssl
492491

493492
# Search index tests
494-
- name: search-index-helpers-rhel8-python3.9
493+
- name: search-index-helpers-rhel8-python3.10
495494
tasks:
496495
- name: .search_index
497-
display_name: Search Index Helpers RHEL8 Python3.9
496+
display_name: Search Index Helpers RHEL8 Python3.10
498497
run_on:
499498
- rhel87-small
500499
expansions:
501-
PYTHON_BINARY: /opt/python/3.9/bin/python3
500+
PYTHON_BINARY: /opt/python/3.10/bin/python3
502501

503502
# Server version tests
504503
- name: mongodb-v4.2

.evergreen/run-mongodb-aws-ecs-test.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,13 @@ fi
2020
set -o xtrace
2121

2222
# Install python with pip.
23-
PYTHON_VER="python3.9"
23+
PYTHON_VER="python3.10"
2424
apt-get -qq update < /dev/null > /dev/null
25+
apt-get -q install -y software-properties-common
26+
# Use openpgp to avoid gpg key timeout.
27+
mkdir -p $HOME/.gnupg
28+
echo "keyserver keys.openpgp.org" >> $HOME/.gnupg/gpg.conf
29+
add-apt-repository -y 'ppa:deadsnakes/ppa'
2530
apt-get -qq install $PYTHON_VER $PYTHON_VER-venv build-essential $PYTHON_VER-dev -y < /dev/null > /dev/null
2631

2732
export PYTHON_BINARY=$PYTHON_VER

.evergreen/scripts/generate_config.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -330,10 +330,9 @@ def create_mod_wsgi_variants():
330330
def create_disable_test_commands_variants():
331331
host = DEFAULT_HOST
332332
expansions = dict(AUTH="auth", SSL="ssl", DISABLE_TEST_COMMANDS="1")
333-
python = CPYTHONS[0]
334-
display_name = get_variant_name("Disable test commands", host, python=python)
333+
display_name = get_variant_name("Disable test commands", host)
335334
tasks = [".test-standard .server-latest"]
336-
return [create_variant(tasks, display_name, host=host, python=python, expansions=expansions)]
335+
return [create_variant(tasks, display_name, host=host, expansions=expansions)]
337336

338337

339338
def create_oidc_auth_variants():

.evergreen/scripts/generate_config_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
##############
2323

2424
ALL_VERSIONS = ["4.2", "4.4", "5.0", "6.0", "7.0", "8.0", "rapid", "latest"]
25-
CPYTHONS = ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
25+
CPYTHONS = ["3.10", "3.9", "3.11", "3.12", "3.13", "3.14"]
2626
PYPYS = ["pypy3.10"]
2727
ALL_PYTHONS = CPYTHONS + PYPYS
2828
MIN_MAX_PYTHON = [CPYTHONS[0], CPYTHONS[-1]]

.evergreen/scripts/kms_tester.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def _setup_azure_vm(base_env: dict[str, str]) -> None:
3333
env["AZUREKMS_CMD"] = "sudo apt-get install -y python3-dev build-essential"
3434
run_command(f"{azure_dir}/run-command.sh", env=env)
3535

36-
env["AZUREKMS_CMD"] = "bash .evergreen/just.sh setup-tests kms azure-remote"
36+
env["AZUREKMS_CMD"] = "NO_EXT=1 bash .evergreen/just.sh setup-tests kms azure-remote"
3737
run_command(f"{azure_dir}/run-command.sh", env=env)
3838
LOGGER.info("Setting up Azure VM... done.")
3939

@@ -53,7 +53,7 @@ def _setup_gcp_vm(base_env: dict[str, str]) -> None:
5353
env["GCPKMS_CMD"] = "sudo apt-get install -y python3-dev build-essential"
5454
run_command(f"{gcp_dir}/run-command.sh", env=env)
5555

56-
env["GCPKMS_CMD"] = "bash ./.evergreen/just.sh setup-tests kms gcp-remote"
56+
env["GCPKMS_CMD"] = "NO_EXT=1 bash ./.evergreen/just.sh setup-tests kms gcp-remote"
5757
run_command(f"{gcp_dir}/run-command.sh", env=env)
5858
LOGGER.info("Setting up GCP VM...")
5959

@@ -98,6 +98,13 @@ def setup_kms(sub_test_name: str) -> None:
9898
if sub_test_target == "azure":
9999
os.environ["AZUREKMS_VMNAME_PREFIX"] = "PYTHON_DRIVER"
100100

101+
# Found using "az vm image list --output table"
102+
os.environ[
103+
"AZUREKMS_IMAGE"
104+
] = "Canonical:0001-com-ubuntu-server-jammy:22_04-lts-gen2:latest"
105+
else:
106+
os.environ["GCPKMS_IMAGEFAMILY"] = "debian-12"
107+
101108
run_command("./setup.sh", cwd=kms_dir)
102109
base_env = _load_kms_config(sub_test_target)
103110

.evergreen/scripts/oidc_tester.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@ def setup_oidc(sub_test_name: str) -> dict[str, str] | None:
4242
if sub_test_name == "azure":
4343
env["AZUREOIDC_VMNAME_PREFIX"] = "PYTHON_DRIVER"
4444
if "-remote" not in sub_test_name:
45+
if sub_test_name == "azure":
46+
# Found using "az vm image list --output table"
47+
env["AZUREOIDC_IMAGE"] = "Canonical:0001-com-ubuntu-server-jammy:22_04-lts-gen2:latest"
48+
else:
49+
env["GCPKMS_IMAGEFAMILY"] = "debian-12"
4550
run_command(f"bash {target_dir}/setup.sh", env=env)
4651
if sub_test_name in K8S_NAMES:
4752
run_command(f"bash {target_dir}/setup-pod.sh {sub_test_name}")
@@ -84,7 +89,7 @@ def test_oidc_send_to_remote(sub_test_name: str) -> None:
8489
env[f"{upper_name}OIDC_DRIVERS_TAR_FILE"] = TMP_DRIVER_FILE
8590
env[
8691
f"{upper_name}OIDC_TEST_CMD"
87-
] = f"OIDC_ENV={sub_test_name} ./.evergreen/run-mongodb-oidc-test.sh"
92+
] = f"NO_EXT=1 OIDC_ENV={sub_test_name} ./.evergreen/run-mongodb-oidc-test.sh"
8893
elif sub_test_name in K8S_NAMES:
8994
env["K8S_DRIVERS_TAR_FILE"] = TMP_DRIVER_FILE
9095
env["K8S_TEST_CMD"] = "OIDC_ENV=k8s ./.evergreen/run-mongodb-oidc-test.sh"

.evergreen/scripts/setup_tests.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
GROUP_MAP = dict(mockupdb="mockupdb", perf="perf")
5454

5555
# The python version used for perf tests.
56-
PERF_PYTHON_VERSION = "3.9.13"
56+
PERF_PYTHON_VERSION = "3.10.11"
5757

5858

5959
def is_set(var: str) -> bool:
@@ -90,6 +90,13 @@ def setup_libmongocrypt():
9090
distro = get_distro()
9191
if distro.name.startswith("Debian"):
9292
target = f"debian{distro.version_id}"
93+
elif distro.name.startswith("Ubuntu"):
94+
if distro.version_id == "20.04":
95+
target = "debian11"
96+
elif distro.version_id == "22.04":
97+
target = "debian12"
98+
elif distro.version_id == "24.04":
99+
target = "debian13"
93100
elif distro.name.startswith("Red Hat"):
94101
if distro.version_id.startswith("7"):
95102
target = "rhel-70-64-bit"

test/asynchronous/test_client.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2059,7 +2059,7 @@ async def _test_handshake(self, env_vars, expected_env):
20592059
async def test_handshake_01_aws(self):
20602060
await self._test_handshake(
20612061
{
2062-
"AWS_EXECUTION_ENV": "AWS_Lambda_python3.9",
2062+
"AWS_EXECUTION_ENV": "AWS_Lambda_python3.10",
20632063
"AWS_REGION": "us-east-2",
20642064
"AWS_LAMBDA_FUNCTION_MEMORY_SIZE": "1024",
20652065
},
@@ -2097,7 +2097,7 @@ async def test_handshake_04_vercel(self):
20972097

20982098
async def test_handshake_05_multiple(self):
20992099
await self._test_handshake(
2100-
{"AWS_EXECUTION_ENV": "AWS_Lambda_python3.9", "FUNCTIONS_WORKER_RUNTIME": "python"},
2100+
{"AWS_EXECUTION_ENV": "AWS_Lambda_python3.10", "FUNCTIONS_WORKER_RUNTIME": "python"},
21012101
None,
21022102
)
21032103
# Extra cases for other combos.
@@ -2109,13 +2109,16 @@ async def test_handshake_05_multiple(self):
21092109

21102110
async def test_handshake_06_region_too_long(self):
21112111
await self._test_handshake(
2112-
{"AWS_EXECUTION_ENV": "AWS_Lambda_python3.9", "AWS_REGION": "a" * 512},
2112+
{"AWS_EXECUTION_ENV": "AWS_Lambda_python3.10", "AWS_REGION": "a" * 512},
21132113
{"name": "aws.lambda"},
21142114
)
21152115

21162116
async def test_handshake_07_memory_invalid_int(self):
21172117
await self._test_handshake(
2118-
{"AWS_EXECUTION_ENV": "AWS_Lambda_python3.9", "AWS_LAMBDA_FUNCTION_MEMORY_SIZE": "big"},
2118+
{
2119+
"AWS_EXECUTION_ENV": "AWS_Lambda_python3.10",
2120+
"AWS_LAMBDA_FUNCTION_MEMORY_SIZE": "big",
2121+
},
21192122
{"name": "aws.lambda"},
21202123
)
21212124

test/asynchronous/test_discovery_and_monitoring.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ async def test_rtt_connection_is_disabled_poll(self):
485485

486486
async def test_rtt_connection_is_disabled_auto(self):
487487
envs = [
488-
{"AWS_EXECUTION_ENV": "AWS_Lambda_python3.9"},
488+
{"AWS_EXECUTION_ENV": "AWS_Lambda_python3.10"},
489489
{"FUNCTIONS_WORKER_RUNTIME": "python"},
490490
{"K_SERVICE": "gcpservicename"},
491491
{"FUNCTION_NAME": "gcpfunctionname"},

0 commit comments

Comments
 (0)