Skip to content

Commit 5f842c4

Browse files
committed
Merge branch 'master' of github.com:mongodb/mongo-python-driver into PYTHON-5277
2 parents ec62534 + 5d14b34 commit 5f842c4

File tree

9 files changed

+780
-191
lines changed

9 files changed

+780
-191
lines changed

.evergreen/generated_configs/tasks.yml

+613-17
Large diffs are not rendered by default.

.evergreen/generated_configs/variants.yml

+36-106
Original file line numberDiff line numberDiff line change
@@ -804,112 +804,6 @@ buildvariants:
804804
expansions:
805805
PYTHON_BINARY: /opt/python/3.9/bin/python3
806806

807-
# Server tests
808-
- name: test-macos-python3.9
809-
tasks:
810-
- name: .sharded_cluster .auth .ssl !.sync_async
811-
- name: .replica_set .noauth .ssl !.sync_async
812-
- name: .standalone .noauth .nossl !.sync_async
813-
display_name: "* Test macOS Python3.9"
814-
run_on:
815-
- macos-14
816-
expansions:
817-
PYTHON_BINARY: /Library/Frameworks/Python.Framework/Versions/3.9/bin/python3
818-
- name: test-macos-python3.13
819-
tasks:
820-
- name: .sharded_cluster .auth .ssl !.sync_async
821-
- name: .replica_set .noauth .ssl !.sync_async
822-
- name: .standalone .noauth .nossl !.sync_async
823-
display_name: "* Test macOS Python3.13"
824-
run_on:
825-
- macos-14
826-
expansions:
827-
PYTHON_BINARY: /Library/Frameworks/Python.Framework/Versions/3.13/bin/python3
828-
- name: test-macos-arm64-python3.9
829-
tasks:
830-
- name: .sharded_cluster .auth .ssl .6.0 !.sync_async
831-
- name: .replica_set .noauth .ssl .6.0 !.sync_async
832-
- name: .standalone .noauth .nossl .6.0 !.sync_async
833-
- name: .sharded_cluster .auth .ssl .7.0 !.sync_async
834-
- name: .replica_set .noauth .ssl .7.0 !.sync_async
835-
- name: .standalone .noauth .nossl .7.0 !.sync_async
836-
- name: .sharded_cluster .auth .ssl .8.0 !.sync_async
837-
- name: .replica_set .noauth .ssl .8.0 !.sync_async
838-
- name: .standalone .noauth .nossl .8.0 !.sync_async
839-
- name: .sharded_cluster .auth .ssl .rapid !.sync_async
840-
- name: .replica_set .noauth .ssl .rapid !.sync_async
841-
- name: .standalone .noauth .nossl .rapid !.sync_async
842-
- name: .sharded_cluster .auth .ssl .latest !.sync_async
843-
- name: .replica_set .noauth .ssl .latest !.sync_async
844-
- name: .standalone .noauth .nossl .latest !.sync_async
845-
display_name: "* Test macOS Arm64 Python3.9"
846-
run_on:
847-
- macos-14-arm64
848-
expansions:
849-
PYTHON_BINARY: /Library/Frameworks/Python.Framework/Versions/3.9/bin/python3
850-
- name: test-macos-arm64-python3.13
851-
tasks:
852-
- name: .sharded_cluster .auth .ssl .6.0 !.sync_async
853-
- name: .replica_set .noauth .ssl .6.0 !.sync_async
854-
- name: .standalone .noauth .nossl .6.0 !.sync_async
855-
- name: .sharded_cluster .auth .ssl .7.0 !.sync_async
856-
- name: .replica_set .noauth .ssl .7.0 !.sync_async
857-
- name: .standalone .noauth .nossl .7.0 !.sync_async
858-
- name: .sharded_cluster .auth .ssl .8.0 !.sync_async
859-
- name: .replica_set .noauth .ssl .8.0 !.sync_async
860-
- name: .standalone .noauth .nossl .8.0 !.sync_async
861-
- name: .sharded_cluster .auth .ssl .rapid !.sync_async
862-
- name: .replica_set .noauth .ssl .rapid !.sync_async
863-
- name: .standalone .noauth .nossl .rapid !.sync_async
864-
- name: .sharded_cluster .auth .ssl .latest !.sync_async
865-
- name: .replica_set .noauth .ssl .latest !.sync_async
866-
- name: .standalone .noauth .nossl .latest !.sync_async
867-
display_name: "* Test macOS Arm64 Python3.13"
868-
run_on:
869-
- macos-14-arm64
870-
expansions:
871-
PYTHON_BINARY: /Library/Frameworks/Python.Framework/Versions/3.13/bin/python3
872-
- name: test-win64-python3.9
873-
tasks:
874-
- name: .sharded_cluster .auth .ssl !.sync_async
875-
- name: .replica_set .noauth .ssl !.sync_async
876-
- name: .standalone .noauth .nossl !.sync_async
877-
display_name: "* Test Win64 Python3.9"
878-
run_on:
879-
- windows-64-vsMulti-small
880-
expansions:
881-
PYTHON_BINARY: C:/python/Python39/python.exe
882-
- name: test-win64-python3.13
883-
tasks:
884-
- name: .sharded_cluster .auth .ssl !.sync_async
885-
- name: .replica_set .noauth .ssl !.sync_async
886-
- name: .standalone .noauth .nossl !.sync_async
887-
display_name: "* Test Win64 Python3.13"
888-
run_on:
889-
- windows-64-vsMulti-small
890-
expansions:
891-
PYTHON_BINARY: C:/python/Python313/python.exe
892-
- name: test-win32-python3.9
893-
tasks:
894-
- name: .sharded_cluster .auth .ssl !.sync_async
895-
- name: .replica_set .noauth .ssl !.sync_async
896-
- name: .standalone .noauth .nossl !.sync_async
897-
display_name: "* Test Win32 Python3.9"
898-
run_on:
899-
- windows-64-vsMulti-small
900-
expansions:
901-
PYTHON_BINARY: C:/python/32/Python39/python.exe
902-
- name: test-win32-python3.13
903-
tasks:
904-
- name: .sharded_cluster .auth .ssl !.sync_async
905-
- name: .replica_set .noauth .ssl !.sync_async
906-
- name: .standalone .noauth .nossl !.sync_async
907-
display_name: "* Test Win32 Python3.13"
908-
run_on:
909-
- windows-64-vsMulti-small
910-
expansions:
911-
PYTHON_BINARY: C:/python/32/Python313/python.exe
912-
913807
# Server version tests
914808
- name: mongodb-v4.0
915809
tasks:
@@ -1063,6 +957,42 @@ buildvariants:
1063957
PYTHON_BINARY: /opt/python/3.13/bin/python3
1064958
tags: [versionedApi_tag]
1065959

