Skip to content

Commit c19673f

Browse files
committed
Merge branch 'master' of github.com:mongodb/mongo-python-driver into PYTHON-4976
2 parents bae10df + 2235b83 commit c19673f

16 files changed

+115
-131
lines changed

.evergreen/install-dependencies.sh

Lines changed: 0 additions & 60 deletions
This file was deleted.

.evergreen/run-azurekms-test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ AZUREKMS_CMD="tar xf mongo-python-driver.tar.gz" \
2323
$DRIVERS_TOOLS/.evergreen/csfle/azurekms/run-command.sh
2424
echo "Untarring file ... end"
2525
echo "Running test ... begin"
26-
AZUREKMS_CMD="pwd && ls && KEY_NAME=\"$AZUREKMS_KEYNAME\" KEY_VAULT_ENDPOINT=\"$AZUREKMS_KEYVAULTENDPOINT\" SUCCESS=true TEST_FLE_AZURE_AUTO=1 bash ./.evergreen/just.sh test-eg" \
26+
AZUREKMS_CMD="KEY_NAME=\"$AZUREKMS_KEYNAME\" KEY_VAULT_ENDPOINT=\"$AZUREKMS_KEYVAULTENDPOINT\" SUCCESS=true TEST_FLE_AZURE_AUTO=1 bash ./.evergreen/just.sh test-eg" \
2727
$DRIVERS_TOOLS/.evergreen/csfle/azurekms/run-command.sh
2828
echo "Running test ... end"
2929
bash $HERE/teardown-encryption.sh
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,52 @@
11
#!/bin/bash
22

33
set -eu
4+
<<<<<<< HEAD
45
file="$PROJECT_DIRECTORY/.evergreen/install-dependencies.sh"
56
# Don't use ${file} syntax here because evergreen treats it as an empty expansion.
67
[ -f "$file" ] && bash "$file"
8+
||||||| 86084adb2
9+
file="$PROJECT_DIRECTORY/.evergreen/install-dependencies.sh"
10+
# Don't use ${file} syntax here because evergreen treats it as an empty expansion.
11+
[ -f "$file" ] && bash "$file" || echo "$file not available, skipping"
12+
=======
13+
14+
# On Evergreen jobs, "CI" will be set, and we don't want to write to $HOME.
15+
if [ "${CI:-}" == "true" ]; then
16+
_BIN_DIR=${DRIVERS_TOOLS_BINARIES:-}
17+
else
18+
_BIN_DIR=$HOME/.local/bin
19+
fi
20+
21+
22+
# Helper function to pip install a dependency using a temporary python env.
23+
function _pip_install() {
24+
_HERE=$(dirname ${BASH_SOURCE:-$0})
25+
. $_HERE/../utils.sh
26+
_VENV_PATH=$(mktemp -d)
27+
echo "Installing $2 using pip..."
28+
createvirtualenv "$(find_python3)" $_VENV_PATH
29+
python -m pip install $1
30+
ln -s "$(which $2)" $_BIN_DIR/$2
31+
echo "Installing $2 using pip... done."
32+
}
33+
34+
35+
# Ensure just is installed.
36+
if ! command -v just 2>/dev/null; then
37+
# On most systems we can install directly.
38+
_TARGET=""
39+
if [ "Windows_NT" = "${OS:-}" ]; then
40+
_TARGET="--target x86_64-pc-windows-msvc"
41+
fi
42+
echo "Installing just..."
43+
mkdir -p "$_BIN_DIR" 2>/dev/null || true
44+
curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | bash -s -- $_TARGET --to "$_BIN_DIR" || {
45+
_pip_install rust-just just
46+
}
47+
if ! command -v just 2>/dev/null; then
48+
export PATH="$PATH:$_BIN_DIR"
49+
fi
50+
echo "Installing just... done."
51+
fi
52+
>>>>>>> 2235b8354cef0acc0b41321fc103d14acf0ef92f

.evergreen/scripts/prepare-resources.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ echo "{ \"releases\": { \"default\": \"$MONGODB_BINARIES\" }}" >$MONGO_ORCHESTRA
1111

1212
popd
1313

