Skip to content

Commit 089cb62

Browse files
authored
Update pymongo and python support (#59)
* Update pymongo and python support * fix install
1 parent 67b3c1d commit 089cb62

File tree

4 files changed

+22
-12
lines changed

4 files changed

+22
-12
lines changed

.github/workflows/test.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,7 @@ jobs:
3232
run: |
3333
python -m pip install -e ".[test]"
3434
python -m unittest discover .
35+
- name: Test min pymongo
36+
run: |
37+
python -m pip install pymongo==4.9
38+
python -m unittest discover .

changelog.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22
Changelog
33
=========
44

5+
Changes in version 1.4.0 (unreleased)
6+
-------------------------------------
7+
- Added support for Python 3.13. Dropped support for Python versions
8+
less than 3.9.
9+
- Dropped support for PyMongo versions less than 4.9.
10+
511
Changes in version 1.3.0
612
------------------------
713
- Added support for Python 3.11 and 3.12. Dropped support for Python versions

pyproject.toml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ dynamic = ["version"]
88
description = "Explainable CRUD API for PyMongo"
99
readme = "README.rst"
1010
license = { file = "LICENSE" }
11-
requires-python = ">=3.7"
11+
requires-python = ">=3.9"
1212
authors = [
1313
{ name = "Julius Park" },
1414
]
@@ -25,18 +25,17 @@ classifiers = [
2525
"Operating System :: Microsoft :: Windows",
2626
"Operating System :: POSIX",
2727
"Programming Language :: Python :: 3",
28-
"Programming Language :: Python :: 3.7",
29-
"Programming Language :: Python :: 3.8",
3028
"Programming Language :: Python :: 3.9",
3129
"Programming Language :: Python :: 3.10",
3230
"Programming Language :: Python :: 3.11",
3331
"Programming Language :: Python :: 3.12",
32+
"Programming Language :: Python :: 3.13",
3433
"Programming Language :: Python :: Implementation :: CPython",
3534
"Programming Language :: Python :: Implementation :: PyPy",
3635
"Topic :: Database",
3736
]
3837
dependencies = [
39-
"pymongo>=4.4",
38+
"pymongo>=4.9",
4039
]
4140

4241
[project.scripts]

test/utils_spec_runner.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -415,13 +415,6 @@ def check_events(self, test, listener, session_ids):
415415
event.command['getMore'] = Int64(42)
416416
elif event.command_name == 'killCursors':
417417
event.command['cursors'] = [Int64(42)]
418-
elif event.command_name == 'update':
419-
# TODO: remove this once PYTHON-1744 is done.
420-
# Add upsert and multi fields back into expectations.
421-
updates = expectation[event_type]['command']['updates']
422-
for update in updates:
423-
update.setdefault('upsert', False)
424-
update.setdefault('multi', False)
425418

426419
# Replace afterClusterTime: 42 with actual afterClusterTime.
427420
expected_cmd = expectation[event_type]['command']
@@ -458,7 +451,15 @@ def check_events(self, test, listener, session_ids):
458451
self.fail("Expected key [%s] in %r" % (
459452
key, actual))
460453
else:
461-
self.assertEqual(val, decode_raw(actual[key]),
454+
actual_val = decode_raw(actual[key])
455+
# Use the equivalent of `"$$unsetOrMatches": false` for "upsert" and "multi".
456+
if isinstance(val, list):
457+
for (i, j) in zip(val, actual_val):
458+
if "multi" in j:
459+
i.setdefault("multi", False)
460+
if "upsert" in j:
461+
i.setdefault("upsert", False)
462+
self.assertEqual(val, actual_val,
462463
"Key [%s] in %s" % (key, actual))
463464
else:
464465
self.assertEqual(actual, expected)

0 commit comments

Comments
 (0)