Skip to content

Commit

Permalink
Merge branch 'master' into convert-client-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
NoahStapp authored Jul 10, 2024
2 parents 521473f + 554ce7d commit 3a453b7
Show file tree
Hide file tree
Showing 12 changed files with 879 additions and 62 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/test-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-20.04]
python-version: ["3.8", "3.11", "pypy-3.9"]
python-version: ["3.8", "pypy-3.9", "3.13"]
name: CPython ${{ matrix.python-version }}-${{ matrix.os }}
steps:
- uses: actions/checkout@v4
Expand All @@ -61,13 +61,14 @@ jobs:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: 'pyproject.toml'
allow-prereleases: true
- name: Install dependencies
run: |
pip install -q tox
- name: Start MongoDB
uses: supercharge/[email protected]
with:
mongodb-version: 4.4
mongodb-version: 6.0
- name: Run tests
run: |
tox -m test
Expand Down
3 changes: 3 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,9 @@ the pages will re-render and the browser will automatically refresh.
`TEST_LOADBALANCER=1 tox -m test-eg`.

## Running Encryption Tests Locally
- Clone `drivers-evergreen-tools`:
`git clone [email protected]:mongodb-labs/drivers-evergreen-tools.git`.
- Run `export DRIVERS_TOOLS=$PWD/drivers-evergreen-tools`
- Run `AWS_PROFILE=<profile> tox -m setup-encryption` after setting up your AWS profile with `aws configure sso`.
- Run the tests with `TEST_ENCRYPTION=1 tox -e test-eg`.
- When done, run `tox -m teardown-encryption` to clean up.
Expand Down
4 changes: 2 additions & 2 deletions pymongo/asynchronous/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ async def create_collection(
:class:`~pymongo.collation.Collation`.
:param session: a
:class:`~pymongo.client_session.AsyncClientSession`.
:param `check_exists`: if True (the default), send a listCollections command to
:param check_exists: if True (the default), send a listCollections command to
check if the collection already exists before creation.
:param kwargs: additional keyword arguments will
be passed as options for the `create collection command`_
Expand Down Expand Up @@ -949,7 +949,7 @@ async def cursor_command(
read preference configured for the transaction.
Otherwise, defaults to
:attr:`~pymongo.read_preferences.ReadPreference.PRIMARY`.
:param codec_options`: A :class:`~bson.codec_options.CodecOptions`
:param codec_options: A :class:`~bson.codec_options.CodecOptions`
instance.
:param session: A
:class:`~pymongo.client_session.AsyncClientSession`.
Expand Down
10 changes: 5 additions & 5 deletions pymongo/asynchronous/encryption.py
Original file line number Diff line number Diff line change
Expand Up @@ -1005,10 +1005,10 @@ async def delete_key(self, id: Binary) -> DeleteResult:
async def add_key_alt_name(self, id: Binary, key_alt_name: str) -> Any:
"""Add ``key_alt_name`` to the set of alternate names in the key document with UUID ``key_id``.
:param `id`: The UUID of a key a which must be a
:param id: The UUID of a key a which must be a
:class:`~bson.binary.Binary` with subtype 4 (
:attr:`~bson.binary.UUID_SUBTYPE`).
:param `key_alt_name`: The key alternate name to add.
:param key_alt_name: The key alternate name to add.
:return: The previous version of the key document.
Expand Down Expand Up @@ -1037,10 +1037,10 @@ async def remove_key_alt_name(self, id: Binary, key_alt_name: str) -> Optional[R
Also removes the ``keyAltNames`` field from the key document if it would otherwise be empty.
:param `id`: The UUID of a key a which must be a
:param id: The UUID of a key a which must be a
:class:`~bson.binary.Binary` with subtype 4 (
:attr:`~bson.binary.UUID_SUBTYPE`).
:param `key_alt_name`: The key alternate name to remove.
:param key_alt_name: The key alternate name to remove.
:return: Returns the previous version of the key document.
Expand Down Expand Up @@ -1079,7 +1079,7 @@ async def rewrap_many_data_key(
:param filter: A document used to filter the data keys.
:param provider: The new KMS provider to use to encrypt the data keys,
or ``None`` to use the current KMS provider(s).
:param `master_key`: The master key fields corresponding to the new KMS
:param master_key: The master key fields corresponding to the new KMS
provider when ``provider`` is not ``None``.
:return: A :class:`RewrapManyDataKeyResult`.
Expand Down
4 changes: 2 additions & 2 deletions pymongo/synchronous/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ def create_collection(
:class:`~pymongo.collation.Collation`.
:param session: a
:class:`~pymongo.client_session.ClientSession`.
:param `check_exists`: if True (the default), send a listCollections command to
:param check_exists: if True (the default), send a listCollections command to
check if the collection already exists before creation.
:param kwargs: additional keyword arguments will
be passed as options for the `create collection command`_
Expand Down Expand Up @@ -947,7 +947,7 @@ def cursor_command(
read preference configured for the transaction.
Otherwise, defaults to
:attr:`~pymongo.read_preferences.ReadPreference.PRIMARY`.
:param codec_options`: A :class:`~bson.codec_options.CodecOptions`
:param codec_options: A :class:`~bson.codec_options.CodecOptions`
instance.
:param session: A
:class:`~pymongo.client_session.ClientSession`.
Expand Down
10 changes: 5 additions & 5 deletions pymongo/synchronous/encryption.py
Original file line number Diff line number Diff line change
Expand Up @@ -1003,10 +1003,10 @@ def delete_key(self, id: Binary) -> DeleteResult:
def add_key_alt_name(self, id: Binary, key_alt_name: str) -> Any:
"""Add ``key_alt_name`` to the set of alternate names in the key document with UUID ``key_id``.
:param `id`: The UUID of a key a which must be a
:param id: The UUID of a key a which must be a
:class:`~bson.binary.Binary` with subtype 4 (
:attr:`~bson.binary.UUID_SUBTYPE`).
:param `key_alt_name`: The key alternate name to add.
:param key_alt_name: The key alternate name to add.
:return: The previous version of the key document.
Expand Down Expand Up @@ -1035,10 +1035,10 @@ def remove_key_alt_name(self, id: Binary, key_alt_name: str) -> Optional[RawBSON
Also removes the ``keyAltNames`` field from the key document if it would otherwise be empty.
:param `id`: The UUID of a key a which must be a
:param id: The UUID of a key a which must be a
:class:`~bson.binary.Binary` with subtype 4 (
:attr:`~bson.binary.UUID_SUBTYPE`).
:param `key_alt_name`: The key alternate name to remove.
:param key_alt_name: The key alternate name to remove.
:return: Returns the previous version of the key document.
Expand Down Expand Up @@ -1077,7 +1077,7 @@ def rewrap_many_data_key(
:param filter: A document used to filter the data keys.
:param provider: The new KMS provider to use to encrypt the data keys,
or ``None`` to use the current KMS provider(s).
:param `master_key`: The master key fields corresponding to the new KMS
:param master_key: The master key fields corresponding to the new KMS
provider when ``provider`` is not ``None``.
:return: A :class:`RewrapManyDataKeyResult`.
Expand Down
6 changes: 6 additions & 0 deletions test/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,12 @@ def require_no_auth(self, func):
func=func,
)

def require_no_fips(self, func):
"""Run a test only if the host does not have FIPS enabled."""
return self._require(
lambda: not self.fips_enabled, "Test cannot run on a FIPS-enabled host", func=func
)

def require_replica_set(self, func):
"""Run a test only if the client is connected to a replica set."""
return self._require(lambda: self.is_rs, "Not connected to a replica set", func=func)
Expand Down
6 changes: 6 additions & 0 deletions test/asynchronous/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,12 @@ def require_no_auth(self, func):
func=func,
)

def require_no_fips(self, func):
"""Run a test only if the host does not have FIPS enabled."""
return self._require(
lambda: not self.fips_enabled, "Test cannot run on a FIPS-enabled host", func=func
)

def require_replica_set(self, func):
"""Run a test only if the client is connected to a replica set."""
return self._require(lambda: self.is_rs, "Not connected to a replica set", func=func)
Expand Down
Loading

0 comments on commit 3a453b7

Please sign in to comment.