14-
# # Copy PyMongo's test certificates over driver-evergreen-tools'
14+
# Copy PyMongo's test certificates over driver-evergreen-tools'
1515
cp ${PROJECT_DIRECTORY}/test/certificates/* ${DRIVERS_TOOLS}/.evergreen/x509gen/
1616

17-
# # Replace MongoOrchestration's client certificate.
17+
# Replace MongoOrchestration's client certificate.
1818
cp ${PROJECT_DIRECTORY}/test/certificates/client.pem ${MONGO_ORCHESTRATION_HOME}/lib/client.pem
1919

2020
if [ -w /etc/hosts ]; then

.evergreen/scripts/setup-dev-env.sh

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,10 @@ if [ -f $HERE/env.sh ]; then
1111
fi
1212

1313
# Ensure dependencies are installed.
14-
. .evergreen/install-dependencies.sh
14+
. $HERE/install-dependencies.sh
1515

16-
# Ensure that we have the correct base python binary.
17-
echo "Setting up python environment..."
18-
if [ -z "${UV_PYTHON:-}" ]; then
16+
# Ensure there is a python venv.
17+
if [ ! -d $BIN_DIR ]; then
1918
. .evergreen/utils.sh
2019

2120
if [ -z "${PYTHON_BINARY:-}" ]; then

bson/binary.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -405,14 +405,17 @@ def from_vector(cls: Type[Binary], vector: BinaryVector) -> Binary:
405405
@classmethod
406406
@overload
407407
def from_vector(
408-
cls: Type[Binary], vector: list[int, float], dtype: BinaryVectorDtype, padding: int = 0
408+
cls: Type[Binary],
409+
vector: Union[list[int], list[float]],
410+
dtype: BinaryVectorDtype,
411+
padding: int = 0,
409412
) -> Binary:
410413
...
411414

412415
@classmethod
413416
def from_vector(
414417
cls: Type[Binary],
415-
vector: Union[BinaryVector, list[int, float]],
418+
vector: Union[BinaryVector, list[int], list[float]],
416419
dtype: Optional[BinaryVectorDtype] = None,
417420
padding: Optional[int] = None,
418421
) -> Binary:

requirements/typing.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
mypy==1.14.1
2-
pyright==1.1.391
2+
pyright==1.1.392.post0
33
typing_extensions
44
-r ./encryption.txt
55
-r ./ocsp.txt

test/asynchronous/test_client.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -237,10 +237,7 @@ def test_getattr(self):
237237

238238
def test_iteration(self):
239239
client = self.client
240-
if "PyPy" in sys.version and sys.version_info < (3, 8, 15):
241-
msg = "'NoneType' object is not callable"
242-
else:
243-
msg = "'AsyncMongoClient' object is not iterable"
240+
msg = "'AsyncMongoClient' object is not iterable"
244241
# Iteration fails
245242
with self.assertRaisesRegex(TypeError, msg):
246243
for _ in client: # type: ignore[misc] # error: "None" not callable [misc]

test/asynchronous/test_collection.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -133,13 +133,7 @@ def test_getattr(self):
133133

134134
def test_iteration(self):
135135
coll = self.db.coll
136-
if "PyPy" in sys.version and sys.version_info < (3, 8, 15):
137-
msg = "'NoneType' object is not callable"
138-
else:
139-
if _IS_SYNC:
140-
msg = "'Collection' object is not iterable"
141-
else:
142-
msg = "'AsyncCollection' object is not iterable"
136+
msg = "'AsyncCollection' object is not iterable"
143137
# Iteration fails
144138
with self.assertRaisesRegex(TypeError, msg):
145139
for _ in coll: # type: ignore[misc] # error: "None" not callable [misc]

test/asynchronous/test_database.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,7 @@ def test_getattr(self):
103103

104104
def test_iteration(self):
105105
db = self.client.pymongo_test
106-
if "PyPy" in sys.version and sys.version_info < (3, 8, 15):
107-
msg = "'NoneType' object is not callable"
108-
else:
109-
msg = "'AsyncDatabase' object is not iterable"
106+
msg = "'AsyncDatabase' object is not iterable"
110107
# Iteration fails
111108
with self.assertRaisesRegex(TypeError, msg):
112109
for _ in db: # type: ignore[misc] # error: "None" not callable [misc]

0 commit comments

Comments
 (0)