Skip to content

Commit 2195866

Browse files
caseyclementsJibolaNoahStapp
authored
PYTHON-5355 Addition of API to move to and from NumPy ndarrays and BSON BinaryVectors (#2590)
Co-authored-by: Jib <Jibzade@gmail.com> Co-authored-by: Noah Stapp <noah.stapp@mongodb.com>
1 parent 3093a7c commit 2195866

File tree

8 files changed

+338
-70
lines changed

8 files changed

+338
-70
lines changed

.evergreen/generated_configs/functions.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,19 @@ functions:
239239
working_dir: src
240240
type: test
241241

242+
# Test numpy
243+
test numpy:
244+
- command: subprocess.exec
245+
params:
246+
binary: bash
247+
args:
248+
- .evergreen/just.sh
249+
- test-numpy
250+
working_dir: src
251+
include_expansions_in_env:
252+
- TOOLCHAIN_VERSION
253+
type: test
254+
242255
# Upload coverage
243256
upload coverage:
244257
- command: ec2.assume_role

.evergreen/generated_configs/tasks.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4768,6 +4768,28 @@ tasks:
47684768
- noauth
47694769
- pypy
47704770

4771+
# Test numpy tests
4772+
- name: test-numpy-python3.10
4773+
commands:
4774+
- func: test numpy
4775+
vars:
4776+
TOOLCHAIN_VERSION: "3.10"
4777+
tags:
4778+
- binary
4779+
- vector
4780+
- python-3.10
4781+
- test-numpy
4782+
- name: test-numpy-python3.14
4783+
commands:
4784+
- func: test numpy
4785+
vars:
4786+
TOOLCHAIN_VERSION: "3.14"
4787+
tags:
4788+
- binary
4789+
- vector
4790+
- python-3.14
4791+
- test-numpy
4792+
47714793
# Test standard auth tests
47724794
- name: test-standard-auth-v4.2-python3.10-auth-ssl-sharded-cluster
47734795
commands:

.evergreen/generated_configs/variants.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -621,3 +621,42 @@ buildvariants:
621621
- rhel87-small
622622
expansions:
623623
STORAGE_ENGINE: inmemory
624+
625+
# Test numpy tests
626+
- name: test-numpy-rhel8
627+
tasks:
628+
- name: .test-numpy
629+
display_name: Test Numpy RHEL8
630+
run_on:
631+
- rhel87-small
632+
tags: [binary, vector, pr]
633+
- name: test-numpy-macos
634+
tasks:
635+
- name: .test-numpy
636+
display_name: Test Numpy macOS
637+
run_on:
638+
- macos-14
639+
tags: [binary, vector]
640+
- name: test-numpy-macos-arm64
641+
tasks:
642+
- name: .test-numpy
643+
display_name: Test Numpy macOS Arm64
644+
run_on:
645+
- macos-14-arm64
646+
tags: [binary, vector]
647+
- name: test-numpy-win64
648+
tasks:
649+
- name: .test-numpy
650+
display_name: Test Numpy Win64
651+
run_on:
652+
- windows-64-vsMulti-small
653+
tags: [binary, vector]
654+
- name: test-numpy-win32
655+
tasks:
656+
- name: .test-numpy
657+
display_name: Test Numpy Win32
658+
run_on:
659+
- windows-64-vsMulti-small
660+
expansions:
661+
IS_WIN32: "1"
662+
tags: [binary, vector]

.evergreen/scripts/generate_config.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,37 @@ def create_disable_test_commands_variants():
339339
return [create_variant(tasks, display_name, host=host, expansions=expansions)]
340340

341341

342+
def create_test_numpy_tasks():
343+
tasks = []
344+
for python in MIN_MAX_PYTHON:
345+
tags = ["binary", "vector", f"python-{python}", "test-numpy"]
346+
task_name = get_task_name("test-numpy", python=python)
347+
test_func = FunctionCall(func="test numpy", vars=dict(TOOLCHAIN_VERSION=python))
348+
tasks.append(EvgTask(name=task_name, tags=tags, commands=[test_func]))
349+
return tasks
350+
351+
352+
def create_test_numpy_variants() -> list[BuildVariant]:
353+
variants = []
354+
base_display_name = "Test Numpy"
355+
356+
# Test a subset on each of the other platforms.
357+
for host_name in ("rhel8", "macos", "macos-arm64", "win64", "win32"):
358+
tasks = [".test-numpy"]
359+
host = HOSTS[host_name]
360+
tags = ["binary", "vector"]
361+
if host_name == "rhel8":
362+
tags.append("pr")
363+
expansions = dict()
364+
if host_name == "win32":
365+
expansions["IS_WIN32"] = "1"
366+
display_name = get_variant_name(base_display_name, host)
367+
variant = create_variant(tasks, display_name, host=host, tags=tags, expansions=expansions)
368+
variants.append(variant)
369+
370+
return variants
371+
372+
342373
def create_oidc_auth_variants():
343374
variants = []
344375
for host_name in ["ubuntu22", "macos", "win64"]:
@@ -1140,6 +1171,14 @@ def create_run_tests_func():
11401171
return "run tests", [setup_cmd, test_cmd]
11411172

11421173

1174+
def create_test_numpy_func():
1175+
includes = ["TOOLCHAIN_VERSION"]
1176+
test_cmd = get_subprocess_exec(
1177+
include_expansions_in_env=includes, args=[".evergreen/just.sh", "test-numpy"]
1178+
)
1179+
return "test numpy", [test_cmd]
1180+
1181+
11431182
def create_cleanup_func():
11441183
cmd = get_subprocess_exec(args=[".evergreen/scripts/cleanup.sh"])
11451184
return "cleanup", [cmd]

0 commit comments

Comments
 (0)