Merge branch 'master' of github.com:mongodb/mongo-python-driver

This commit is contained in:
Steven Silvester 2025-07-09 10:41:11 -05:00
commit d07301e296
No known key found for this signature in database
GPG Key ID: B1BF5EC3A8B32F91
11 changed files with 50 additions and 4 deletions

View File

@ -128,6 +128,10 @@ tasks:
- mongo-python-driver
- ${github_commit}
working_dir: src
include_expansions_in_env:
- AWS_ACCESS_KEY_ID
- AWS_SECRET_ACCESS_KEY
- AWS_SESSION_TOKEN
type: test
# Coverage report tests

View File

@ -896,7 +896,8 @@ def create_backport_pr_tasks():
"mongo-python-driver",
"${github_commit}",
]
cmd = get_subprocess_exec(args=args)
include_expansions = ["AWS_ACCESS_KEY_ID", "AWS_SECRET_ACCESS_KEY", "AWS_SESSION_TOKEN"]
cmd = get_subprocess_exec(args=args, include_expansions_in_env=include_expansions)
assume_func = FunctionCall(func="assume ec2 role")
return [EvgTask(name=name, commands=[assume_func, cmd], allowed_requesters=["commit"])]

View File

@ -38,4 +38,14 @@ if [ "$(uname -s)" = "Darwin" ]; then
fi
fi
if [ -w /etc/hosts ]; then
SUDO=""
else
SUDO="sudo"
fi
# Add 'server' and 'hostname_not_in_cert' as a hostnames
echo "127.0.0.1 server" | $SUDO tee -a /etc/hosts
echo "127.0.0.1 hostname_not_in_cert" | $SUDO tee -a /etc/hosts
echo "Setting up system... done."

View File

@ -46,7 +46,7 @@ jobs:
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@39edc492dbe16b1465b0cafca41432d857bdb31a # v3
uses: github/codeql-action/init@181d5eefc20863364f96762470ba6f862bdef56b # v3
with:
languages: ${{ matrix.language }}
build-mode: ${{ matrix.build-mode }}
@ -63,6 +63,6 @@ jobs:
pip install -e .
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@39edc492dbe16b1465b0cafca41432d857bdb31a # v3
uses: github/codeql-action/analyze@181d5eefc20863364f96762470ba6f862bdef56b # v3
with:
category: "/language:${{matrix.language}}"

View File

@ -18,4 +18,4 @@ jobs:
with:
persist-credentials: false
- name: Run zizmor 🌈
uses: zizmorcore/zizmor-action@1c7106082dbc1753372e3924b7da1b9417011a21
uses: zizmorcore/zizmor-action@0f0557ab4a0b31211d42435e42df31cbd63fdd59

View File

@ -13,6 +13,7 @@ PyMongo 4.14 brings a number of changes including:
- Introduces a minor breaking change. When encoding :class:`bson.binary.BinaryVector`, a ``ValueError`` will be raised
if the 'padding' metadata field is < 0 or > 7, or non-zero for any type other than PACKED_BIT.
- Changed :meth:`~pymongo.uri_parser.parse_uri`'s ``options`` parameter to be type ``dict`` instead of ``_CaseInsensitiveDictionary``.
Changes in Version 4.13.2 (2025/06/17)
--------------------------------------

View File

@ -80,6 +80,9 @@ async def parse_uri(
wait for a response from the DNS server.
:param srv_service_name: A custom SRV service name
.. versionchanged:: 4.14
``options`` is now type ``dict`` as opposed to a ``_CaseInsensitiveDictionary``.
.. versionchanged:: 4.6
The delimiting slash (``/``) between hosts and connection options is now optional.
For example, "mongodb://example.com?tls=true" is now a valid URI.

View File

@ -80,6 +80,9 @@ def parse_uri(
wait for a response from the DNS server.
:param srv_service_name: A custom SRV service name
.. versionchanged:: 4.14
``options`` is now type ``dict`` as opposed to a ``_CaseInsensitiveDictionary``.
.. versionchanged:: 4.6
The delimiting slash (``/``) between hosts and connection options is now optional.
For example, "mongodb://example.com?tls=true" is now a valid URI.

View File

@ -304,8 +304,13 @@ class TestSSL(AsyncIntegrationTest):
client = self.simple_client(uri_fmt % (CLIENT_PEM, "true", CA_PEM))
await self.assertClientWorks(client)
@unittest.skipIf(
"PyPy" in sys.version and not _IS_SYNC,
"https://github.com/pypy/pypy/issues/5131 flaky on async PyPy due to SSL EOF",
)
@async_client_context.require_tlsCertificateKeyFile
@async_client_context.require_server_resolvable
@async_client_context.require_no_api_version
@ignore_deprecations
async def test_cert_ssl_validation_hostname_matching(self):
# Expects the server to be running with server.pem and ca.pem
@ -430,8 +435,13 @@ class TestSSL(AsyncIntegrationTest):
self.simple_client(uri_fmt % (CRL_PEM, CA_PEM), **self.credentials) # type: ignore[arg-type]
)
@unittest.skipIf(
"PyPy" in sys.version and not _IS_SYNC,
"https://github.com/pypy/pypy/issues/5131 flaky on async PyPy due to SSL EOF",
)
@async_client_context.require_tlsCertificateKeyFile
@async_client_context.require_server_resolvable
@async_client_context.require_no_api_version
@ignore_deprecations
async def test_validation_with_system_ca_certs(self):
# Expects the server to be running with server.pem and ca.pem.

View File

@ -304,8 +304,13 @@ class TestSSL(IntegrationTest):
client = self.simple_client(uri_fmt % (CLIENT_PEM, "true", CA_PEM))
self.assertClientWorks(client)
@unittest.skipIf(
"PyPy" in sys.version and not _IS_SYNC,
"https://github.com/pypy/pypy/issues/5131 flaky on async PyPy due to SSL EOF",
)
@client_context.require_tlsCertificateKeyFile
@client_context.require_server_resolvable
@client_context.require_no_api_version
@ignore_deprecations
def test_cert_ssl_validation_hostname_matching(self):
# Expects the server to be running with server.pem and ca.pem
@ -430,8 +435,13 @@ class TestSSL(IntegrationTest):
self.simple_client(uri_fmt % (CRL_PEM, CA_PEM), **self.credentials) # type: ignore[arg-type]
)
@unittest.skipIf(
"PyPy" in sys.version and not _IS_SYNC,
"https://github.com/pypy/pypy/issues/5131 flaky on async PyPy due to SSL EOF",
)
@client_context.require_tlsCertificateKeyFile
@client_context.require_server_resolvable
@client_context.require_no_api_version
@ignore_deprecations
def test_validation_with_system_ca_certs(self):
# Expects the server to be running with server.pem and ca.pem.

View File

@ -555,6 +555,10 @@ class TestURI(unittest.TestCase):
with self.assertRaisesRegex(ValueError, r"Port contains whitespace character: '\\n'"):
parse_uri("mongodb://localhost:27\n017")
def test_parse_uri_options_type(self):
opts = parse_uri("mongodb://localhost:27017")["options"]
self.assertIsInstance(opts, dict)
if __name__ == "__main__":
unittest.main()