960+
# Standard nonlinux tests
961+
- name: test-macos
962+
tasks:
963+
- name: .standard-non-linux
964+
display_name: "* Test macOS"
965+
run_on:
966+
- macos-14
967+
tags: [standard-non-linux]
968+
- name: test-macos-arm64
969+
tasks:
970+
- name: .standard-non-linux .server-6.0
971+
- name: .standard-non-linux .server-7.0
972+
- name: .standard-non-linux .server-8.0
973+
- name: .standard-non-linux .server-rapid
974+
- name: .standard-non-linux .server-latest
975+
display_name: "* Test macOS Arm64"
976+
run_on:
977+
- macos-14-arm64
978+
tags: [standard-non-linux]
979+
- name: test-win64
980+
tasks:
981+
- name: .standard-non-linux
982+
display_name: "* Test Win64"
983+
run_on:
984+
- windows-64-vsMulti-small
985+
tags: [standard-non-linux]
986+
- name: test-win32
987+
tasks:
988+
- name: .standard-non-linux
989+
display_name: "* Test Win32"
990+
run_on:
991+
- windows-64-vsMulti-small
992+
expansions:
993+
IS_WIN32: "1"
994+
tags: [standard-non-linux]
995+
1066996
# Storage engine tests
1067997
- name: storage-inmemory-rhel8-python3.9
1068998
tasks:

.evergreen/scripts/generate_config.py

+45-14
Original file line numberDiff line numberDiff line change
@@ -83,23 +83,26 @@ def create_server_version_variants() -> list[BuildVariant]:
8383
return variants
8484

8585

86-
def create_server_variants() -> list[BuildVariant]:
86+
def create_standard_nonlinux_variants() -> list[BuildVariant]:
8787
variants = []
8888
base_display_name = "* Test"
8989

9090
# Test a subset on each of the other platforms.
9191
for host_name in ("macos", "macos-arm64", "win64", "win32"):
92-
for python in MIN_MAX_PYTHON:
93-
tasks = [f"{t} !.sync_async" for t in SUB_TASKS]
94-
# MacOS arm64 only works on server versions 6.0+
95-
if host_name == "macos-arm64":
96-
tasks = []
97-
for version in get_versions_from("6.0"):
98-
tasks.extend(f"{t} .{version} !.sync_async" for t in SUB_TASKS)
99-
host = HOSTS[host_name]
100-
display_name = get_variant_name(base_display_name, host, python=python)
101-
variant = create_variant(tasks, display_name, python=python, host=host)
102-
variants.append(variant)
92+
tasks = [".standard-non-linux"]
93+
# MacOS arm64 only works on server versions 6.0+
94+
if host_name == "macos-arm64":
95+
tasks = [
96+
f".standard-non-linux .server-{version}" for version in get_versions_from("6.0")
97+
]
98+
host = HOSTS[host_name]
99+
tags = ["standard-non-linux"]
100+
expansions = dict()
101+
if host_name == "win32":
102+
expansions["IS_WIN32"] = "1"
103+
display_name = get_variant_name(base_display_name, host)
104+
variant = create_variant(tasks, display_name, host=host, tags=tags, expansions=expansions)
105+
variants.append(variant)
103106

104107
return variants
105108

