From 241ed054f424b2e52ef1a2fb5db96215f07ca597 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Wed, 5 Feb 2025 21:07:46 -0600 Subject: [PATCH 1/2] Update pymongo and python support --- .github/workflows/test.yml | 4 ++++ changelog.rst | 6 ++++++ pyproject.toml | 7 +++---- test/utils_spec_runner.py | 17 +++++++++-------- 4 files changed, 22 insertions(+), 12 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d85a81f..e201f7a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -32,3 +32,7 @@ jobs: run: | python -m pip install -e ".[test]" python -m unittest discover . + - name: Test min pymongo + run: | + python -m pip pymongo==4.9 + python -m unittest discover . \ No newline at end of file diff --git a/changelog.rst b/changelog.rst index 8065fcd..edd41e1 100644 --- a/changelog.rst +++ b/changelog.rst @@ -2,6 +2,12 @@ Changelog ========= +Changes in version 1.4.0 (unreleased) +------------------------------------- +- Added support for Python 3.13. Dropped support for Python versions + less than 3.9. +- Dropped support for PyMongo versions less than 4.9. + Changes in version 1.3.0 ------------------------ - Added support for Python 3.11 and 3.12. Dropped support for Python versions diff --git a/pyproject.toml b/pyproject.toml index 6d0b65b..ac8c4df 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,7 +8,7 @@ dynamic = ["version"] description = "Explainable CRUD API for PyMongo" readme = "README.rst" license = { file = "LICENSE" } -requires-python = ">=3.7" +requires-python = ">=3.9" authors = [ { name = "Julius Park" }, ] @@ -25,18 +25,17 @@ classifiers = [ "Operating System :: Microsoft :: Windows", "Operating System :: POSIX", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.7", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", "Topic :: Database", ] dependencies = [ - "pymongo>=4.4", + "pymongo>=4.9", ] [project.scripts] diff --git a/test/utils_spec_runner.py b/test/utils_spec_runner.py index 0679d9a..ac5e2bc 100644 --- a/test/utils_spec_runner.py +++ b/test/utils_spec_runner.py @@ -415,13 +415,6 @@ def check_events(self, test, listener, session_ids): event.command['getMore'] = Int64(42) elif event.command_name == 'killCursors': event.command['cursors'] = [Int64(42)] - elif event.command_name == 'update': - # TODO: remove this once PYTHON-1744 is done. - # Add upsert and multi fields back into expectations. - updates = expectation[event_type]['command']['updates'] - for update in updates: - update.setdefault('upsert', False) - update.setdefault('multi', False) # Replace afterClusterTime: 42 with actual afterClusterTime. expected_cmd = expectation[event_type]['command'] @@ -458,7 +451,15 @@ def check_events(self, test, listener, session_ids): self.fail("Expected key [%s] in %r" % ( key, actual)) else: - self.assertEqual(val, decode_raw(actual[key]), + actual_val = decode_raw(actual[key]) + # Use the equivalent of `"$$unsetOrMatches": false` for "upsert" and "multi". + if isinstance(val, list): + for (i, j) in zip(val, actual_val): + if "multi" in j: + i.setdefault("multi", False) + if "upsert" in j: + i.setdefault("upsert", False) + self.assertEqual(val, actual_val, "Key [%s] in %s" % (key, actual)) else: self.assertEqual(actual, expected) From dc04d95c96d0dc8184dab3193dac9a75714b93b7 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Wed, 5 Feb 2025 21:09:27 -0600 Subject: [PATCH 2/2] fix install --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e201f7a..e3fd733 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -34,5 +34,5 @@ jobs: python -m unittest discover . - name: Test min pymongo run: | - python -m pip pymongo==4.9 + python -m pip install pymongo==4.9 python -m unittest discover . \ No newline at end of file