@@ -597,7 +600,7 @@ def create_server_version_tasks():
597600
continue
598601
task_types.append((python, topology, auth, ssl))
599602
for python, topology, auth, ssl in task_types:
600-
tags = ["server-version", python, f"{topology}-{auth}-{ssl}"]
603+
tags = ["server-version", f"python-{python}", f"{topology}-{auth}-{ssl}"]
601604
expansions = dict(AUTH=auth, SSL=ssl, TOPOLOGY=topology)
602605
if python not in PYPYS:
603606
expansions["COVERAGE"] = "1"
@@ -610,9 +613,37 @@ def create_server_version_tasks():
610613
return tasks
611614

612615

616+
def create_standard_non_linux_tasks():
617+
tasks = []
618+
619+
for (version, topology), python, sync in zip_cycle(
620+
list(product(ALL_VERSIONS, TOPOLOGIES)), CPYTHONS, SYNCS
621+
):
622+
auth = "auth" if topology == "sharded_cluster" else "noauth"
623+
ssl = "nossl" if topology == "standalone" else "ssl"
624+
tags = [
625+
"standard-non-linux",
626+
f"server-{version}",
627+
f"python-{python}",
628+
f"{topology}-{auth}-{ssl}",
629+
sync,
630+
]
631+
expansions = dict(AUTH=auth, SSL=ssl, TOPOLOGY=topology, VERSION=version)
632+
name = get_task_name("test", python=python, sync=sync, **expansions)
633+
server_func = FunctionCall(func="run server", vars=expansions)
634+
test_vars = expansions.copy()
635+
test_vars["PYTHON_VERSION"] = python
636+
test_vars["TEST_NAME"] = f"default_{sync}"
637+
test_func = FunctionCall(func="run tests", vars=test_vars)
638+
tasks.append(EvgTask(name=name, tags=tags, commands=[server_func, test_func]))
639+
return tasks
640+
641+
613642
def create_server_tasks():
614643
tasks = []
615-
for topo, version, (auth, ssl), sync in product(TOPOLOGIES, ALL_VERSIONS, AUTH_SSLS, SYNCS):
644+
for topo, version, (auth, ssl), sync in product(
645+
TOPOLOGIES, ALL_VERSIONS, AUTH_SSLS, [*SYNCS, "sync_async"]
646+
):
616647
name = f"test-{version}-{topo}-{auth}-{ssl}-{sync}".lower()
617648
tags = [version, topo, auth, ssl, sync]
618649
server_vars = dict(

.evergreen/scripts/generate_config_utils.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,15 @@
3636
".replica_set .noauth .ssl",
3737
".standalone .noauth .nossl",
3838
]
39-
SYNCS = ["sync", "async", "sync_async"]
39+
SYNCS = ["sync", "async"]
4040
DISPLAY_LOOKUP = dict(
4141
ssl=dict(ssl="SSL", nossl="NoSSL"),
4242
auth=dict(auth="Auth", noauth="NoAuth"),
4343
topology=dict(
4444
standalone="Standalone", replica_set="Replica Set", sharded_cluster="Sharded Cluster"
4545
),
4646
test_suites=dict(default="Sync", default_async="Async"),
47+
sync={"sync": "Sync", "async": "Async"},
4748
coverage={"1": "cov"},
4849
no_ext={"1": "No C"},
4950
)

.evergreen/scripts/setup_tests.py

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
"PYTHON_BINARY",
3535
"PYTHON_VERSION",
3636
"REQUIRE_FIPS",
37+
"IS_WIN32",
3738
]
3839

3940
# Map the test name to test extra.

.evergreen/utils.sh

+5-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,11 @@ get_python_binary() {
123123
PYTHON="/Library/Frameworks/Python.Framework/Versions/$version/bin/python3"
124124
elif [ "Windows_NT" = "${OS:-}" ]; then
125125
version=$(echo $version | cut -d. -f1,2 | sed 's/\.//g')
126-
PYTHON="C:/python/Python$version/python.exe"
126+
if [ -n "${IS_WIN32:-}" ]; then
127+
PYTHON="C:/python/32/Python$version/python.exe"
128+
else
129+
PYTHON="C:/python/Python$version/python.exe"
130+
fi
127131
else
128132
PYTHON="/opt/python/$version/bin/python3"
129133
fi

gridfs/synchronous/__init__.py

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Copyright 2009-present MongoDB, Inc.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
"""GridFS is a specification for storing large objects in Mongo.
16+
17+
The :mod:`gridfs` package is an implementation of GridFS on top of
18+
:mod:`pymongo`, exposing a file-like interface.
19+
20+
.. seealso:: The MongoDB documentation on `gridfs <https://dochub.mongodb.org/core/gridfs>`_.
21+
"""
22+
from __future__ import annotations
23+
24+
from gridfs.errors import NoFile
25+
from gridfs.grid_file_shared import DEFAULT_CHUNK_SIZE
26+
from gridfs.synchronous.grid_file import (
27+
GridFS,
28+
GridFSBucket,
29+
GridIn,
30+
GridOut,
31+
GridOutCursor,
32+
)
33+
34+
__all__ = [
35+
"GridFS",
36+
"GridFSBucket",
37+
"NoFile",
38+
"DEFAULT_CHUNK_SIZE",
39+
"GridIn",
40+
"GridOut",
41+
"GridOutCursor",
42+
]

0 commit comments

Comments
 (0)