Compare commits

...

3933 Commits

Author SHA1 Message Date
Noah Stapp
9a8e34c726
PYTHON-5366 - test_pool_reset waits until Pool.reset() increments gen… (#2797) 2026-05-18 10:29:44 -04:00
Noah Stapp
552b7bf47b
PYTHON-5631 - test_direct_client_maintains_pool_to_arbiter waits inst… (#2798) 2026-05-13 12:20:15 -04:00
Qi Deng
a50550535d
URL-encode client_id in Azure IMDS token request (#2787)
Co-authored-by: Qi Deng <qdeng@aurascape.ai>
2026-05-13 09:33:42 -04:00
Noah Stapp
0adf6df131
PYTHON-5708 - Unskip large encryption tests on mongocryptd (#2793) 2026-05-07 15:23:07 -04:00
Noah Stapp
f145c7db94
PYTHON-5756 - Fix BSON Binary type length bug (#2790) 2026-05-07 15:23:00 -04:00
Noah Stapp
b6bac45c7e
PYTHON-5032 - Use PyErr_GetRaisedException instead of deprecated PyEr… (#2795) 2026-05-07 14:52:19 -04:00
Noah Stapp
8dc7efade2
PYTHON-5821 - Fix ordering issue between event publish and logging for Pool monitoring tests (#2796) 2026-05-07 12:28:15 -04:00
Noah Stapp
f4219bdca2
PYTHON-5817 - Add "Project Structure and Asyncio Considerations" section to CONTRIBUTING.md (#2788)
Co-authored-by: Jib <Jibzade@gmail.com>
2026-05-06 13:28:36 -04:00
Noah Stapp
900d9c7910
PYTHON-5436 - Always include session on getMores if the initial curso… (#2794) 2026-05-06 13:10:13 -04:00
Noah Stapp
575d75f4d3
PYTHON-5813 - Skip QE prefixPreview and suffixPreview tests on server… (#2792) 2026-05-05 13:41:10 -04:00
Noah Stapp
c30eff1291
PYTHON-5811 - Change stream events are not emitted for timeseries as … (#2791) 2026-05-05 11:40:19 -04:00
Jeffrey 'Alex' Clark
e67931dff7
PYTHON-5776 Add documentation comments to justfile recipes (#2784) 2026-04-27 19:45:36 -04:00
mongodb-drivers-pr-bot[bot]
64edd22d73
[Spec Resync] 04-20-2026 (#2766)
Co-authored-by: Cloud User <ec2-user@ip-10-128-20-182.ec2.internal>
Co-authored-by: Jeffrey 'Alex' Clark <aclark@aclark.net>
2026-04-27 15:56:10 -04:00
Jeffrey 'Alex' Clark
b3f1c4befb
[Spec Resync] Remove stale spec patches for closed tickets (#2782) 2026-04-27 15:55:18 -04:00
Jeffrey 'Alex' Clark
ab44a21b46
PYTHON-5780 Increase code coverage for pyopenssl_context.py (#2773) 2026-04-24 09:04:02 -04:00
Jeffrey 'Alex' Clark
a13842f351
PYTHON-5778 Add 100% unit test coverage for event_loggers.py (#2769) 2026-04-21 12:36:48 -04:00
Jeffrey 'Alex' Clark
8363bf60ad
PYTHON-5774 Increase daemon.py coverage to 63% (#2759) 2026-04-20 16:52:36 -04:00
Jeffrey 'Alex' Clark
5406febcd9
Bump version to 4.18.0.dev0 (#2768) 2026-04-20 16:51:01 -04:00
Noah Stapp
3491c08ef6
PYTHON-5801 - Update changelog for 4.17 release (#2762) 2026-04-17 14:17:53 -04:00
Noah Stapp
912ef337f9
PYTHON-5798 - Overload retargeting prose tests do not ensure that sec… (#2760)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-04-16 13:32:50 -04:00
Noah Stapp
b4e2c03a92
PYTHON-5800 - Simple collation is included in index information (#2761) 2026-04-16 12:25:23 -04:00
Noah Stapp
f31ba09713
PYTHON-5797 - Add IWM and Overload Error links to changelog (#2757)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-04-15 14:42:29 -04:00
Noah Stapp
5da91837d4
PYTHON-5794 - Add prose tests to verify correct retry behavior when a… (#2755)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Jib <Jibzade@gmail.com>
2026-04-15 14:18:34 -04:00
Copilot
35e51a50f3
Revert "PYTHON-5768 Add AGENTS.md w/copilot instructions" (#2744) (#2754)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: aclark4life <72164+aclark4life@users.noreply.github.com>
Co-authored-by: Jib <jib.adegunloye@mongodb.com>
2026-04-15 12:59:12 -04:00
Jeffrey 'Alex' Clark
f41dd5c08b
PYTHON-5772 Increase _gcp_helpers.py coverage (#2749)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-04-14 16:53:35 -04:00
Jeffrey 'Alex' Clark
49e7a052e2
PYTHON-5760 Increase _azure_helpers.py coverage (#2747) 2026-04-14 16:24:51 -04:00
Jeffrey 'Alex' Clark
a2b0cd85e3
PYTHON-5795 Fix absolute link to CONTRIBUTING.md in README.md (#2756) 2026-04-14 15:48:00 -04:00
Noah Stapp
e1751ff253
PYTHON-5668 - Merge backpressure branch into mainline (#2729)
Co-authored-by: Steven Silvester <steve.silvester@mongodb.com>
Co-authored-by: Shane Harvey <shnhrv@gmail.com>
Co-authored-by: Steven Silvester <steven.silvester@ieee.org>
Co-authored-by: Iris <58442094+sleepyStick@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Kevin Albertson <kevin.albertson@mongodb.com>
Co-authored-by: Casey Clements <caseyclements@users.noreply.github.com>
Co-authored-by: Sergey Zelenov <mail@zelenov.su>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-04-14 12:25:29 -04:00
Noah Stapp
ee20ef52ec
PYTHON-5791 - test_list_database_names should not check ordering (#2751) 2026-04-13 14:01:14 -04:00
Jeffrey 'Alex' Clark
08b806fd87
PYTHON-5768 Add AGENTS.md w/copilot instructions (#2744)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-04-07 12:20:27 -04:00
Jib
db4db928d3
PYTHON-5401: Add AI Generated Contributions Policy (#2696)
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-04-01 11:51:53 -04:00
dependabot[bot]
ee851ba974
Bump astral-sh/setup-uv from 7.3.0 to 7.6.0 in the actions group (#2740)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-03-31 11:50:25 -07:00
mongodb-drivers-pr-bot[bot]
ce416a0944
[Spec Resync] 03-30-2026 (#2741)
Co-authored-by: Cloud User <ec2-user@ip-10-128-20-15.ec2.internal>
Co-authored-by: Iris Ho <iris.ho@mongodb.com>
2026-03-31 11:41:46 -07:00
dependabot[bot]
daba50c797
Bump the actions group across 1 directory with 4 updates (#2736)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-03-23 14:56:12 -04:00
Jeffrey 'Alex' Clark
c3428789fb
PYTHON-5766 Add codecov badge to readme (#2737)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-03-23 10:55:50 -04:00
Jeffrey 'Alex' Clark
ec9d95413c
PYTHON-5757 Deprecate Python 2 methods in SON (#2732) 2026-03-18 17:46:23 -04:00
Jeffrey 'Alex' Clark
13085ff679
PYTHON-5758 Remove unused validation functions (#2733) 2026-03-18 13:19:18 -04:00
Jeffrey 'Alex' Clark
80c3ff2aee
PYTHON-5753 Add just recipes for running coverage tests locally (#2727) 2026-03-12 12:42:15 -04:00
Jeffrey 'Alex' Clark
3d89d9faca
PYTHON-5754 Fix USE_ACTIVE_VENV support (#2728) 2026-03-11 14:09:11 -04:00
Shane Harvey
b6cc22ffdd
PYTHON-5748 Remove unused SpecRunner class (#2725) 2026-03-09 12:37:32 -07:00
Shane Harvey
f303125cee
PYTHON-5114 Test suite reduce killAllSessions calls (#2721) 2026-03-09 11:53:40 -07:00
Iris
38da6c3f9a
PYTHON-5747 Add jira link to spec resync PR (#2723) 2026-03-09 12:24:59 -04:00
Noah Stapp
926541fa4d
PYTHON-5742 - Add Copilot instructions (#2717) 2026-03-09 10:29:00 -04:00
Noah Stapp
f533157981
Python 4542 - Improved sessions API (#2712) 2026-03-05 09:04:37 -07:00
mongodb-drivers-pr-bot[bot]
e028fe2a38
[Spec Resync] 03-02-2026 (#2716)
Co-authored-by: Cloud User <ec2-user@ip-10-128-55-188.ec2.internal>
Co-authored-by: Iris <58442094+sleepyStick@users.noreply.github.com>
2026-03-02 18:24:06 -08:00
Noah Stapp
469a32a9dd
PYTHON-5737 - BSON encoding/decoding performance improvements (#2715) 2026-03-02 10:06:47 -08:00
Noah Stapp
84814b2a72
PYTHON-5731 - Server selection deprioritization only for overload errors on replica sets (#2710) 2026-02-23 13:18:24 -05:00
Steven Silvester
908102d776
PYTHON-5732 Use mongodb-runner in Evergreen Tests (#2703) 2026-02-20 13:02:52 -06:00
Steven Silvester
edd0e0698f
PYTHON-5708 Temporarily skip some BSON encryption tests (#2709) 2026-02-20 11:56:30 -06:00
dependabot[bot]
cbd82e75e7
Bump the actions group with 2 updates (#2711)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-02-20 06:26:49 -06:00
Steven Silvester
6923641626
PYTHON-5729 Pin setuptools when using older gevent (#2708) 2026-02-18 14:42:00 -06:00
Steven Silvester
b60d266ad7
PYTHON-3898 Add coverage to all variants (#2705) 2026-02-17 12:23:34 -06:00
Steven Silvester
36676384bd
PYTHON-5705 Improve fallback for PyOpenSSL windows system certs loading (#2688) 2026-02-09 19:39:05 -06:00
Steven Silvester
0441761872
PYTHON-5715 Add appName to OIDC test failpoints (#2697) 2026-02-09 14:51:30 -06:00
Steven Silvester
fdb6a3291f
PYTHON-5467 Fix codecov upload on Evergreen (#2702) 2026-02-09 13:55:08 -06:00
Steven Silvester
b1a0a1f104
PYTHON-5467 Fix codecov upload (#2701) 2026-02-06 10:29:37 -06:00
Casey Clements
f28ab12db0
PYTHON-XXXX Fixed typo in Running Tests Locally section. (#2698) 2026-02-06 09:08:00 -05:00
dependabot[bot]
d5e1777732
Bump astral-sh/setup-uv from 7.2.0 to 7.2.1 in the actions group (#2700)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-02-06 09:01:06 -05:00
Steven Silvester
afc884d786
PYTHON-5467 Add codecov integration (#2690) 2026-02-05 13:52:10 -06:00
mongodb-drivers-pr-bot[bot]
e077ebd926
[Spec Resync] 02-02-2026 (#2694)
Co-authored-by: Cloud User <ec2-user@ip-10-128-37-208.ec2.internal>
2026-02-03 14:44:16 -05:00
Noah Stapp
543c4e532c
PYTHON-1357 - Refactor Cursor and CommandCursor (#2691) 2026-02-02 08:47:26 -05:00
dependabot[bot]
182d8e2ea0
Bump peter-evans/create-pull-request from 8.0.0 to 8.1.0 in the actions group (#2692)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Steven Silvester <steven.silvester@ieee.org>
2026-01-30 08:35:46 -06:00
dependabot[bot]
4c86d86bf1
Bump astral-sh/setup-uv from 7.1.6 to 7.2.0 in the actions group across 1 directory (#2684)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-01-28 13:36:28 -06:00
Steven Silvester
fa56b563dd
PYTHON-5704 Skip free-threading for enterprise auth builds (#2687) 2026-01-27 12:04:51 -06:00
Steven Silvester
896f139ddc
PYTHON-5703 Use Ubuntu24 for AWS Auth tests (#2686) 2026-01-27 10:49:44 -06:00
mongodb-drivers-pr-bot[bot]
a89c5e3a89
PYTHON-5699 & PYTHON-5698 [Spec Resync] 01-26-2026 (#2685)
Co-authored-by: Cloud User <ec2-user@ip-10-128-52-19.ec2.internal>
2026-01-26 13:36:51 -06:00
Noah Stapp
db6dad95be
PYTHON-5605 - Drop usage of Ubuntu 20 (#2683) 2026-01-26 07:51:26 -05:00
Noah Stapp
a426ad91d7
PYTHON-5692 - [Infrastructure] Improve dependabot version updates (#2682) 2026-01-23 14:53:30 -05:00
dependabot[bot]
1e7477b9df
Bump pyright from 1.1.407 to 1.1.408 (#2675)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Casey Clements <casey.clements@mongodb.com>
Co-authored-by: Casey Clements <caseyclements@users.noreply.github.com>
2026-01-22 10:17:15 -05:00
mongodb-drivers-pr-bot[bot]
db28d14b6d
[Spec Resync] 01-19-2026 (#2680)
Co-authored-by: Cloud User <ec2-user@ip-10-128-52-183.ec2.internal>
2026-01-20 13:21:36 -05:00
Noah Stapp
12b3859903
PYTHON-5697 - Migrate 8.0+ tests to Windows 2022 (#2681) 2026-01-20 12:24:55 -05:00
Rin
b88415b8e8
refactor(ci): replace shell=True and awk pipes with native Python (#2671) 2026-01-09 09:23:00 -05:00
mongodb-dbx-release-bot[bot]
cb01da6a50
BUMP 4.17.0.dev0
Signed-off-by: mongodb-dbx-release-bot[bot] <167856002+mongodb-dbx-release-bot[bot]@users.noreply.github.com>
2026-01-07 18:10:24 +00:00
Jeffrey A. Clark
32901018ca
Prepare 4.16.0 release (#2672) 2026-01-07 12:03:02 -05:00
Steven Silvester
1be94d262d
PYTHON-5685 Fix unified spec sync metadata for csot and sessions tests (#2669) 2026-01-05 18:04:05 -05:00
Rin
6585d9cb51
PYTHON-2442: Refactor: use _asdict() in _options_dict() (#2670)
Co-authored-by: Steven Silvester <steve.silvester@mongodb.com>
2025-12-30 10:41:37 -06:00
Jeffrey A. Clark
fdb1f7ea4a
PYTHON-5677 Prevent ClientEncryption from loading crypt shared library (#2659)
Co-authored-by: Kevin Albertson <kevin.albertson@mongodb.com>
2025-12-29 17:16:34 -05:00
dependabot[bot]
0cd9763423
Bump zizmorcore/zizmor-action from cb3d8e846e148d1111d90b03375b9c03deceda37 to 706c51b5bce7adb027de71ab36d865f5d3fcc7b7 in the actions group (#2667)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-12-29 09:16:13 -06:00
Steven Silvester
2f263d4d3f
PYTHON-5680 Fix handling of expectedDocuments in Unified Test Runner (#2665) 2025-12-29 09:09:56 -06:00
Tim Graham
e9658b2406
Add 4.15.5 release date to changelog (#2666) 2025-12-26 16:46:28 -05:00
dependabot[bot]
10dd20405b
Update coverage[toml] requirement from <=7.10.6,>=5 to >=5,<=7.10.7 (#2662)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Steven Silvester <steve.silvester@mongodb.com>
Co-authored-by: Casey Clements <caseyclements@users.noreply.github.com>
2025-12-23 14:20:52 -05:00
mongodb-drivers-pr-bot[bot]
130067799c
[Spec Resync] 12-22-2025 (#2663)
Co-authored-by: Cloud User <ec2-user@ip-10-128-23-103.ec2.internal>
Co-authored-by: Steven Silvester <steve.silvester@mongodb.com>
2025-12-23 09:59:06 -06:00
Steven Silvester
18c1f142b5
PYTHON-5529 Introduce optin setting to await for MinPoolSize population (#2664) 2025-12-23 06:43:32 -06:00
dependabot[bot]
6ccaae5772
Bump furo from 2025.9.25 to 2025.12.19 (#2661)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Steven Silvester <steve.silvester@mongodb.com>
2025-12-22 10:23:11 -05:00
dependabot[bot]
5b13ae006a
Bump github/codeql-action from 4.31.8 to 4.31.9 in the actions group (#2660)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-12-22 07:41:08 -06:00
Steven Silvester
c930c69776
PYTHON-5566 & PYTHON-3132 Add minimum version checks for remaining test variants (#2650) 2025-12-19 13:14:52 -06:00
Adam Johnson
b1ea391842
PYTHON-5679 Optimize ObjectId (#2656)
Co-authored-by: Steven Silvester <steven.silvester@ieee.org>
2025-12-18 06:16:29 -06:00
Adam Johnson
e5070789cc
PYTHON-5679 Optimize ObjectId.__str__() (#2657)
Co-authored-by: Steven Silvester <steven.silvester@ieee.org>
2025-12-18 06:16:02 -06:00
Jib
60289f0398
PYTHON-5433 (hotfix): Fix typing check for sbom requirements file (#2655) 2025-12-17 20:37:58 -06:00
dependabot[bot]
1e78bd4d46
Bump mypy from 1.19.0 to 1.19.1 (#2652)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Steven Silvester <steve.silvester@mongodb.com>
Co-authored-by: Jib <jib.adegunloye@mongodb.com>
2025-12-16 13:33:40 -06:00
Steven Silvester
029c74cb3a
PYTHON-5670 Restore minimal support for Python 3.9 (#2640) 2025-12-16 13:32:40 -06:00
Steven Silvester
0ce7686c64
PYTHON-5563 Fix unified test discovery (#2644) 2025-12-16 13:30:30 -06:00
Jib
f9f48bab95
PYTHON-5433: Create an sbom-requirements.txt file to capture optional dependencies (#2649) 2025-12-16 14:29:15 -05:00
Noah Stapp
0cfba4994d
PYTHON-5662 - Add support for server selection's deprioritized servers to all topologies (#2639) 2025-12-16 12:21:45 -05:00
dependabot[bot]
f813437154
Bump the actions group with 6 updates (#2651)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-12-16 06:17:06 -06:00
Steven Silvester
27ac7bd717
PYTHON-2517 Remove any Jython specific code or workarounds (#2641) 2025-12-12 12:36:11 -06:00
Steven Silvester
2f7946f523
PYTHON-4099 Add contributing docs for memory profiling (#2646) 2025-12-11 09:58:53 -06:00
Steven Silvester
da6d3d9e62
PYTHON-5673 Only update sbom when core dependencies change (#2647) 2025-12-11 06:18:38 -06:00
Jeffrey A. Clark
37632e70d6
PYTHON-5669 setup-tests.sh should support --active (#2648) 2025-12-10 22:29:00 -05:00
mongodb-dbx-release-bot[bot]
a9923507c5
BUMP 4.16.0.dev1
Signed-off-by: mongodb-dbx-release-bot[bot] <167856002+mongodb-dbx-release-bot[bot]@users.noreply.github.com>
2025-12-11 00:32:47 +00:00
dependabot[bot]
1496b8d2ff
Bump the actions group with 3 updates (#2637)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Iris <58442094+sleepyStick@users.noreply.github.com>
2025-12-10 12:59:49 -08:00
mongodb-drivers-pr-bot[bot]
ab8b99a005
[Spec Resync] 12-01-2025 (#2632)
Co-authored-by: Cloud User <ec2-user@ip-10-128-26-154.ec2.internal>
Co-authored-by: Jeffrey A. Clark <aclark@aclark.net>
Co-authored-by: Iris Ho <iris.ho@mongodb.com>
2025-12-10 11:49:27 -08:00
Steven Silvester
ae88b5a08f
PYTHON-5530 Reduce usage of legacy test runner (#2642) 2025-12-10 13:40:24 -06:00
dependabot[bot]
49e59d41b2
PYTHON-5661 Bump mypy from 1.18.2 to 1.19.0 (#2629)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Steven Silvester <steven.silvester@ieee.org>
Co-authored-by: Steven Silvester <steve.silvester@mongodb.com>
2025-12-10 10:37:29 -06:00
Steven Silvester
e7aab567bf
PYTHON-4783 Remove reference to RHEL7 in tests (#2643) 2025-12-10 09:06:49 -06:00
Casey Clements
2195866ba7
PYTHON-5355 Addition of API to move to and from NumPy ndarrays and BSON BinaryVectors (#2590)
Co-authored-by: Jib <Jibzade@gmail.com>
Co-authored-by: Noah Stapp <noah.stapp@mongodb.com>
2025-12-05 11:39:22 -05:00
Kevin Albertson
3093a7c7cb
PYTHON-5664 extract using tar command (#2636) 2025-12-04 11:58:10 -05:00
Jib
44baec9e9c
PYTHON-5401: Revise pull request template for better structure (#2626) 2025-12-04 10:49:30 -05:00
dependabot[bot]
bd6decb8c0
Bump zizmorcore/zizmor-action from b0e5c0b2b3785bc67b9b6c743fdbd495cda1b4c4 to c0e2b1c877e25a91d1d747c438d49199cad29698 in the actions group (#2630)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Jib <jib.adegunloye@mongodb.com>
2025-12-02 10:45:03 -05:00
Casey Clements
6011df9e37
PYTHON-5643 Add contributor docs for the test.utils_shared.delay function (#2628) 2025-12-01 15:17:35 -05:00
Casey Clements
8bf8263391
PYTHON-5656: Fixes broken link to aggregation pipeline docs. (#2627) 2025-12-01 15:15:09 -05:00
Cal Jacobson
222a55f8cd
PYTHON-5653: fix - correct return type annotation for find_one_and_* methods to include None (#2615)
Co-authored-by: Jib <jib.adegunloye@mongodb.com>
Co-authored-by: Casey Clements <caseyclements@users.noreply.github.com>
2025-11-25 15:36:33 -05:00
Kevin Albertson
3d76c84b2a
PYTHON-5647 remove redundant entry for *.mongodbgov.net (#2625) 2025-11-25 14:27:28 -06:00
dependabot[bot]
881094015b
Bump the actions group with 7 updates (#2620)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-11-24 13:58:34 -06:00
Noah Stapp
42cf3407c8
PYTHON-5642 - getMore operations should do server selection if the server is unknown (#2621) 2025-11-24 11:43:48 -05:00
github-actions[bot]
1a434c7c59
chore: Update SBOM (#2623)
Co-authored-by: blink1073 <2096628+blink1073@users.noreply.github.com>
2025-11-24 10:34:44 -06:00
thanhnguyen-mdb
cef27b18d9
PYTHON-5433 - Fix Silkbomb issues (#2622) 2025-11-24 10:21:00 -06:00
Kevin Albertson
a9c034426b
PYTHON-5647 extend ALLOWED_HOSTS (#2618) 2025-11-21 10:33:18 -06:00
mongodb-drivers-pr-bot[bot]
0c5eec790b
[Spec Resync] 11-10-2025 (#2609)
Co-authored-by: Cloud User <ec2-user@ip-10-128-24-49.ec2.internal>
Co-authored-by: Noah Stapp <noah.stapp@mongodb.com>
Co-authored-by: Jib <jib.adegunloye@mongodb.com>
2025-11-21 11:13:29 -05:00
github-actions[bot]
47da699a87
chore: Update SBOM (#2619)
Co-authored-by: blink1073 <2096628+blink1073@users.noreply.github.com>
2025-11-20 18:41:46 -06:00
thanhnguyen-mdb
71e0c950e1
PYTHON-5433 - Added SBOM update automation (#2617) 2025-11-20 15:02:46 -06:00
dependabot[bot]
44a58f1650
Bump pyright from 1.1.406 to 1.1.407 (#2603)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Jib <jib.adegunloye@mongodb.com>
Co-authored-by: Steven Silvester <steve.silvester@mongodb.com>
2025-11-13 12:22:00 -06:00
dependabot[bot]
63acab96cf
Bump the actions group with 2 updates (#2608)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-11-11 09:23:32 -06:00
dependabot[bot]
eb25ce420e
Bump the actions group across 1 directory with 4 updates (#2604) 2025-11-05 12:20:45 -06:00
Rogdham
f278e471d1
PYTHON-5522: Support std lib zstandard in 3.14 (#2592) 2025-10-31 16:14:14 -05:00
Noah Stapp
5f00966f9c
[TASK]-[PYTHON-5623]: Change with_transaction callback return type to Awaitable (#2594)
Co-authored-by: Logan Pulley <logan@pulley.host>
2025-10-29 14:31:25 -04:00
Noah Stapp
b607ef144c
PYTHON-5214 - Improve BSON decoding InvalidBSON error message (#2605) 2025-10-29 14:30:18 -04:00
Noah Stapp
fd02550349
PYTHON-5628 - Update the link for help in the documentation (#2602) 2025-10-27 11:41:14 -04:00
Noah Stapp
0c8a22b87d
PYTHON-5627 - Update feedback link (#2601) 2025-10-24 15:26:46 -04:00
Steven Silvester
a5f6d638b9
PYTHON-5615 Use uv python when python toolchain is not available (#2597) 2025-10-22 17:22:22 -05:00
Noah Stapp
ad1167d01e
[Task]-PYTHON-5626: Remove project.license toml table (#2595) 2025-10-21 15:57:36 -04:00
Noah Stapp
faa77eab43
[Task] PYTHON-5561: Add support for PyPy 3.11 (#2596) 2025-10-21 13:06:41 -04:00
dependabot[bot]
6a796c8668
Bump furo from 2025.7.19 to 2025.9.25 (#2565)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Steven Silvester <steve.silvester@mongodb.com>
2025-10-10 11:27:01 -05:00
Steven Silvester
6d91859659
PYTHON-5611 Fix python binary usage for Other Hosts (#2586) 2025-10-08 12:26:16 -05:00
Steven Silvester
5eb1edf315
PYTHON-5609 Add 4.15.3 release to changelog (#2585) 2025-10-08 07:36:44 -05:00
Casey Clements
d595913117
PYTHON-5598 Add generate_config method to ensure auth is tested on free-threaded python 3.14t (#2580) 2025-10-07 15:43:07 -04:00
Iris
89a4eaa36c
PYTHON-5576: add PR template to mongo-python-driver (#2567) 2025-10-07 12:34:56 -07:00
Steven Silvester
491f5ba77f
PYTHON-5588 Fix python binary used in FIPS tests (#2581) 2025-10-07 12:30:06 -05:00
Steven Silvester
84772bd8a9
PYTHON-5604 Skip ECS tests until we can test on Ubuntu 22 (#2582) 2025-10-07 11:07:44 -05:00
Steven Silvester
a2e39ada00
PYTHON-5596 Fix return type for distinct methods (#2576) 2025-10-07 11:04:16 -05:00
dependabot[bot]
46974363b4
PYTHON-5538 Fix lock file handling and bump pyright from 1.1.405 to 1.1.406 (#2575)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Steven Silvester <steve.silvester@mongodb.com>
2025-10-06 13:02:53 -05:00
Jeffrey A. Clark
406bed0418
PYTHON-5597 Upgrade to macos-latest (#2578) 2025-10-06 13:10:31 -04:00
dependabot[bot]
16a2fea219
Bump the actions group with 3 updates (#2574)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Steven Silvester <steve.silvester@mongodb.com>
2025-10-06 10:31:00 -05:00
Noah Stapp
52400e11a1
PYTHON-5571 - Fix memory leak when raising InvalidDocument with C extensions (#2573) 2025-10-06 09:25:57 -04:00
Noah Stapp
d47bd9cf95
PYTHON-5024 - Add 3.14t as a standard Python matrix version (#2563) 2025-10-03 13:03:07 -04:00
Casey Clements
6bdf07e726
PYTHON-5585 Add jira.mongodb.org/secure/ReleaseNote links to linkcheck_ignore (#2572) 2025-10-02 17:48:22 -04:00
Casey Clements
e3910f868b
PYTHON-5593 Adds v4.15.2 notes to changelog (#2570) 2025-10-02 13:43:31 -04:00
dependabot[bot]
215b3b1938
Bump github/codeql-action from 3.30.3 to 3.30.5 in the actions group (#2564)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-10-01 13:51:14 -04:00
Steven Silvester
67384f0f08
PYTHON-5550 Add a test that uses uvloop as the event loop (#2543) 2025-09-30 12:30:00 -05:00
Steven Silvester
b291807106
PYTHON-5587 Remove check for dnspython version (#2566) 2025-09-30 11:39:51 -05:00
dependabot[bot]
8d4518287c
Bump mypy from 1.18.1 to 1.18.2 (#2551)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Steven Silvester <steven.silvester@ieee.org>
Co-authored-by: Iris Ho <iris.ho@mongodb.com>
2025-09-29 11:29:57 -07:00
Iris
4839e523c8
PYTHON-5569: [Build Failure] Spec Resync job is failing silently (#2553) 2025-09-29 10:29:08 -07:00
Steven Silvester
e0767cf5a1
PYTHON-5479 Drop support for Python 3.9 (#2562)
Co-authored-by: Noah Stapp <noah@noahstapp.com>
2025-09-26 09:54:19 -05:00
Steven Silvester
0d93ec48a5
PYTHON-5573 Require dnspython 2.6.1+ (#2559) 2025-09-25 13:09:33 -05:00
Steven Silvester
1f308c841f
PYTHON-5480 Update Python 3.9-specific tests to use Python 3.10 (#2560) 2025-09-25 12:52:30 -05:00
Noah Stapp
eb0cedd969
PYTHON-5577 - Drop support for OpenSSL 1.0.2 (#2561) 2025-09-25 11:16:17 -04:00
Steven Silvester
fad2ccb0e7
PYTHON-5565 Add minimum version test for Encryption (#2547) 2025-09-25 09:28:39 -05:00
Steven Silvester
448a4944ff
PYTHON-5574 Allow uv lockfile to update from justfile lint (#2558) 2025-09-24 19:48:03 -05:00
Iris
4849eacc10
PYTHON-5563: Change most tasks to run daily instead of weekly (#2556) 2025-09-24 11:42:14 -07:00
Noah Stapp
9e64ed1bd8
PYTHON-4755 - Stop supporting and testing against Eventlet (#2557) 2025-09-24 14:07:51 -04:00
Noah Stapp
0049dc8896
PYTHON-2390 - Retryable reads use the same implicit session (#2544) 2025-09-24 13:23:28 -04:00
Jib
51f7b408f3
PYTHON-5572: Add team members to contributors.rst (#2554) 2025-09-24 10:27:45 -04:00
Steven Silvester
29c4c2cc0f
PYTHON-5570 Do not freeze the lockfile (#2555) 2025-09-23 14:08:13 -05:00
Noah Stapp
266caf02c4
PYTHON-5449 - Do not attach invalid document in exception message (#2539) 2025-09-23 14:31:35 -04:00
Steven Silvester
6fe85436ae
PYTHON-3414 Improve error message when using incompatible dependencies (#2549) 2025-09-22 17:15:02 -05:00
dependabot[bot]
9603a85f21
Bump the actions group with 2 updates (#2550)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Steven Silvester <steve.silvester@mongodb.com>
2025-09-22 13:05:14 -05:00
Steven Silvester
ef59602e39
PYTHON-5491 Update test for dropIndex behavior change (#2546) 2025-09-18 20:08:22 -05:00
Noah Stapp
668bd8232a
PYTHON-2391 - Ensure retries do not use duplicate command payloads (#2545) 2025-09-17 16:52:00 -04:00
Steven Silvester
4936fe90bf
PYTHON-5539 Fix installation of pymongocrypt from source (#2541) 2025-09-17 13:05:52 -05:00
Steven Silvester
dba0aa94ad
PYTHON-5472 Remove driver tests for Atlas Data Lake (#2542) 2025-09-17 08:15:32 -05:00
Steven Silvester
a7a645f85f
PYTHON-5555 Fix AWS Lambda build (#2540) 2025-09-17 06:39:37 -05:00
Steven Silvester
5787acc271
PYTHON-5556 Keep uv lock file up to date (#2534) 2025-09-17 06:38:47 -05:00
Steven Silvester
4b4d74971c
PYTHON-5500 Account for extra flakiness in test_dns_failures_logging (#2533) 2025-09-17 06:38:24 -05:00
mongodb-dbx-release-bot[bot]
4b4c949997
BUMP 4.16.0.dev0
Signed-off-by: mongodb-dbx-release-bot[bot] <167856002+mongodb-dbx-release-bot[bot]@users.noreply.github.com>
2025-09-16 16:43:29 +00:00
Steven Silvester
8cf65796da
PYTHON-5542 Prepare for 4.15.1 Release (#2537) 2025-09-16 11:01:47 -05:00
Steven Silvester
7a07c02814
PYTHON-5544 Revert changes to base protocol layer (#2535) 2025-09-16 09:16:31 -05:00
dependabot[bot]
eca38b730b
Bump mypy from 1.17.1 to 1.18.1 (#2532)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-09-15 07:45:15 -05:00
dependabot[bot]
32e183baa7
Bump the actions group with 3 updates (#2531)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-09-15 07:44:32 -05:00
Jeffrey A. Clark
3da6e858d5
PYTHON-5543 PyMongoBaseProtocol should inherit from asyncio.BaseProtocol (#2528)
Co-authored-by: Noah Stapp <noah@noahstapp.com>
2025-09-11 16:37:22 -04:00
Steven Silvester
2b148867e7
PYTHON-5540 Fix usage of text_opts for older versions of pymongocrypt (#2525) 2025-09-10 16:38:55 -05:00
Steven Silvester
527cbdd18a
PYTHON-5537 Update typing dependencies (#2524) 2025-09-10 13:28:02 -05:00
dependabot[bot]
8879f2b951
Bump the actions group with 5 updates (#2519)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Steven Silvester <steve.silvester@mongodb.com>
2025-09-10 13:27:36 -05:00
mongodb-dbx-release-bot[bot]
d2653eecc6
BUMP 4.16.0.dev0
Signed-off-by: mongodb-dbx-release-bot[bot] <167856002+mongodb-dbx-release-bot[bot]@users.noreply.github.com>
2025-09-10 16:50:43 +00:00
Jeffrey A. Clark
1514e9b784
Prepare 4.15 release (#2523) 2025-09-10 12:03:54 -04:00
Steven Silvester
98e9f5ecc1
PYTHON-5538 Clean up uv lock file handling (#2522) 2025-09-10 10:36:14 -05:00
Steven Silvester
d7316afb63
PYTHON-5328 CRUD Support in Driver for Prefix/Suffix/Substring Indexes (#2521) 2025-09-10 10:35:35 -05:00
Steven Silvester
7580309e99
PYTHON-4928 Convert CSFLE spec tests to unified test format (#2520) 2025-09-08 16:01:12 -05:00
dependabot[bot]
47c5460d2e
Bump pyright from 1.1.404 to 1.1.405 (#2518)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-09-08 09:10:29 -05:00
Noah Stapp
b84e1a7ce4
PYTHON-5527 - Unified test typo in 'Expected error' (#2517) 2025-09-03 15:00:04 -04:00
Noah Stapp
c0e0554a3b
PYTHON-5521 - Update TestBsonSizeBatches.test_06_insert_fails_over_16MiB error codes (#2515) 2025-09-03 14:18:51 -04:00
Noah Stapp
d63edf7aea
PYTHON-5524 - Fix CSFLE spec test min version checks (#2516) 2025-09-03 13:35:43 -04:00
dependabot[bot]
b756bbd2a3
Bump the actions group with 2 updates (#2513)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Steven Silvester <steve.silvester@mongodb.com>
2025-09-02 08:37:19 -05:00
dependabot[bot]
b2bba67b61
Update coverage requirement from <=7.10.5,>=5 to >=5,<=7.10.6 (#2512)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-09-02 07:30:34 -05:00
Steven Silvester
6656767850
PYTHON-5486 Test Gevent with Auth and SSL (#2508) 2025-08-27 11:24:47 -05:00
Finn Womack
cffb9069fd
PYTHON-5520 Add windows arm64 wheel support (#2511) 2025-08-27 07:30:56 -05:00
Steven Silvester
0d4c84e86f
PYTHON-5519 Clean up uv handling (#2510) 2025-08-26 09:52:09 -05:00
dependabot[bot]
8c361be219
Bump the actions group with 5 updates (#2505)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Steven Silvester <steve.silvester@mongodb.com>
2025-08-26 08:24:30 -05:00
dependabot[bot]
9892e1bbe9
Update coverage requirement from <=7.10.3,>=5 to >=5,<=7.10.5 (#2507)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-08-25 11:57:35 -05:00
dependabot[bot]
cd4e5db997
Bump pyright from 1.1.403 to 1.1.404 (#2506)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-08-25 11:57:02 -05:00
Iris
3ebd93480a
PYTHON-5514 Specific assertions for "is" and "is not None" (#2502) 2025-08-25 08:54:10 -07:00
Shane Harvey
ddf9508e15
PYTHON-5510 Fix server selection log message for commitTransaction (#2503) 2025-08-22 14:51:39 -07:00
Steven Silvester
e08284bdca
PYTHON-5456 Support text indexes with auto encryption (#2500) 2025-08-21 10:55:48 -05:00
Noah Stapp
5e96353797
PYTHON-5508 - Add built-in DecimalEncoder and DecimalDecoder (#2499) 2025-08-21 06:51:00 -07:00
Steven Silvester
9a9a65c617
PYTHON-5496 Update CSOT tests for change in dropIndex behavior in 8.3 (#2498) 2025-08-20 18:42:06 -05:00
Steven Silvester
f7b94be0db
PYTHON-5143 Support auto encryption in unified tests (#2488) 2025-08-20 08:58:20 -05:00
Iris
db3d3c7022
Prep for 4.14.1 release (#2495) [master] (#2496) 2025-08-19 17:46:25 -07:00
Steven Silvester
3a26119eb3
PYTHON-5502 Fix c extensions on OIDC VMs (#2489) 2025-08-19 11:26:11 -05:00
Steven Silvester
d24b4a5697
PYTHON-5503 Use uv to install just in GitHub Actions (#2490) 2025-08-19 11:23:51 -05:00
Steven Silvester
e4b7eb52e6
PYTHON-5215 Add an asyncio.Protocol implementation for KMS (#2460) 2025-08-19 08:45:24 -05:00
Steven Silvester
37d327fbd8
PYTHON-5502 Fix handling of c extensions in Azure and GCP VMs (#2486) 2025-08-19 08:37:54 -05:00
Steven Silvester
b32da4b409
PYTHON-5492 Fix handling of MaxTimeMS message (#2484) 2025-08-18 18:52:46 -05:00
Iris
2a1523fa85
PYTHON-5488 append_metadata should not add duplicates (#2461) 2025-08-18 11:12:48 -07:00
Steven Silvester
de332c553c
PYTHON-5500 Mark test_dns_failures_logging as flaky (#2480) 2025-08-18 12:05:26 -05:00
Steven Silvester
bfa01c6a6c
PYTHON-5498 Disable C extensions for Remote KMS Tests (#2478) 2025-08-18 06:53:15 -05:00
Steven Silvester
9dbccbee2c
PYTHON-5492 Fix handling of MaxTimeMSExpired responses (#2477) 2025-08-15 19:13:51 -05:00
Steven Silvester
e44ece0b07
PYTHON-5493 Add a patch for the log order difference (#2473) 2025-08-15 11:58:39 -05:00
Steven Silvester
b83fcbb1a9
PYTHON-5349 Use drivers-evergreen-tools to start servers in GitHub Actions (#2474) 2025-08-15 09:15:37 -05:00
Steven Silvester
1ffdedc7a4
PYTHON-5492 Mark test as flaky (#2472) 2025-08-14 13:54:24 -05:00
Noah Stapp
3c786f5cd9
PYTHON-3606 - Document best practice for closing MongoClients and cursors (#2465) 2025-08-13 09:46:01 -04:00
Steven Silvester
f105789e12
Revert "Bump the actions group with 3 updates" (#2471) 2025-08-11 13:49:29 -05:00
dependabot[bot]
61e90473e6
Update coverage requirement from <=7.10.2,>=5 to >=5,<=7.10.3 (#2470)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-08-11 10:36:57 -05:00
dependabot[bot]
e79c19b4d2
Bump the actions group with 3 updates (#2469)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-08-11 10:35:58 -05:00
Steven Silvester
578a532395
PYTHON-5491 Skip non-idempotent dropIndex tests (#2467) 2025-08-08 19:52:17 -05:00
Jeffrey A. Clark
4e9b52b8d6
PYTHON-5487 Update 4.14 changelog to mention MongoDB 4.0 is no longer supported (#2462)
Signed-off-by: mongodb-dbx-release-bot[bot] <167856002+mongodb-dbx-release-bot[bot]@users.noreply.github.com>
Co-authored-by: mongodb-dbx-release-bot[bot] <167856002+mongodb-dbx-release-bot[bot]@users.noreply.github.com>
2025-08-07 14:01:08 -04:00
Noah Stapp
d88596cef1
PYTHON-5218 - Add logging statement when SRV polling fails (#2463)
Co-authored-by: Jib <Jibzade@gmail.com>
2025-08-07 13:32:11 -04:00
Noah Stapp
ad16d6e880
PYTHON-4431 - Remove ReadTheDocs Documentation in Favor of Official Docs (#2459) 2025-08-07 12:06:38 -04:00
Noah Stapp
bbb6f88fae
PYTHON-5257 - Turn on mypy disallow_any_generics (#2456) 2025-08-06 14:21:53 -04:00
Steven Silvester
d7074ba9ee
PYTHON-5454 & PYTHON-5455 Add preliminary python 3.14 support (#2451) 2025-08-05 13:01:30 -05:00
Kevin Albertson
d11cf20452
Fix In-Use Encryption examples (#2457) 2025-08-05 10:05:22 -04:00
dependabot[bot]
baec1e05f7
Bump pyright from 1.1.392.post0 to 1.1.403 (#2455)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-08-05 07:47:28 -05:00
dependabot[bot]
003ff56cbc
Bump the actions group with 2 updates (#2454)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-08-05 06:37:55 -05:00
dependabot[bot]
cbe1b9e81b
Update coverage requirement from <=7.5,>=5 to >=5,<=7.10.2 (#2453)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-08-05 06:37:25 -05:00
dependabot[bot]
0249a08201
Bump mypy from 1.14.1 to 1.17.1 (#2452)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-08-05 06:36:28 -05:00
mongodb-drivers-pr-bot[bot]
bfaab82e26
[Spec Resync] 07-28-2025 (#2447)
Co-authored-by: Cloud User <ec2-user@ip-10-128-23-129.ec2.internal>
Co-authored-by: Noah Stapp <noah.stapp@mongodb.com>
2025-07-31 11:40:02 -04:00
Noah Stapp
9f64dad687
PYTHON-5473 - Better test assertions for booleans (#2450) 2025-07-31 08:57:00 -04:00
Noah Stapp
9514a67270
PYTHON-5441 - Unskip gridfs download chunk tests (#2449) 2025-07-31 08:54:12 -04:00
dependabot[bot]
59d94f397b
Bump the actions group with 3 updates (#2446)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-07-28 11:32:04 -05:00
Steven Silvester
ffb372aec7
PYTHON-5027 Test Windows with Python 3.14t (#2444) 2025-07-24 13:20:19 -05:00
Steven Silvester
06872f7f03
PYTHON-4780 Implement fast path for server selection with Primary (#2416) 2025-07-22 10:23:26 -05:00
dependabot[bot]
5a640daf92
Bump astral-sh/setup-uv from 6.3.1 to 6.4.1 in the actions group (#2441)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-07-22 07:52:15 -05:00
dependabot[bot]
f9b2f711c0
Bump furo from 2024.8.6 to 2025.7.19 (#2440)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-07-22 07:51:49 -05:00
Iris
31cca98656
PYTHON-5253 Automated Spec Resync Quick Followup/Fix (#2443) 2025-07-21 14:18:39 -07:00
Steven Silvester
cf2630148a
PYTHON-4677 Specify how maxTimeMS can be set for explain helpers (#2439) 2025-07-18 12:04:10 -05:00
Steven Silvester
55d399b75a
PYTHON-4019 Infinite loop in generic transactional provider due to dup keys (#2438) 2025-07-17 09:29:11 -05:00
Steven Silvester
fed738df42
PYTHON-5444 Update OIDC tests use camelCase options (#2436) 2025-07-16 16:27:59 -05:00
Steven Silvester
6ef91357b2
PYTHON-4884 Test encoding dates after year 9999 with Relaxed Extended JSON (#2437) 2025-07-16 16:27:26 -05:00
Steven Silvester
36bb704c76
PYTHON-5237 Relax requirement for optional fields for sessions unified tests (#2435) 2025-07-15 20:26:29 -05:00
Steven Silvester
71514b5989
PYTHON-5152 Sunset Astrolabe (#2434) 2025-07-15 20:25:13 -05:00
Steven Silvester
3be7f76763
PYTHON-4203 Update prose tests for mongos deprioritization during retryable ops (#2430) 2025-07-15 15:38:15 -05:00
Iris
83fcf7cd08
PYTHON-4931 Add spec tests for GridFS rename (#2431) 2025-07-15 12:15:05 -07:00
Casey Clements
4a29fbda69
PYTHON-5289 Fixes indentation in docstring of Binary.from_vector (#2432) 2025-07-15 11:27:38 -07:00
Casey Clements
1e67c5c02c
PYTHON-5289 Validate ignored bits are 0 on write for bson.BinaryVector (#2397) 2025-07-15 10:17:30 -07:00
Iris
ca3cbc3f31
PYTHON-5253 Automated Spec Test Sync (#2409)
Co-authored-by: Noah Stapp <noah@noahstapp.com>
2025-07-15 08:34:47 -07:00
Steven Silvester
84db915d91
PYTHON-5361 Fix timeouts in CSE custom endpoint test (#2426) 2025-07-14 12:27:22 -05:00
Steven Silvester
5ce53dc175
PYTHON-5374 Assert unset BulkWriteException.partialResult in CRUD prose tests (#2425)
Co-authored-by: Noah Stapp <noah@noahstapp.com>
2025-07-14 10:47:38 -05:00
Steven Silvester
e07a6b7e77
PYTHON-5439 Remove dead link in PyMongo 4 migration guide (#2428) 2025-07-14 10:24:09 -05:00
Steven Silvester
7b82b3582f
PYTHON-5440 Use dochub link for index-wildcard (#2427) 2025-07-14 10:03:33 -05:00
Steven Silvester
f29c7b1f15
PYTHON-5315 Mark test_recover_from_initially_erroring_seedlist as flaky (#2424) 2025-07-10 06:32:43 -05:00
Kevin Albertson
04f2cc0fa9
PYTHON-5373 test client auth on cloud-dev (#2423) 2025-07-09 11:56:42 -04:00
Iris
c77c15e369
PYTHON-5421 continued - update changelog, update docstring, and add testing (#2420) 2025-07-07 14:00:11 -07:00
Noah Stapp
11d3488026
PYTHON-5415 - Unskip tests that rely on server hostname (#2398) 2025-07-07 09:59:48 -04:00
dependabot[bot]
d6ab555b81
Bump the actions group with 2 updates (#2422)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-07-07 07:17:35 -05:00
Steven Silvester
c788c7e0c1
PYTHON-5431 Include assume role creds in backport task (#2418) 2025-07-03 13:36:22 -05:00
Steven Silvester
1d21d27dda
PYTHON-5430 Use the zizmor action (#2417) 2025-07-03 12:30:35 -05:00
rishitb-mongodb
dde8837fb2
DRIVERS-3105: Update README.md to add mention of SemVer adherence (#2391) 2025-07-02 17:04:40 -04:00
Iris
947fbe33ee
PYTHON-5421 Make parse_uri() return "options" as a dict rather than _CaseInsensitiveDictionary (#2413) 2025-07-02 09:51:50 -07:00
Steven Silvester
2eb18f18b2
PYTHON-5428 Mark test_connection_close_does_not_block_other_operations as flaky (#2415) 2025-07-02 11:22:12 -05:00
Steven Silvester
0b2900d162
PYTHON-5413 Handle flaky tests (#2395) 2025-07-01 15:42:58 -05:00
Iris
578c6c2ad2
PYTHON-5423 Always use subprocess.run instead of subprocess.check_call or subprocess.call (#2412) 2025-06-30 11:08:42 -07:00
dependabot[bot]
ed26975926
Bump the actions group across 1 directory with 3 updates (#2411)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-06-30 07:42:55 -05:00
Iris
0e407351a4
PYTHON-5392 Better test assertions for comparisons (#2350)
Co-authored-by: Noah Stapp <noah@noahstapp.com>
2025-06-27 14:06:00 -07:00
Noah Stapp
6a672d4dd3
PYTHON-5382 - Add a test with min dependencies (#2410) 2025-06-27 14:41:53 -04:00
Jib
0cb4b2f1a6
PYTHON-5287: create CODEOWNERS (#2408) 2025-06-27 12:58:11 -04:00
Noah Stapp
244f17d57b
PYTHON-5404 - Add docs + justfile target for profiling execution (#2402) 2025-06-26 16:37:03 -04:00
Iris
65f7c54208
PYTHON-5344 and PYTHON-5403 Allow Instantiated MongoClients to Send Client Metadata On-Demand (#2358) 2025-06-24 09:34:53 -07:00
Noah Stapp
e2bfa9a590
PYTHON-5248 - Drop support for MongoDB 4.0 (#2353) 2025-06-20 14:25:19 -04:00
Casey Clements
4ea0288eaa
PYTHON-5126 Updated changelog to reflect breaking change in bson.binary.BinaryVector (#2394)
Co-authored-by: Steven Silvester <steve.silvester@mongodb.com>
2025-06-20 09:40:05 -04:00
Casey Clements
336163aaa0
PYTHON-5126 - Implemented new test cases for Binary Vector (#2393) 2025-06-18 13:35:23 -04:00
Steven Silvester
8a94de1c1b
PYTHON-5343 Clean up contributing docs (#2390) 2025-06-16 11:51:46 -05:00
dependabot[bot]
87c015fbcf
Bump github/codeql-action from 3.28.19 to 3.29.0 in the actions group (#2388)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-06-16 06:31:12 -05:00
Noah Stapp
50ea82310d
PYTHON 5212 - Use asyncio.loop.sock_connect in _async_create_connection (#2383) 2025-06-13 15:30:10 -04:00
Shane Harvey
c16ef0a13e
PYTHON-5414 Add test for hostname verification error message regression (#2385) 2025-06-13 11:45:47 -07:00
Shane Harvey
e51ac1fd1c
PYTHON-5409 Fix test_implicit_sessions_checkout again (#2384) 2025-06-13 09:33:32 -07:00
Maarten Sijm
c2aefc2eda
PYTHON-5414 Fix "module service_identity has no attribute SICertificateError" when using pyopenssl (#2382) 2025-06-12 16:45:18 -07:00
Jeffrey A. Clark
54846cd110
PYTHON-5409 Update test_session.py comment (#2381) 2025-06-11 19:24:59 -04:00
Steven Silvester
a742aa22d4
PYTHON-5411 Add 4.13.1 changelog to master (#2380) 2025-06-11 16:42:18 -05:00
Jeffrey A. Clark
dfd5573c19
PYTHON-5002 Include test/ dir in synchro gaurd (#2379) 2025-06-11 15:54:32 -04:00
Noah Stapp
8a8cb6f0af
PYTHON-5406 - Use correct client for test (#2377) 2025-06-11 13:45:54 -04:00
Steven Silvester
7e19515d7b
PYTHON-5393 Make link checking more robust (#2374) 2025-06-11 10:44:46 -05:00
Steven Silvester
f645036d71
Fix release metadata (#2372) 2025-06-10 12:26:25 -05:00
Steven Silvester
9145521dfa
PYTHON-5410 Assume ec2 role in backport task (#2369) 2025-06-10 12:12:05 -05:00
Steven Silvester
673f821acb
[v4.13] PYTHON-5406 AsyncPeriodicExecutor must reset CSOT contextvars before executing (#2367)
Co-authored-by: Noah Stapp <noah.stapp@mongodb.com>
2025-06-10 06:22:28 -05:00
Steven Silvester
1bcb85f1c1
PYTHON-5321 Remove Serverless testing (#2359) 2025-06-09 19:46:10 -05:00
Steven Silvester
0dd5a5c794
PYTHON-5405 Use legacy wait_for_read cancellation approach on Windows (#2363) 2025-06-09 19:36:44 -05:00
Shane Harvey
f50ef65dd5
PYTHON-5409 Make test_implicit_sessions_checkout less flaky (#2366) 2025-06-09 11:26:07 -07:00
dependabot[bot]
24e9da6a09
Bump github/codeql-action from 3.28.18 to 3.28.19 in the actions group (#2362)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-06-09 08:29:27 -05:00
Noah Stapp
0f6647b49a
PYTHON-5305 - Fix Create Release Branch workflow (#2361) 2025-06-09 07:55:22 -04:00
Noah Stapp
536b1cb8ab
PYTHON-5406 - AsyncPeriodicExecutor must reset CSOT contextvars befor… (#2360) 2025-06-06 13:17:36 -04:00
Steven Silvester
6d33d4fb34
PYTHON-5399 Add a prose test for OIDC reauthentication when a session is involved (#2351) 2025-06-05 09:21:10 -05:00
dependabot[bot]
454c163788
Bump astral-sh/setup-uv from 6.0.1 to 6.1.0 in the actions group (#2357)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-06-02 06:29:28 -05:00
Steven Silvester
958b3d11dc
PYTHON-5400 Migrate away from Windows Server 2019 runner image on GitHub Actions (#2355) 2025-05-30 16:30:11 -05:00
Noah Stapp
1366b9132e
PYTHON-5394 - Add native async support for OIDC (#2352) 2025-05-28 15:44:54 -04:00
Michael Šimáček
27593796fb
PYTHON-5391 Skip C extension build on GraalPy (#2349)
Co-authored-by: Steven Silvester <steve.silvester@mongodb.com>
2025-05-23 12:01:30 -05:00
Iris
b8460b6001
PYTHON-5387 Better test assertions for membership (#2348) 2025-05-23 09:04:32 -07:00
Iris
65089ead4c
PYTHON-5386 Better test assertions for isinstance (#2347) 2025-05-22 16:15:44 -07:00
Noah Stapp
717fb47c17
PYTHON-5061 - Add an API to extend the bson TypeRegistry (#2345) 2025-05-21 13:45:36 -04:00
dependabot[bot]
106343a6a2
Bump github/codeql-action from 3.28.17 to 3.28.18 in the actions group (#2343)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-05-20 07:30:00 -05:00
Jeffrey A. Clark
726a6fa98d
PYTHON-5384 Describe MongoDB specifications (#2344) 2025-05-19 19:12:41 -04:00
mongodb-dbx-release-bot[bot]
a435a3e1c3
BUMP 4.14.0.dev0
Signed-off-by: mongodb-dbx-release-bot[bot] <167856002+mongodb-dbx-release-bot[bot]@users.noreply.github.com>
2025-05-14 19:14:32 +00:00
Noah Stapp
84411b9119
Bump version to 4.13.0 for release (#2342) 2025-05-14 14:51:36 -04:00
mongodb-dbx-release-bot[bot]
397c280217
BUMP 4.13.0.dev1
Signed-off-by: mongodb-dbx-release-bot[bot] <167856002+mongodb-dbx-release-bot[bot]@users.noreply.github.com>
2025-05-14 18:23:10 +00:00
Noah Stapp
60faca0253
Update changelog for v4.13 release (#2341) 2025-05-14 14:00:46 -04:00
Noah Stapp
92a5623886
PYTHON-5377 - Update assets to align with GA release of Async PyMongo (#2339) 2025-05-14 07:45:37 -04:00
Shane Harvey
4cc5e89ebf
PYTHON-5362 WriteConcern repr should be eval-able (#2338) 2025-05-13 13:37:18 -07:00
Steven Silvester
2374f3811a
PYTHON-5379 Run more variants on pull requests (#2340) 2025-05-13 11:40:00 -05:00
Steven Silvester
75f6a3718e
Revert "PYTHON-5126 & PYTHON-5280 Addresses issues raised in DRIVERS-3097 and DRIVERS-3123 " (#2337) 2025-05-12 09:35:08 -05:00
Noah Stapp
aa41e70523
PYTHON-5369 - Re-raise socket.timeout errors if the deadline has alre… (#2326) 2025-05-12 09:28:05 -04:00
Jeffrey A. Clark
2655bb4d86
PYTHON-5033 Use PyModule_Add on >= 3.13 (#2332) 2025-05-08 17:14:26 -04:00
Noah Stapp
98b030af94
PYTHON-5356 - Init unified test client SDAM for all unified tests (#2325) 2025-05-08 15:19:31 -04:00
Noah Stapp
775b683276
PYTHON-5371 - Pass repr(ServerDescription) to logging (#2329) 2025-05-08 14:20:11 -04:00
Steven Silvester
5914ea0ff4
PYTHON-5342 Fix test_dns_failures test (#2336) 2025-05-08 13:10:11 -05:00
Steven Silvester
d0b0dc3512
PYTHON-5339 Clean up GitHub PR definitions in Evergreen Project (#2331) 2025-05-06 13:40:12 -05:00
dependabot[bot]
12b4fe3644
Bump the actions group with 2 updates (#2333)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-05-06 08:32:53 -05:00
Noah Stapp
b0667b11d3
PYTHON-5358 - Switch to supported Perf usage in EVG (#2334) 2025-05-06 09:00:30 -04:00
Steven Silvester
cf9b68c6f4
Convert Enterprise Auth Variants to use common tasks (#2330) 2025-05-02 11:54:54 -05:00
Steven Silvester
2b4ab2a9ad
PYTHON-5365 Fix handing of remote tests (#2327) 2025-05-02 11:54:03 -05:00
Steven Silvester
000391c440
PYTHON-5333 Update encryption and pyopenssl variants (#2328) 2025-05-02 10:35:34 -05:00
Steven Silvester
0ec57781d1
PYTHON-5345 Streamline the standard tasks (#2312) 2025-05-01 09:08:48 -05:00
Jeffrey A. Clark
85c5ee45b5
PYTHON-5364 Update package description (#2324) 2025-04-30 08:45:46 -04:00
Jeffrey A. Clark
08e7f036a2
PYTHON-5357 Update changelog for 4.12.1 release (#2321) 2025-04-29 09:26:40 -04:00
Noah Stapp
e7db0e34aa
PYTHON-5342 - Skip async test_srv_polling tests on Windows (#2320) 2025-04-29 08:42:22 -04:00
Steven Silvester
02c3df6fc9
PYTHON-5298 Update lock file and clean up dependency installation (#2317) 2025-04-28 13:59:36 -05:00
Jeffrey A. Clark
9a2f5678de
PYTHON-5353 Pin github actions (#2318) 2025-04-28 11:48:32 -04:00
Noah Stapp
1dc45fddc1
PYTHON-5322 - Increase test_streaming_protocol.TestStreamingProtocol test_monitor_waits_after_server_check_error timeout (#2315) 2025-04-25 13:27:27 -04:00
Casey Clements
2ebd2aaecd
PYTHON-5336 Added VECTOR_SUBTYPE line to API docs (#2313) 2025-04-25 12:24:22 -04:00
Iris
c3e3373df2
PYTHON-5309 Ensure AsyncMongoClient doesn't use PyOpenSSL (#2286)
Co-authored-by: Noah Stapp <noah@noahstapp.com>
2025-04-24 16:19:09 -07:00
Steven Silvester
dae4f7f159
PYTHON-5348 Fix CodeQL Scanning for GitHub Actions (#2308) 2025-04-24 09:28:10 -05:00
Noah Stapp
34f7d7ee4c
PYTHON-5346 - test_init_disconnected_with_srv cannot run against shar… (#2304) 2025-04-23 16:32:39 -04:00
Noah Stapp
1bdf035802
PYTHON-5212 changelog update (#2306) 2025-04-23 16:32:08 -04:00
Steven Silvester
42cb70e9ab
PYTHON-5341 Fix handling of SSL tests with Stable API (#2305) 2025-04-23 14:43:49 -05:00
Noah Stapp
09897b698e
PYTHON-5212 - Do not hold Topology lock while resetting pool (#2301) 2025-04-23 15:13:38 -04:00
Shane Harvey
e2e673edeb
PYTHON-5314 Fix default imports for modules that worked in v4.8 (#2300) 2025-04-22 11:44:58 -07:00
Noah Stapp
412d0005b8
PYTHON-5306 - Fix use of public MongoClient attributes before connection (#2285) 2025-04-21 15:53:21 -04:00
Steven Silvester
d51c70b401
PYTHON-5337 Evergreen PyOpenSSL variants should use PyOpenSSL (#2299) 2025-04-21 10:48:26 -05:00
Noah Stapp
0ee8e585c2
PYTHON-5292 - Debug logs should only print on failed tests (#2296) 2025-04-21 09:43:58 -04:00
Steven Silvester
6ed3533b73
PYTHON-5313 Create Evergreen tests that do not run orchestration (#2284) 2025-04-18 13:03:53 -05:00
Steven Silvester
0f37bfd7a1
PYTHON-5331 Convert stable api and storage tests to new task pattern (#2295) 2025-04-18 10:02:50 -05:00
Steven Silvester
5f956210f8
PYTHON-5332 Update AWS, mod_wsgi, and green framework variants (#2297) 2025-04-18 09:29:20 -05:00
Noah Stapp
094a320817
PYTHON-5284 - Update changelog for Eventlet testing removal (#2293) 2025-04-17 13:01:27 -04:00
Steven Silvester
db1449b79f
PYTHON-5330 Convert no c extensions and doctests to use the standard test pattern (#2294) 2025-04-17 09:09:49 -05:00
Noah Stapp
448c8e8326
PYTHON-5325 - Decrease TestAsyncConcurrency.test_concurrency threshold (#2291) 2025-04-16 16:16:25 -04:00
Noah Stapp
4cac781530
PYTHON-5326 - Skip serverless tests with known issue (#2292) 2025-04-16 14:31:05 -04:00
Noah Stapp
aa6fa7a696
PYTHON-5284 - Remove eventlet tests for CPython > 3.9 (#2290) 2025-04-16 14:10:10 -04:00
Noah Stapp
f476d8bd97
PYTHON-5324 - Fix Windows encryption test secrets path (#2289) 2025-04-16 13:06:09 -04:00
Steven Silvester
149fe390d4
PYTHON-5188 Make version setting a part of the release process (#2288) 2025-04-16 10:40:25 -05:00
Steven Silvester
846b1fc25c
PYTHON-5316 Update tests for other hosts (#2287) 2025-04-16 08:50:51 -05:00
Steven Silvester
b83389d6bc
PYTHON-5311 Create standard linux evergreen tasks (#2282) 2025-04-15 14:44:09 -05:00
Noah Stapp
e6a4a7145e
PYTHON-5310 - Fix uri_parser AttributeError when used directly (#2283) 2025-04-15 08:05:20 -04:00
Steven Silvester
3723edc199
PYTHON-5277 Convert remaining Evergreen functions to generated config (#2281) 2025-04-14 09:35:37 -05:00
Steven Silvester
5d14b3458e
PYTHON-5304 Create standard non-linux tests (#2275) 2025-04-14 08:09:08 -05:00
Shane Harvey
a8197a792e
PYTHON-5308 Remove SON from doc examples (#2280) 2025-04-11 14:58:03 -07:00
Steven Silvester
7ec9c07081
PYTHON-5303 Add missing gridfs synchronous init file (#2279) 2025-04-11 16:20:08 -05:00
Noah Stapp
7a0afcf0b9
PYTHON-5302 - Run ruff before synchro in pre-commit hooks (#2274) 2025-04-10 11:08:23 -04:00
Steven Silvester
cce4a0d179
PYTHON-5295 Update lockfile for compat with older versions of uv (#2271) 2025-04-10 09:55:46 -05:00
Steven Silvester
5b42ed8cac
PYTHON-5286 Create server version variants (#2270) 2025-04-10 09:31:50 -05:00
Noah Stapp
5b0862e78e
PYTHON-5297 - AsyncMongoClient connection error causes UnboundLocalError (#2273) 2025-04-10 10:30:09 -04:00
Jeffrey A. Clark
86e221eb5c
PYTHON-5288: SRV hostname validation fails when resolver and resolved hostnames are identical with three domain levels (#2272) 2025-04-09 18:00:04 -04:00
Noah Stapp
3c2ce16ad8
PYTHON-5283 - Skip test.test_monitor.TestMonitor.test_cleanup_executo… (#2268) 2025-04-09 15:14:35 -04:00
Casey Clements
fafa00e9e3
PYTHON-5126 & PYTHON-5280 Addresses issues raised in DRIVERS-3097 and DRIVERS-3123 (#2261) 2025-04-09 09:09:42 -04:00
Steven Silvester
175481e35d
PYTHON-5282 Move config utility functions to separate file (#2267) 2025-04-08 11:31:13 -05:00
Steven Silvester
93886286a3
PYTHON-5275 Fix handlig of FIPS build (#2266) 2025-04-08 11:30:17 -05:00
Noah Stapp
bc2cc1ed58
PYTHON-4924 - PoolClearedError should have TransientTransactionError … (#2244) 2025-04-08 11:39:06 -04:00
mongodb-dbx-release-bot[bot]
2c077ba8a4
BUMP 4.13.0.dev0
Signed-off-by: mongodb-dbx-release-bot[bot] <167856002+mongodb-dbx-release-bot[bot]@users.noreply.github.com>
2025-04-08 13:12:35 +00:00
mongodb-dbx-release-bot[bot]
98b656f286
BUMP 4.12.0
Signed-off-by: mongodb-dbx-release-bot[bot] <167856002+mongodb-dbx-release-bot[bot]@users.noreply.github.com>
2025-04-08 12:52:55 +00:00
Steven Silvester
92970d39fd
PYTHON-5248 Update changelog for 4.12 release (#2265) 2025-04-07 19:34:44 -05:00
Shane Harvey
4d4a26cbbe
PYTHON-5270 Server selection should log remainingTimeMS as milliseconds (#2263) 2025-04-07 11:34:01 -07:00
Steven Silvester
7a4218f0ad
PYTHON-5263 Convert s3-related functions to generated config (#2259) 2025-04-07 10:36:35 -05:00
Steven Silvester
79e5d60139
PYTHON-5268 Fix handling of PYTHON_BINARY (#2264) 2025-04-07 09:48:05 -05:00
Steven Silvester
bf0aa56fbb
PYTHON-5252 Add dependency on pymongocrypt 1.13 (#2258) 2025-04-04 20:00:41 -05:00
Noah Stapp
708ce16961
PYTHON-4724 - Prohibit AsyncMongoClient from being used across multiple event loops (#2256) 2025-04-04 13:22:22 -04:00
Jeffrey A. Clark
1c813dc648
PYTHON-4575 Allow valid SRV hostnames with less than 3 parts (#2234) 2025-04-04 13:09:04 -04:00
Noah Stapp
e7c0814512
PYTHON-4557 - Fix write log messages for retried commands (#2260) 2025-04-03 15:33:11 -04:00
Noah Stapp
b40223938c
PYTHON-5219 - Avoid awaiting coroutines when holding locks (#2250) 2025-04-03 15:32:47 -04:00
Shane Harvey
8b668898b8
PYTHON-5208 Add spec test for wait queue timeout errors do not clear the pool (#2199)
Also stop running the ping command to advance session cluster times in the unified tests.
2025-04-03 12:05:45 -07:00
Steven Silvester
5177e4ec53
PYTHON-5261 Clean up compression variants (#2257) 2025-04-02 14:20:44 -05:00
Steven Silvester
7243b43e63
PYTHON-5245 Convert remaining tasks to generated config (#2255) 2025-04-02 10:42:43 -05:00
Steven Silvester
61033760e5
PYTHON-5260 Fix OCSP test setup (#2254) 2025-04-02 09:53:49 -05:00
Noah Stapp
3210b175dd
PYTHON-4557 - Add log message for retried commands (#2248) 2025-04-02 08:29:23 -04:00
Noah Stapp
04ebbcde87
PYTHON-5259 - Better test assertions for error substrings (#2253) 2025-04-02 08:22:25 -04:00
Noah Stapp
e724d66bb5
PYTHON-5250 - Change streams expanded events present by default in 8.2+ (#2252) 2025-04-01 15:01:38 -04:00
Iris
7424f6c098
PYTHON-5242 MongoClient does not define all attributes in __init__ (#2249) 2025-04-01 11:41:33 -07:00
Steven Silvester
894782e1b3
PYTHON-5255 Fix OIDC allowed_hosts test (#2251) 2025-04-01 12:19:06 -05:00
Steven Silvester
02fc85f635
PYTHON-5239 Audit bash scripts for consistency (#2238) 2025-03-31 19:27:56 -05:00
Steven Silvester
9ff5a1755c
PYTHON-3674 Simplify transaction options in convenient API doc example code (#2230) 2025-03-31 19:26:18 -05:00
Steven Silvester
711a45a0e9
PYTHON-4938 Clarify write concern rules in the transactions spec (#2231) 2025-03-31 19:23:32 -05:00
Noah Stapp
4bffc4e492
PYTHON-4471 - Logging records should have a standard field order (#2247) 2025-03-31 16:06:31 -04:00
Noah Stapp
d1c14150dc
PYTHON-5154 - Remove PyOpenSSL support from Async PyMongo (#2246) 2025-03-31 15:04:05 -04:00
Noah Stapp
a3f3ec52bc
PYTHON-4946 - Add GridFSBucket.rename_by_name (#2219) 2025-03-31 14:02:06 -04:00
Noah Stapp
8675a163df
PYTHON-4947 - GridFS spec: Add performant 'delete revisions by filena… (#2218) 2025-03-31 09:07:53 -04:00
Steven Silvester
58a41ae7f5
PYTHON-4020 Drivers should unpin connections when ending a session (#2239) 2025-03-28 15:31:56 -05:00
Noah Stapp
c326161379
PYTHON-4933 - Allow drivers to set bypassDocumentValidation: false on… (#2227) 2025-03-28 15:56:37 -04:00
Noah Stapp
e51ad27d20
PYTHON-4493 - Use asyncio protocols instead of sockets for network IO (#2151)
Co-authored-by: Shane Harvey <shnhrv@gmail.com>
2025-03-28 15:02:40 -04:00
Noah Stapp
f3ca1e0372
PYTHON-4833 - Add Collection bulk_write benchmarks (#2245) 2025-03-28 13:48:46 -04:00
Noah Stapp
a0951515f4
PYTHON-5238 - Add async GridFS API docs (#2235) 2025-03-28 11:12:49 -04:00
Steven Silvester
a1b4a7481c
PYTHON-5243 Migrate remaining variants to generated config (#2243) 2025-03-28 08:38:52 -05:00
Steven Silvester
0c6f84642c
PYTHON-4942 & PYTHON-4936 Test that isClientError considers network errors and operations may be an empty array (#2236) 2025-03-27 13:09:09 -05:00
Steven Silvester
33843d285b
PYTHON-5234 Clean up load balancer variants (#2241) 2025-03-27 12:56:21 -05:00
Steven Silvester
3875cc6e1b
PYTHON-5421 Fix handling of client timeout property (#2240) 2025-03-27 11:43:37 -05:00
Steven Silvester
53c4694cf9
PYTHON-5233 Allow python version to be set at the task level (#2228) 2025-03-27 08:57:41 -05:00
Steven Silvester
3a3f3d2214
PYTHON-5240 Add pre-commit hook for config generation (#2237) 2025-03-27 08:39:12 -05:00
Steven Silvester
4e5166b29a
PYTHON-3712 Deprecate sharded-replicaset topology type and clean up redundant runOnRequirements (#2232) 2025-03-26 17:39:10 -05:00
Steven Silvester
2149567ed3
PYTHON-5236 Test sharded clusters with requireApiVersion=1 (#2229) 2025-03-25 17:28:08 -05:00
Noah Stapp
2c1a1608f2
PYTHON-5169 - Deprecate Hedged Reads option (#2213)
Co-authored-by: Shane Harvey <shnhrv@gmail.com>
2025-03-25 17:00:19 -04:00
Iris
eea8a37257
PYTHON-3636 AsyncMongoClient should perform SRV resolution lazily (#2191)
Co-authored-by: Noah Stapp <noah@noahstapp.com>
Co-authored-by: Shane Harvey <shane.harvey@mongodb.com>
2025-03-25 13:45:06 -07:00
Steven Silvester
38ceda4c09
PYTHON-5189 Explicitly test drivers on Graviton processors (#2222) 2025-03-25 13:42:29 -05:00
Steven Silvester
95cedeefb8
PYTHON-5232 Fix aws lambda test setup (#2226) 2025-03-25 13:40:03 -05:00
Steven Silvester
894d5e1c7f
PYTHON-5231 Finish up test scripts and add documentation for creating a new test suite (#2224) 2025-03-25 12:53:23 -05:00
Noah Stapp
43fa11cb80
PYTHON-4939 - Sync CSOT runCursorCommand test (#2221) 2025-03-25 13:46:44 -04:00
Noah Stapp
4403169821
PYTHON-4940 - Add index hint as an explicit parameter for distinct command. (#2225) 2025-03-25 11:20:10 -04:00
Noah Stapp
fa5e637da8
PYTHON-4937 - Add support for 'number' alias in $$type operator (#2223) 2025-03-25 11:01:07 -04:00
Noah Stapp
296046cc38
PYTHON-5121 - Use canonical Extended JSON for BSON binary vector spec… (#2215) 2025-03-24 16:02:10 -04:00
Noah Stapp
df30eff390
PYTHON-5135 - Rename WriteConcernFailed code name to WriteConcernTimeout (#2214) 2025-03-24 15:37:00 -04:00
Noah Stapp
dec13a8020
PYTHON-4990 - Remove deprecated field from GridFS unified tests (#2216) 2025-03-24 14:14:53 -04:00
Noah Stapp
f77e1ac119
PYTHON-4961 - Split updateWithPipelines.yml by operation (#2217) 2025-03-24 11:45:12 -04:00
Noah Stapp
e99818df08
PYTHON-5222 - Revise assertion for unacknowledged client bulkWrite result (#2212) 2025-03-24 11:14:59 -04:00
Iris
1145c9de54
PYTHON-5046 Support $lookup in CSFLE and QE (#2210) 2025-03-20 13:55:52 -07:00
Steven Silvester
737a1b7344
PYTHON-5220 Convert remaining tests to use standard test setup (#2211) 2025-03-19 20:53:35 -05:00
Steven Silvester
134f52ff23
PYTHON-5213 Convert AWS Lambda and Search Index tests to use new test scripts (#2205) 2025-03-19 15:58:12 -05:00
Steven Silvester
dc44b49128
PYTHON-5217 Update Atlas Data Lake tests (#2209) 2025-03-18 20:45:47 -05:00
Steven Silvester
1d866b3cb4
PYTHON-5216 & PYTHON-5185 Convert perf tests to use new scripts and use specific python version (#2206) 2025-03-17 18:27:43 -05:00
dependabot[bot]
4a9e90a24b
Bump extractions/setup-just from 2 to 3 in the actions group (#2207)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-17 06:25:51 -05:00
Jeffrey A. Clark
166821f22c
PYTHON-5205 Replace http with https in doc links (#2204) 2025-03-14 21:37:11 -04:00
Steven Silvester
4353278dc8
PYTHON-5207 Convert mod_wsgi tests to use the new test runner (#2202) 2025-03-14 10:38:30 -05:00
Steven Silvester
72ed1029be
PYTHON-5210 Prevent overriding the python used by other tools (#2203) 2025-03-14 06:05:21 -05:00
Noah Stapp
e6e8650cc9
PYTHON-5144 - Add async performance benchmarks (#2188) 2025-03-13 15:08:41 -04:00
Steven Silvester
5e055eea0f
PYTHON-5206 Convert Atlas Connect and Enterprise Auth tests to use new test scripts (#2201)
Co-authored-by: Noah Stapp <noah@noahstapp.com>
2025-03-13 12:00:56 -05:00
Steven Silvester
8274db2722
PYTHON-5203 Use uv from Python toolchain if available (#2200) 2025-03-13 10:18:17 -05:00
Steven Silvester
0351992ddb
PYTHON-5204 Convert Serverless tests to use new test scripts (#2197) 2025-03-13 09:28:34 -05:00
Shane Harvey
189923f7c3
PYTHON-5198 Fix test_03_invalid_keyid (#2195) 2025-03-12 15:19:40 -07:00
Steven Silvester
6e5126d6bb
PYTHON-5196 Convert OIDC tests to use new test scripts (#2194) 2025-03-12 15:47:56 -05:00
Shane Harvey
e48365c5f1
PYTHON-5202 WaitQueueTimeoutError should not clear the pool (#2192) 2025-03-12 11:21:19 -07:00
Noah Stapp
34ca759f85
PYTHON-5113 - Refactor test utils for async (#2149) 2025-03-12 12:59:56 -04:00
Steven Silvester
4322fdf7ce
PYTHON-5199 Fix handling of MongoDB version in run-server (#2193) 2025-03-12 10:17:15 -05:00
Shane Harvey
7ef18af49b
PYTHON-4580 Add key_expiration_ms option for DEK cache lifetime (#2186) 2025-03-10 17:11:38 -07:00
Shane Harvey
61d435408e
PYTHON-5194 Test secondary with IPv6 literal in SDAM (#2189) 2025-03-10 14:19:16 -07:00
Casey Clements
b66a5cb673
PYTHON-5172 bugfix: Add __repr__ and __eq__ to bson.binary.BinaryVector (#2162) 2025-03-10 15:45:32 -04:00
Steven Silvester
a548f7a3d4
PYTHON-5195 Convert OCSP tests to use new test scripts (#2190)
Co-authored-by: Noah Stapp <noah@noahstapp.com>
2025-03-10 10:25:27 -05:00
Steven Silvester
38127f458b
PYTHON-5193 & PYTHON-5192 Fix run-server usage (#2187) 2025-03-08 13:02:03 -06:00
Steven Silvester
f69e1f6f04
PYTHON-5184 Revert skip to non-lb-connection-establishment (#2185) 2025-03-06 16:53:47 -06:00
Steven Silvester
3653984f21
PYTHON-5187 Add scripts to start and stop a server (#2184) 2025-03-06 16:15:14 -06:00
Steven Silvester
85b6f182ae
PYTHON-5157 Convert aws tests to use python scripts (#2180) 2025-03-05 20:03:06 -06:00
Shane Harvey
4ffebb04e9
PYTHON-5168 Use logging for client background task errors (#2166) 2025-03-05 14:05:21 -08:00
Shane Harvey
4ed621b3e7
PYTHON-5173 Adjust test_continuous_network_errors to be less flaky (#2183) 2025-03-05 13:42:36 -08:00
Steven Silvester
df7304ddf0
PYTHON-5148 Update SBOM usage for Kondukto (#2168) 2025-03-05 13:34:33 -06:00
Shane Harvey
de09181b1c
PYTHON-4960 More informative error message for stale primary (#2115) 2025-03-05 10:30:52 -08:00
Shane Harvey
baf0344446
PYTHON-5167 Properly cleanup test SpecRunnerTask (#2181) 2025-03-04 22:03:56 -08:00
Steven Silvester
74b85d51d5
PYTHON-5180 Use a standard batchtime of one week (#2179) 2025-03-04 15:09:57 -06:00
Shane Harvey
9edfc626ed
PYTHON-5167 Properly cleanup test SocketGetter tasks (#2176) 2025-03-04 11:25:15 -08:00
Steven Silvester
3f5d6c1539
PYTHON-5131 Migrate off of Ubuntu 20.04 GitHub Actions Runners (#2169) 2025-03-04 11:23:39 -06:00
Steven Silvester
9a123bb631
PYTHON-5183 Fix C Extension building for Windows spawn hosts (#2178) 2025-03-04 09:14:10 -06:00
Steven Silvester
8927cfe79b
PYTHON-5181 Make it easier to set debugging logging in an Evergreen patch (#2177) 2025-03-04 08:32:39 -06:00
Steven Silvester
f1fe49784b
PYTHON-5178 Make test_async_cancellation_closes_change_stream more robust (#2175) 2025-03-03 15:09:29 -06:00
Shane Harvey
5ac262783f
PYTHON-5155 Use dochub link for fork warning (#2173) 2025-03-03 12:07:43 -08:00
Steven Silvester
9d5d4fa735
PYTHON-5136 Add check-json to pre-commit checks (#2167) 2025-03-03 12:19:51 -06:00
Iris
150a3ba756
PYTHON-5078 Convert test.test_discovery_and_monitoring to async (#2093)
Co-authored-by: Noah Stapp <noah@noahstapp.com>
2025-03-03 10:14:04 -08:00
Casey Clements
6da1fdbed9
PYTHON-5126 Resync bson vector spec tests following additions (#2161) 2025-03-03 12:51:32 -05:00
Noah Stapp
38f97a3b49
PYTHON-5177 - Add instructions for enabling debug logs to CONTRIBUTING.md (#2170) 2025-03-03 11:20:44 -05:00
Shane Harvey
e28f49c510
PYTHON-5164 Fix mockupdb TestClusterTime (#2163) 2025-02-28 15:24:28 -08:00
Shane Harvey
080c1c6121
PYTHON-5166 Allow Database.command to run bulkWrite commands (#2164) 2025-02-28 10:48:36 -08:00
Shane Harvey
e52965eea4
Remove redundant branch in GridFS (#2064) 2025-02-27 15:07:50 -08:00
Iris
c9a85ad321
PYTHON-5090 Convert test.test_monitor to async (#2106) 2025-02-27 08:05:23 -08:00
Shane Harvey
85ca6f1d9f
PYTHON-4579 Stop gossiping $clusterTime on SDAM connections (#1925) 2025-02-26 13:18:04 -08:00
Steven Silvester
61feccacfe
DRIVERS-2915 Add ENVIRONMENT auth mechanism property to test URIs (#2160) 2025-02-26 13:23:02 -06:00
Steven Silvester
f5aeac3ccc
DRIVERS-3058 Include nsType field in ChangeStreamDocument (#2157) 2025-02-26 13:21:46 -06:00
Steven Silvester
324ed1730f
DRIVERS-3119 Add options to provide certificate and CA files (#2159) 2025-02-26 13:21:07 -06:00
Shane Harvey
2b667df14f
PYTHON-5120 Reduce configureFailPoint duplication in tests (#2131) 2025-02-26 11:16:44 -08:00
Steven Silvester
eaae22c63b
PYTHON-5151 Convert kms tests to use python scripts (#2158)
Co-authored-by: Noah Stapp <noah@noahstapp.com>
2025-02-25 16:31:02 -06:00
Shane Harvey
0ac56a3019
PYTHON-5155 Fix FAQ link for fork safety (#2156) 2025-02-25 11:12:42 -08:00
Steven Silvester
f27e8e123a
PYTHON-5149 Convert run-tests.sh to a Python script (#2155) 2025-02-24 09:14:10 -06:00
Steven Silvester
25b2d77b63
PYTHON-5138 Convert setup_tests.py to a cli (#2154) 2025-02-21 14:27:33 -06:00
Steven Silvester
b56605cc1f
PYTHON-5147 Do not run OCSP on MongoDB 4.2 (#2153) 2025-02-20 10:54:20 -06:00
Steven Silvester
691ab8e783
PYTHON-5146 Fix handling of AWS ECS test (#2152) 2025-02-20 09:37:47 -06:00
Kevin Albertson
5456f1ec04
PYTHON-5142 Sync non-lb-connection-establishment test (#2150) 2025-02-19 15:22:28 -05:00
Iris
f32e2bc372
PYTHON-5075 Convert test.test_csot to async (#2088)
Co-authored-by: Noah Stapp <noah@noahstapp.com>
Co-authored-by: Noah Stapp <noah.stapp@mongodb.com>
2025-02-19 11:21:51 -08:00
Steven Silvester
4e672bd549
PYTHON-4540 Convert libmongocrypt download to python (#2148) 2025-02-18 13:15:48 -06:00
Steven Silvester
3e2967147e
PYTHON-5134 Fix binary installation and remove unused scripts (#2146) 2025-02-13 15:45:08 -06:00
Noah Stapp
338b7dcd49
PYTHON-5092 - Convert test.test_pooling to async (#2145) 2025-02-13 13:01:42 -08:00
Steven Silvester
6198805647
PYTHON-4540 Cleaner separation of test lifecycle (#2082) 2025-02-12 11:15:54 -06:00
Noah Stapp
9a7bac7d45
PYTHON-4865 - Re-enable TestBulkWriteConcern tests (#2144) 2025-02-12 08:15:55 -05:00
Noah Stapp
8496d58faa
PYTHON-4993 - Reevaluate handling of asyncio.CancelledError (#2132) 2025-02-12 06:59:32 -05:00
Iris
42d7ec2749
PYTHON-5082 Convert test.test_gridfs_bucket to async (#2143) 2025-02-11 14:07:47 -08:00
Iris
0e6aa6fa15
PYTHON-5073 Convert test.test_connection_monitoring to async (#2087) 2025-02-11 14:01:39 -08:00
Iris
61c3ddda82
PYTHON-5100 Convert test.test_server_selection to async (#2120) 2025-02-11 10:58:49 -08:00
Iris
1f7f8a9e0f
PYTHON-5081 Convert test.test_gridfs to async (#2099) 2025-02-11 10:27:43 -08:00
Noah Stapp
8b6be4ab71
PYTHON-4983 - Restore no C extension coverage variants (#2142) 2025-02-11 13:13:14 -05:00
Iris
13fa361421
PYTHON-5101 Convert test.test_server_selection_in_window to async (#2119)
Co-authored-by: Noah Stapp <noah@noahstapp.com>
2025-02-11 10:11:41 -08:00
Noah Stapp
1a7239c5ac
PYTHON-4745 - Update Async Cancellation documentation (#2141) 2025-02-11 11:45:23 -05:00
Noah Stapp
b94dd8e12b
PYTHON-4745 - Test behavior of async task cancellation (#2136) 2025-02-10 16:50:40 -05:00
Casey Clements
7a7ffa615d
PYTHON-5111 Update datetime_conversion in docstrings of MongoClients (#2135) 2025-02-10 15:00:30 -05:00
Noah Stapp
c6ffa1e951
PYTHON-5129 - Fix async transaction docstrings (#2138) 2025-02-10 13:29:11 -05:00
Noah Stapp
b9228684a4
PYTHON-5116 - Add MongoDB 4.2 back to our tested versions (#2140) 2025-02-10 11:02:44 -05:00
Noah Stapp
0fe1691b74
PYTHON-5118 - Improve contributing documentation of synchro (#2139) 2025-02-10 10:05:56 -05:00
Steven Silvester
a641337b5c
PYTHON-5047 Do not run nightly release check on forks (#2134) 2025-02-06 13:59:26 -06:00
Steven Silvester
041edbecba
PYTHON-5058 Restore alternate architecture builds (#2133) 2025-02-06 13:31:55 -06:00
Iris
a1a21099ed
PYTHON-5089 Convert test.test_mongos_load_balancing to async (#2107)
Co-authored-by: Noah Stapp <noah.stapp@mongodb.com>
2025-02-06 10:29:16 -08:00
Iris
25c9b90842
PYTHON-5099 Convert test.test_sdam_monitoring_spec to async (#2117) 2025-02-06 10:24:37 -08:00
Noah Stapp
3dd44e6e5f
PYTHON-5087 - Convert test.test_load_balancer to async (#2103) 2025-02-06 10:07:24 -05:00
Noah Stapp
1b818470fc
PYTHON-5053 - AsyncMongoClient.close() should await all background tasks (#2127) 2025-02-05 15:05:41 -05:00
Noah Stapp
f344eb7965
PYTHON-5109 - Convert test.test_versioned_api to async (#2129) 2025-02-05 12:14:12 -05:00
Noah Stapp
ac8fa2d645
PYTHON-5094 - Convert test.test_read_preferences to async (#2110) 2025-02-05 12:13:56 -05:00
Noah Stapp
7108c2199d
PYTHON-5108 - Convert test.test_transactions_unified to async (#2128) 2025-02-05 12:11:03 -05:00
Noah Stapp
02d6cc9cfd
PYTHON-5107 - Convert test.test_streaming_protocol to async (#2126) 2025-02-05 12:10:44 -05:00
Noah Stapp
7a4150ac17
PYTHON-5080 - Convert test.test_examples to async (#2097) 2025-02-05 08:48:54 -05:00
Iris
8ae9a0432a
PYTHON-5102 Convert test.test_server_selection_logging to async (#2121)
Co-authored-by: Noah Stapp <noah@noahstapp.com>
2025-02-04 10:31:11 -08:00
Iris
2c492155a6
PYTHON-5103 Convert test.test_server_selection_rtt to async (#2122)
Co-authored-by: Noah Stapp <noah@noahstapp.com>
2025-02-04 10:30:35 -08:00
Iris
097a853805
PYTHON 5104 - Convert test.test_sessions_unified to async (#2123)
Co-authored-by: Noah Stapp <noah@noahstapp.com>
2025-02-04 09:52:26 -08:00
Noah Stapp
554e1fddb8
PYTHON-5106 - Convert test.test_ssl to async (#2125) 2025-02-04 09:43:35 -05:00
Noah Stapp
68237f78ec
PYTHON-5098 - Convert test.test_run_command to async (#2114) 2025-02-04 09:42:21 -05:00
Noah Stapp
b47143cd10
PYTHON-4864 - Create async version of SpecRunnerThread (#2094) 2025-02-04 07:42:13 -05:00
Noah Stapp
1fda6a2310
PYTHON-5110 - Convert test.test_unified_format to async (#2130) 2025-02-03 15:48:04 -05:00
Noah Stapp
665eb9a4b8
PYTHON-5105 - Convert test.test_srv_polling to async (#2124) 2025-02-03 14:37:37 -05:00
Noah Stapp
702c86c02c
PYTHON-5095 - Convert test_read_write_concern_spec to async (#2111) 2025-02-03 08:52:54 -05:00
Noah Stapp
6b141d1f5b
PYTHON-5096 - Convert test.test_retryable_reads_unified to async (#2112) 2025-01-31 15:51:00 -05:00
Noah Stapp
acc437af57
PYTHON-5097 - Convert test.test_retryable_writes_unified to async (#2113) 2025-01-31 15:50:46 -05:00
Jib
3b5788906d
Update ReadTheDocs to include django-mongodb-backend (#2084) 2025-01-31 15:16:17 -05:00
Iris
3e783f5489
PYTHON-5088 Convert test.test_max_staleness to async (#2105) 2025-01-31 12:13:21 -08:00
The Light
44d1d40d65
PYTHON-5115 Type validation errors should include the invalid type name (#2085)
Co-authored-by: Iris Ho <iris.ho@mongodb.com>
2025-01-31 12:01:58 -08:00
Iris
c42f3d6421
PYTHON-5079 Convert test.test_dns to async (#2096) 2025-01-31 08:43:35 -08:00
Noah Stapp
8f6249e2f9
PYTHON-5091 - Convert test.test_on_demand_csfle to async (#2108) 2025-01-31 11:40:05 -05:00
Noah Stapp
19fdf7cceb
PYTHON-5093 - Convert test.test_read_concern to async (#2109) 2025-01-31 11:39:48 -05:00
Noah Stapp
c8d3afdefd
PYTHON-5086 - Convert test.json_util integration test to async (#2102) 2025-01-30 16:30:04 -05:00
Noah Stapp
0a1471d8f9
PYTHON-5084 - Convert test.test_heartbeat_monitoring to async (#2100) 2025-01-30 16:29:52 -05:00
Noah Stapp
2909e1fc8a
PYTHON-5085 - Convert test.test_index_management to async (#2101) 2025-01-30 16:15:18 -05:00
Iris
94b9a54c8e
PYTHON-5083 Convert test.test_gridfs_spec to async (#2104) 2025-01-30 13:10:01 -08:00
Shane Harvey
01f659cd8b
PYTHON-5071 Use one event loop for all asyncio tests (#2086) 2025-01-30 12:34:59 -08:00
Steven Silvester
34ae214e33
PYTHON-5047 Fix dry run logic in releases yet again (#2098) 2025-01-29 17:46:36 -06:00
Noah Stapp
1784e2c4b9
PYTHON-5112 - Fix just install (#2095) 2025-01-29 15:35:00 -05:00
Steven Silvester
b4e32a1d83
PYTHON-5047 Fix dry run logic in releases again (#2092) 2025-01-29 13:27:07 -06:00
Noah Stapp
cbc3af704f
PYTHON-5076 - Convert test.test_custom_types to async (#2090) 2025-01-29 14:06:09 -05:00
Noah Stapp
82a8a60af6
PYTHON-5077 - Convert test.test_data_lake to async (#2091) 2025-01-29 14:05:59 -05:00
Steven Silvester
c2e7fae7d9
BUMP 4.12.0.dev0 2025-01-29 09:33:36 -06:00
mongodb-dbx-release-bot[bot]
9603e92894
BUMP 10.10.11.dev0
Signed-off-by: mongodb-dbx-release-bot[bot] <167856002+mongodb-dbx-release-bot[bot]@users.noreply.github.com>
2025-01-29 05:43:30 +00:00
mongodb-dbx-release-bot[bot]
4ecf786892
BUMP 10.10.10.10
Signed-off-by: mongodb-dbx-release-bot[bot] <167856002+mongodb-dbx-release-bot[bot]@users.noreply.github.com>
2025-01-29 05:33:03 +00:00
mongodb-dbx-release-bot[bot]
78724cde8d
BUMP 4.12.0.dev0
Signed-off-by: mongodb-dbx-release-bot[bot] <167856002+mongodb-dbx-release-bot[bot]@users.noreply.github.com>
2025-01-28 15:42:56 +00:00
mongodb-dbx-release-bot[bot]
cae161ecdd
BUMP 4.11
Signed-off-by: mongodb-dbx-release-bot[bot] <167856002+mongodb-dbx-release-bot[bot]@users.noreply.github.com>
2025-01-28 15:30:50 +00:00
Steven Silvester
dc2993835e
PYTHON-5047 Fix dry run logic in releases (#2083) 2025-01-28 09:27:09 -06:00
Steven Silvester
4567f8875e
PYTHON-5047 Fix handling of attestation on testpypi workflows (#2081) 2025-01-27 13:43:11 -06:00
Steven Silvester
848ab4f7db
PYTHON-5047 Improve testing of publish workflows (#2080) 2025-01-27 09:24:48 -06:00
Steven Silvester
2225ccadce
PYTHON-5062 Add GitHub Actions CodeQL scanning (#2079) 2025-01-27 08:59:29 -06:00
Steven Silvester
9082a4be23
PYTHON-5058 Build linux aarch64 wheel using native runner and omit ppc64le and s390x wheels (#2077) 2025-01-24 17:14:20 -06:00
Shane Harvey
a3208df5c9
PYTHON-5059 Update default maxMessageSizeBytes and maxWriteBatchSize (#2078) 2025-01-24 14:30:07 -08:00
Steven Silvester
dc182310da
PYTHON-5047 Avoid updating the uv lock unintentionally (#2076) 2025-01-24 07:47:14 -06:00
Shane Harvey
a3cc43f60d
PYTHON-4999 Resync retryable writes tests (#2073) 2025-01-23 12:47:19 -08:00
Steven Silvester
cfe7784db9
PYTHON-4976 Replace hatch with uv as our python environment and workfow tool (#2068) 2025-01-22 08:48:17 -06:00
Noah Stapp
f1af917894
PYTHON-5044 - Fix successive AsyncMongoClients on a single loop always ti… (#2065) 2025-01-22 08:49:16 -05:00
Steven Silvester
2235b8354c
PYTHON-5050 Clean up handling of installed dependencies across deployment targets (#2071) 2025-01-21 16:22:14 -06:00
Jib
7dba1e5dd9
PYTHON-5043: Fix list[int, float] typo in binary.py (#2066) 2025-01-21 14:37:52 -05:00
Steven Silvester
2ff2fde911
PYTHON-5049 Drop support for PyPy 3.9 (#2070) 2025-01-21 12:38:02 -06:00
Noah Stapp
85877a0802
PYTHON-5048 - Synchro script should correctly process all files (#2069) 2025-01-21 10:26:21 -05:00
dependabot[bot]
14bc1f6be2
Bump pyright from 1.1.391 to 1.1.392.post0 (#2067)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-21 06:29:11 -06:00
Steven Silvester
86084adb29
PYTHON-4975 Use justfile as the task runner (#2057)
Co-authored-by: Noah Stapp <noah@noahstapp.com>
2025-01-17 14:48:01 -06:00
Noah Stapp
e4d84494c3
PYTHON-5021 - Fix usages of getaddrinfo to be non-blocking (#2059) 2025-01-17 09:46:48 -05:00
Shane Harvey
8fa6750a7e
PYTHON-5042 Resync transaction spec tests (#2058) 2025-01-16 12:14:25 -08:00
Shane Harvey
820701f15a
PYTHON-5038 Resolve certificate verify failed: Missing Authority Key Identifier (#2062) 2025-01-15 12:23:12 -08:00
Noah Stapp
f8bd891df4
PYTHON-5039 - Always use asyncio.get_running_loop() instead of asynci… (#2063) 2025-01-15 09:53:45 -05:00
Noah Stapp
069ebf3e13
PYTHON-5037 - Update pyopenssl_context.__get_options type hint (#2060) 2025-01-15 07:54:52 -05:00
Steven Silvester
ecf7ac7770
PYTHON-5013 Add NULL checks in InvalidDocument bson handling (#2049) 2025-01-13 20:34:58 -06:00
Noah Stapp
b9f4f796f1
Revert "PYTHON-4915 - Add guidance on adding _id fields to documents to CRUD spec, reorder client.bulk_write generated _id fields" (#2055)
Co-authored-by: Steven Silvester <steve.silvester@mongodb.com>
2025-01-13 09:16:28 -05:00
Steven Silvester
493fc2ab3e
PYTHON-5014 Fix handling of async socket errors in kms request (#2054) 2025-01-10 13:05:57 -06:00
Shane Harvey
6c9a20a49d
PYTHON-5014 Tests that use HTTPSConnection should only use stdlib ssl (#2053) 2025-01-10 09:32:07 -08:00
Shane Harvey
53943ac539
PYTHON-5011 Fix behavior of TLS connection errors on PyPy (#2052) 2025-01-09 13:36:56 -08:00
Steven Silvester
42df09c4b4
PYTHON-5017 Fix post-publish step (#2051) 2025-01-08 17:07:18 -06:00
Steven Silvester
1f22139323
PYTHON-4949 Communicate future minWireVersion bump / 4.0 EoL (#2050) 2025-01-07 12:49:52 -06:00
Steven Silvester
c40283ed09
PYTHON-4840 Add evergreen tests for free-threaded Python 3.13t (#2048) 2025-01-07 12:48:28 -06:00
Steven Silvester
da8c7aa4e0
PYTHON-5017 Use a separate PyPI publish step (#2042) 2025-01-06 14:25:36 -06:00
Steven Silvester
fd5a10599b
PYTHON-5016 Update scripts to handle Windows spawn hosts (#2047) 2025-01-06 09:55:04 -06:00
dependabot[bot]
a0de09efc6
Bump mypy from 1.13.0 to 1.14.1 (#2045)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-06 06:58:50 -06:00
dependabot[bot]
a1e681142b
Bump supercharge/mongodb-github-action from 1.11.0 to 1.12.0 in the actions group (#2046)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-06 06:57:50 -06:00
Steven Silvester
27039c30bf
PYTHON-5003 Update pymongo's pymongocrypt version to >=1.12 (#2043) 2025-01-03 14:15:49 -06:00
Steven Silvester
bf415371bb
PYTHON-4754 Add gevent test for Python 3.13 (#2044) 2025-01-03 06:19:18 -06:00
Steven Silvester
163514bce1
PYTHON-5016 Fix initial sync in spawn host script (#2038) 2025-01-02 12:29:20 -06:00
Shane Harvey
1b3f04c599
PYTHON-5020 Fix behavior of network timeouts on pyopenssl connections (#2037) 2025-01-02 10:26:33 -08:00
Steven Silvester
d2d8f6e29b
PYTHON-5019 Fix mod_wsgi tests (#2039) 2025-01-02 10:54:04 -06:00
Steven Silvester
71ef4e0c35
PYTHON-5018 Use a single script for system setup (#2041) 2025-01-02 10:12:53 -06:00
Steven Silvester
8d27699e75
PYTHON-3096 Finish implementation and tests for GSSAPI options (#1985) 2024-12-31 16:29:48 -06:00
Steven Silvester
b3ce9320f0
PYTHON-5016 Create spawn host helper scripts (#2036) 2024-12-31 13:26:45 -06:00
dependabot[bot]
bdaf43c53d
Bump pyright from 1.1.390 to 1.1.391 (#2035)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-30 08:18:52 -06:00
Jeffrey A. Clark
2d21035396
PYTHON-2187 Remove easy_install from documentation (#2033) 2024-12-20 12:58:08 -05:00
dependabot[bot]
d2fe1ed154
Bump pyright from 1.1.389 to 1.1.390 (#2032)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-09 15:07:34 -06:00
Steven Silvester
30e4cceb24
PYTHON-5008 Do not build c extensions on other hosts (#2031) 2024-12-06 08:12:30 -06:00
Steven Silvester
1b89da4829
PYTHON-5006 Skip test_kms_retry when using PyOpenSSL (#2030) 2024-12-04 10:53:27 -06:00
Steven Silvester
5204e87ca2
PYTHON-5002 Add guard to synchro hook to accidental overwrite (#2026) 2024-12-04 09:35:06 -06:00
Steven Silvester
dc34833d97
PYTHON-5005 Skip more csot tests where applicable (#2029) 2024-12-04 09:26:29 -06:00
Steven Silvester
11287e1257
PYTHON-5004 Fix handling of TEST_PATH (#2028) 2024-12-04 09:18:13 -06:00
Steven Silvester
89852ba704
PYTHON-5001 Fix import time check (#2027) 2024-12-04 07:24:28 -06:00
Shane Harvey
ff2f95987f
PYTHON-2560 Retry KMS requests on transient errors (#2024) 2024-12-03 16:16:47 -08:00
Steven Silvester
ce1c49a668
PYTHON-4646 Improve usage of hatch in evergreen (#2025) 2024-12-03 14:29:23 -06:00
Navjot
fdcbe2e622
PYTHON-1982 Update Invalid Document error message to include doc (#1854)
Co-authored-by: Navjot Singh <navjot@Navjots-Air.station>
Co-authored-by: Navjot Singh <navjot@Navjots-MacBook-Air.local>
Co-authored-by: Steven Silvester <steven.silvester@ieee.org>
2024-12-03 08:22:06 -06:00
Noah Stapp
f45b35a478
PYTHON-4996 - Ensure all async integration tests call their parent asyncSetup method (#2023) 2024-12-02 14:08:22 -05:00
Shane Harvey
a9e61f6bed
PYTHON-4292 Improve TLS read performance (#2020) 2024-12-02 10:08:52 -08:00
Noah Stapp
0f61ebb115
PYTHON-4995 - Skip TestNoSessionsSupport tests on crypt_shared (#2022) 2024-12-02 12:35:31 -05:00
Noah Stapp
bc66598623
PYTHON-4965 - Consolidate startup and teardown tasks (#2017) 2024-12-02 12:17:52 -05:00
theRealProHacker
cbeebd0190
Small doc fix (#2021)
Co-authored-by: Steven Silvester <steve.silvester@mongodb.com>
2024-12-02 10:54:56 -06:00
Noah Stapp
0e8d70457f
Async client uses tasks instead of threads
PYTHON-4725 - Async client should use tasks for SDAM instead of threads
PYTHON-4860 - Async client should use asyncio.Lock and asyncio.Condition
PYTHON-4941 - Synchronous unified test runner being used in asynchronous tests
PYTHON-4843 - Async test suite should use a single event loop
PYTHON-4945 - Fix test cleanups for mongoses

Co-authored-by: Iris <58442094+sleepyStick@users.noreply.github.com>
2024-11-26 16:55:27 -05:00
Jib
9b5c0981d9
PYTHON-4988: Check C extensions are loaded ONLY in CPython builds (#2016) 2024-11-25 13:13:44 -05:00
Noah Stapp
1c7a7fe9ec
PYTHON-4721 - Create individualized scripts for all shell.exec commands (#1997)
Co-authored-by: Jib <jib.adegunloye@mongodb.com>
2024-11-20 14:47:28 -05:00
Steven Silvester
906d021bb1
PYTHON-4447 Test OIDC on Server Latest (#2014) 2024-11-20 11:56:10 -06:00
Steven Silvester
89f4e5c786
PYTHON-3730 Ensure C extensions when running the test suite (#2013) 2024-11-20 09:21:30 -06:00
Shane Harvey
b5f0104048
PYTHON-4980 Ignore network error on killAllSessions (#2011) 2024-11-19 15:43:28 -08:00
Shane Harvey
ddf783b69a
PYTHON-4982 Remove redundant configureFailPoint (#2012) 2024-11-19 15:43:17 -08:00
Shane Harvey
a7c1090056
PYTHON-4414 interruptInUseConnections should cancel pending connections too (#2010) 2024-11-19 10:46:57 -08:00
Shane Harvey
a3bdc133ca
PYTHON-4356 Unskip spec tests for agg $out (#2008) 2024-11-18 12:17:33 -08:00
Shane Harvey
1dd42173e1
PYTHON-4919 Resync tests for retryable writes (#2006) 2024-11-18 10:26:22 -08:00
Shane Harvey
c9d9d7c2dc
PYTHON-4907 Avoid noisy TypeError at interpreter exit (#2005) 2024-11-18 10:25:46 -08:00
Shane Harvey
18940030f1
PYTHON-4921 Eliminate unnecessary killCursors command when batchSize == limit (#2004) 2024-11-18 10:25:20 -08:00
dependabot[bot]
d2c1e18cc2
Bump pyright from 1.1.388 to 1.1.389 (#2007)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-18 05:41:04 -06:00
Shane Harvey
35b2fbbd02
PYTHON-4977 Fix import time on Windows again (#2003) 2024-11-15 08:57:34 -08:00
Noah Stapp
72a51092cd
PYTHON-4915 - Add guidance on adding _id fields to documents to CRUD spec, reorder client.bulk_write generated _id fields (#1976) 2024-11-12 09:32:41 -05:00
Steven Silvester
63c3f8aede
PYTHON-4959 Adopt zizmor GitHub Actions security scanner (#2001) 2024-11-11 13:25:42 -06:00
Steven Silvester
5e5528238c
PYTHON-4817 Revert import guard on asyncio (#1894) 2024-11-11 13:24:22 -06:00
Steven Silvester
5b00a3d48a
PYTHON-4956 Generated config cleanup (#2000) 2024-11-11 09:34:05 -06:00
Steven Silvester
6a8a805217
PYTHON-4845 Ensure ALLOWED_HOSTS is optional for Workload Usage (#1998) 2024-11-11 09:33:29 -06:00
dependabot[bot]
41527f06bb
Bump pyright from 1.1.385 to 1.1.388 (#1999)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-11 06:38:46 -06:00
Shane Harvey
0733c4da44
PYTHON-4925 Fix test bugs in $$matchAsDocument and $$matchAsRoot (#1988)
Fixes a bug where the driverConnectionId field was missing from "server heartbeat failed" log messages.
Avoids sending "upsert": False since various client.bulkWrite spec tests assume this field is only sent when it's True.
2024-11-05 12:19:51 -08:00
Casey Clements
466d0a188f
PYTHON-4903 Adds typing overloading to bson.binary.Binary.from_vector (#1967) 2024-11-05 10:47:36 -05:00
Steven Silvester
91d0d897c0
PYTHON-4943 Clean up EVG Variant Display Names (#1994) 2024-11-04 11:46:37 -06:00
dependabot[bot]
81bef71933
Bump pyright from 1.1.384 to 1.1.385 (#1954)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Jib <jib.adegunloye@mongodb.com>
Co-authored-by: Steven Silvester <steven.silvester@ieee.org>
2024-11-04 11:41:09 -06:00
Steven Silvester
57fd616ace
PYTHON-4330 Add Kubernetes Support for OIDC (#1759) 2024-11-04 10:26:07 -06:00
Noah Stapp
a9caaf0d6a
PYTHON-4941 - Fix Synchronous unified test runner being used in async… (#1993) 2024-11-04 09:24:29 -05:00
Noah Stapp
6862e94d17
PYTHON-4923 - Add mixed case tests for read preference tags (#1990) 2024-11-01 13:21:17 -04:00
Noah Stapp
c680f63427
PYTHON-4917 - Test that inserts and upserts respect null _id values (#1992) 2024-11-01 13:21:07 -04:00
Noah Stapp
f3343aa952
PYTHON-4916 - URI options spec tests specify empty options when the i… (#1991) 2024-11-01 13:20:59 -04:00
Noah Stapp
260322277d
PYTHON-4926 - Skip tests with errorCodeName on Serverless (#1989) 2024-11-01 13:20:37 -04:00
Steven Silvester
9f53f29967
PYTHON-4906 Add branch creation workflow to Python Driver (#1971) 2024-11-01 08:24:52 -05:00
Shane Harvey
32269aac1e
PYTHON-4885 Fix legacy extended JSON encoding of DatetimeMS (#1986) 2024-10-31 14:01:30 -07:00
Steven Silvester
351196b91b
PYTHON-4813 Update specification documentation links (#1977) 2024-10-30 15:46:52 -05:00
Noah Stapp
2332d69328
PYTHON-4807 - Update changelog + remove dead code (#1984) 2024-10-30 15:37:00 -04:00
Steven Silvester
92d6a732c5
PYTHON-3906 & PYTHON-2867 Implement GSSAPI ServiceHost support and expand canonicalization options (#1983) 2024-10-30 14:06:54 -05:00
Steven Silvester
ad3292e39b
PYTHON-4922 Remove Support for MONGODB-CR Authentication (#1978) 2024-10-30 12:57:31 -05:00
Steven Silvester
9a11b78fdf
PYTHON-4209 Fix test for ensure that no error is raised for unknown auth mechanism (#1982) 2024-10-30 12:49:20 -05:00
Noah Stapp
2f1227c504
PYTHON-4807 - Specify how to handle unacknowledged+(ordered|verbose|m… (#1979) 2024-10-29 12:28:33 -04:00
Steven Silvester
dfb6a9a4f3
PYTHON-4209 Ensure that no error is raised for unknown auth mechanism (#1981) 2024-10-29 11:08:22 -05:00
Noah Stapp
00c29600de
PYTHON-4766 - Fix logic for determining whether to populate BulkWriteException.partialResult (#1980) 2024-10-29 11:34:06 -04:00
Steven Silvester
5c1c241018
PYTHON-4909 Use ubuntu for Atlas Data Lake tests (#1969) 2024-10-29 08:25:23 -05:00
Steven Silvester
72863862c9
PYTHON-4910 Add server tasks that use both sync and async (#1975) 2024-10-28 07:49:11 -05:00
dependabot[bot]
4aeca321c5
Bump mypy from 1.12.1 to 1.13.0 (#1974)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-28 04:47:07 -05:00
Steven Silvester
97ac3ebee2
PYTHON-4738 Skip encryption fork test (#1972) 2024-10-25 09:49:37 -05:00
Steven Silvester
85ba541ed5
PYTHON-4905 Use shrub.py to generate load balancer tasks (#1968) 2024-10-25 07:43:28 -05:00
Steven Silvester
215bca21ec
PYTHON-4902 Use shrub.py to generate tasks (#1966) 2024-10-24 10:30:30 -05:00
Steven Silvester
cb8cf03eb5
PYTHON-4901 Move generated Evergreen variants to an included file (#1965) 2024-10-23 13:29:09 -05:00
Steven Silvester
493c331bb8
PYTHON-4897 Remove Assign PR Reviewer from PyMongo (#1960) 2024-10-23 11:08:50 -05:00
Steven Silvester
79ad2a1481
PYTHON-4900 Convert remaining matrix definitions to use shrub.py (#1964) 2024-10-23 10:10:32 -05:00
Steven Silvester
5141a7c5c0
PYTHON-4896 Use shrub.py for other hosts tests (#1962) 2024-10-23 09:32:35 -05:00
Casey Clements
26a61c8c48
PYTHON-2926 Updated signature of Binary.from_vector to take a BinaryVector (#1963) 2024-10-23 08:24:59 -04:00
Jeffrey A. Clark
5f7afeaed6
PYTHON-4883 Add release date to changelog entries (#1952) 2024-10-22 13:07:56 -04:00
Steven Silvester
6ca766e066
PYTHON-4893 Use shrub.py for aws auth tests (#1959) 2024-10-21 18:41:17 -05:00
Steven Silvester
1ace0455d7
PYTHON-4898 Ensure consistent versions of tests across hosts (#1961) 2024-10-21 15:47:18 -05:00
Steven Silvester
25de52ae5d
PYTHON-4892 Use shrub.py for remaining axes (#1957) 2024-10-21 13:11:07 -05:00
Steven Silvester
081ad89b84
PYTHON-4894 Fix handling of auth test marker (#1958) 2024-10-21 12:05:56 -05:00
Steven Silvester
4003edf267
PYTHON-4891 Use shrub.py for c extension tests (#1956) 2024-10-21 09:45:14 -05:00
Steven Silvester
5280596141
PYTHON-4890 Use shrub.py for storage engine tests (#1955) 2024-10-21 08:16:12 -05:00
dependabot[bot]
60109e660c
Bump mypy from 1.11.2 to 1.12.1 (#1953)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-21 07:32:56 -05:00
Steven Silvester
7e83c8c67f
PYTHON-4889 Use shrub.py for green framework tests (#1951) 2024-10-21 07:24:39 -05:00
Steven Silvester
849ed7970f
PYTHON-4888 Use shrub.py for versioned api tests (#1949) 2024-10-18 15:35:44 -05:00
Noah Stapp
a1ade45dd3
PYTHON-4881 - Use OvertCommandListener wherever sensitive events are not needed (#1943)
Co-authored-by: Steven Silvester <steven.silvester@ieee.org>
2024-10-18 13:32:09 -04:00
Steven Silvester
1ae0c3904c
PYTHON-4886 Use shrub.py for PyOpenSSL tests (#1946) 2024-10-18 10:58:28 -05:00
Steven Silvester
6a7e83dc95
PYTHON-4887 Do not test macos arm64 on server versions < 6.0 (#1947) 2024-10-18 10:36:05 -05:00
Steven Silvester
021a9f7524
PYTHON-4882 Use shrub.py for enterprise auth tests (#1945) 2024-10-18 08:57:20 -05:00
dependabot[bot]
335b728f07
Bump pyright from 1.1.383 to 1.1.384 (#1922)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Jib <jib.adegunloye@mongodb.com>
2024-10-17 20:27:27 -05:00
Shane Harvey
7e904b3c31
PYTHON-4874 Fix async Windows KMS support (#1942) 2024-10-17 13:11:20 -07:00
Steven Silvester
317a539415
PYTHON-4879 Use shrub.py for compressor tests (#1944) 2024-10-17 15:01:24 -05:00
Steven Silvester
257aa2483b
PYTHON-4878 Use shrub.py for load balancer tests (#1941) 2024-10-17 11:01:47 -05:00
Steven Silvester
79033bc0b9
Revert "PYTHON-4765 Resync server-selection spec" (#1940) 2024-10-17 10:33:44 -05:00
Noah Stapp
a62ade864d
PYTHON-4874 - Add KMS support for async Windows (#1939) 2024-10-17 11:32:39 -04:00
Steven Silvester
8ce21bc121
PYTHON-4872 Use shrub.py to generate encryption tasks (#1938) 2024-10-17 09:18:01 -05:00
Steven Silvester
6f4258c1cd
PYTHON-4576 Allow update to supply sort option (#1881) 2024-10-16 16:41:14 -05:00
Shane Harvey
29064f5b1d
PYTHON-4873 Remove bson-stdint-win32.h from THIRD-PARTY-NOTICES (#1937) 2024-10-16 12:15:48 -07:00
Steven Silvester
d1375d4178
PYTHON-4865 Skip test_write_concern_failure tests temporarily (#1936) 2024-10-16 13:41:35 -05:00
Jeffrey A. Clark
463518bf81
PYTHON-4765 Resync server-selection spec (#1935) 2024-10-16 11:02:57 -04:00
Jeffrey A. Clark
8034baec90
PYTHON-4834 Add __repr__ to IndexModel, SearchIndexModel (#1909) 2024-10-15 18:45:49 -04:00
Noah Stapp
fa263dc87d
PYTHON-4847 - Convert test.test_collection_management.py to async (#1916) 2024-10-15 15:48:05 -04:00
Noah Stapp
3855effbd8
PYTHON-4842 - Convert test.test_create_entities to async (#1919) 2024-10-15 15:16:42 -04:00
Steven Silvester
1b6c0d3a2a
PYTHON-4868 Generate server tests using shrub.py (#1930) 2024-10-15 13:33:04 -05:00
Noah Stapp
82e673d660
PYTHON-4870 - Update changelog for MongoClient.address fix (#1931) 2024-10-15 14:16:19 -04:00
Noah Stapp
710bc40c73
PYTHON-4870 - MongoClient.address should block until a connection suc… (#1929) 2024-10-15 12:12:18 -04:00
Noah Stapp
872fda179e
PYTHON-4574 - FaaS detection logic mistakenly identifies EKS as AWS Lambda (#1908) 2024-10-15 08:54:42 -04:00
Shane Harvey
9e38c54fa0
PYTHON-4861 Fix HATCH_CONFIG on cygwin (#1927) 2024-10-14 15:25:21 -07:00
Shane Harvey
a911245bde
PYTHON-4866 Fix test_command_cursor_to_list_csot_applied (#1926) 2024-10-14 15:06:42 -07:00
Steven Silvester
3cc722e910
PYTHON-4838 Generate OCSP build variants using shrub.py (#1910) 2024-10-14 14:05:22 -05:00
Steven Silvester
9ba780cac2
PYTHON-4861 Ensure hatch is isolated in Evergreen (#1923) 2024-10-14 07:34:01 -05:00
Steven Silvester
3c5e71a1cb
PYTHON-4862 Fix handling of interrupt_loop in unified test runner (#1924) 2024-10-14 07:32:38 -05:00
Iris
33163ecc0d
PYTHON-4804 Migrate test_comment.py to async (#1887) 2024-10-11 16:02:13 -07:00
Noah Stapp
4eeaa4b7be
PYTHON-4848 - Convert test.test_command_monitoring.py to async (#1917) 2024-10-11 14:56:43 -04:00
Noah Stapp
b2332b2aae
PYTHON-4846 - Convert test.test_command_logging.py to async (#1915) 2024-10-11 13:59:49 -04:00
Noah Stapp
e0fde23381
PYTHON-4850 - Convert test.test_crud_unified to async (#1920) 2024-10-11 13:59:44 -04:00
Noah Stapp
7e86d24c7b
PYTHON-4849 - Convert test.test_connection_logging.py to async (#1918) 2024-10-11 13:59:37 -04:00
Noah Stapp
6973d2d274
PYTHON-4528 - Convert unified test runner to async (#1913) 2024-10-11 11:02:06 -04:00
Noah Stapp
3a662291e0
PYTHON-4700 - Convert CSFLE tests to async (#1907) 2024-10-11 10:48:24 -04:00
Noah Stapp
8118aea985
PYTHON-4844 - Skip async test_encryption.AsyncTestSpec.test_legacy_ti… (#1914) 2024-10-11 08:29:12 -04:00
Noah Stapp
c2338d879b
PYTHON-4839 - Convert test.test_collation to async (#1911) 2024-10-10 16:38:25 -04:00
Noah Stapp
d1e4167dc9
PYTHON-4841 - Convert test.test_common to async (#1912) 2024-10-10 13:47:14 -04:00
Shane Harvey
8f26f43911
PYTHON-4450 Support free-threaded Python 3.13t with no-GIL (#1906) 2024-10-10 09:01:27 -07:00
Steven Silvester
2895e84b49
PYTHON-4818 Use OCSP Scripts from Drivers-Tools (#1895) 2024-10-09 14:07:44 -05:00
Shane Harvey
ac198af557
PYTHON-4729 Drop support for MongoDB 3.6 (#1905) 2024-10-09 09:58:20 -07:00
Noah Stapp
5fa4380324
PYTHON-4784 - Add tests to confirm async parallelism (#1886) 2024-10-09 10:44:41 -04:00
Noah Stapp
8f32f3cd24
PYTHON-4831 - Remove pytz from examples (#1904)
Co-authored-by: Steven Silvester <steven.silvester@ieee.org>
2024-10-08 15:52:16 -04:00
Noah Stapp
d21a8ddcff
PYTHON-4827 - Fix dnspython typechecking failures (#1903)
Co-authored-by: Steven Silvester <steven.silvester@ieee.org>
2024-10-08 15:14:54 -04:00
Noah Stapp
5a66e99254
PYTHON-4828 - Drop Python 3.8 support (#1902) 2024-10-08 13:52:14 -05:00
dependabot[bot]
006a9960f0
Update sphinx-rtd-theme requirement from <3,>=2 to >=2,<4 (#1900)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-07 04:55:07 -05:00
dependabot[bot]
c48dc69282
Update sphinx requirement from <8,>=5.3 to >=5.3,<9 (#1901)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-07 04:52:14 -05:00
dependabot[bot]
093d5bebde
Bump pyright from 1.1.382.post1 to 1.1.383 (#1899)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-07 04:51:09 -05:00
dependabot[bot]
def3c11787
Bump furo from 2023.9.10 to 2024.8.6 (#1898)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-07 04:50:49 -05:00
dependabot[bot]
68127d5efd
Bump the actions group with 2 updates (#1897)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-07 04:49:40 -05:00
Noah Stapp
b111cbf5d5
PYTHON-4636 - Avoid blocking I/O calls in async code paths (#1870)
Co-authored-by: Shane Harvey <shnhrv@gmail.com>
2024-10-03 15:18:33 -04:00
Jeffrey A. Clark
7380097dbc
PYTHON-3959 - NULL Initialize PyObjects (#1859) 2024-10-03 13:39:04 -04:00
Iris
af23139b4a
PYTHON-4805 Migrate test_connections_survive_primary_stepdown_spec.py to async (#1889) 2024-10-03 10:27:22 -07:00
Steven Silvester
2a83349f71
PYTHON-4812 Update changelog for 4.9.2 and 4.9.1 [master] (#1892) 2024-10-02 11:34:43 -05:00
mongodb-dbx-release-bot[bot]
da059a6b0a
BUMP 4.11.0.dev0
Signed-off-by: mongodb-dbx-release-bot[bot] <167856002+mongodb-dbx-release-bot[bot]@users.noreply.github.com>
2024-10-01 23:09:24 +00:00
mongodb-dbx-release-bot[bot]
77cd7ab9f6
BUMP 4.10.1
Signed-off-by: mongodb-dbx-release-bot[bot] <167856002+mongodb-dbx-release-bot[bot]@users.noreply.github.com>
2024-10-01 22:53:25 +00:00
Steven Silvester
1c28430725
PYTHON-4808 Add changelog for 4.10.1 (#1890) 2024-10-01 17:52:16 -05:00
Noah Stapp
7848feb09a
PYTHON-4786 - Fix UpdateResult.did_upsert TypeError (#1878) 2024-10-01 17:32:41 -05:00
Steven Silvester
0279407980
PYTHON-4806 Fix expected metadata in mockupdb tests (#1888) 2024-10-01 14:31:21 -05:00
Casey Clements
7fbeca9793
[PYTHON-4803] Big endian fix for binary bson vectors (#1885) 2024-10-01 15:06:12 -04:00
Iris
bfba5481a0
PYTHON-4789 Migrate test_retryable_reads.py to async (#1877) 2024-10-01 09:16:26 -07:00
Iris
8791aa00ea
PYTHON-4790 Migrate test_retryable_writes.py to async (#1876) 2024-10-01 08:39:57 -07:00
mongodb-dbx-release-bot[bot]
c0f7810d56
BUMP 4.11.0.dev0
Signed-off-by: mongodb-dbx-release-bot[bot] <167856002+mongodb-dbx-release-bot[bot]@users.noreply.github.com>
2024-10-01 02:31:13 +00:00
mongodb-dbx-release-bot[bot]
4713afa910
BUMP 4.10.0
Signed-off-by: mongodb-dbx-release-bot[bot] <167856002+mongodb-dbx-release-bot[bot]@users.noreply.github.com>
2024-10-01 02:14:15 +00:00
Casey Clements
ae6cfd6d10
[DRIVERS-2926] [PYTHON-4577] BSON Binary Vector Subtype Support (#1813)
Co-authored-by: Steven Silvester <steve.silvester@mongodb.com>
Co-authored-by: Steven Silvester <steven.silvester@ieee.org>
2024-09-30 21:13:09 -05:00
Steven Silvester
545b88cbd3
PYTHON-4800 Add changelog for 4.10.0 (#1883) 2024-09-30 20:42:28 -05:00
Shane Harvey
15b22651ec
PYTHON-4801 Add beta warning to async tutorial (#1884) 2024-09-30 18:28:59 -07:00
Shane Harvey
e76d411b59
PYTHON-4794 Start running IPv6 tests again (#1879) 2024-09-30 16:48:14 -07:00
Shane Harvey
821811e80d
PYTHON-4782 Fix deadlock and blocking behavior in _ACondition.wait (#1875) 2024-09-30 16:24:07 -07:00
Jeffrey A. Clark
083359f95f
PYTHON-1714 Add c extension use to client metadata (#1874) 2024-09-30 18:09:57 -05:00
Steven Silvester
3ef565fa43
PYTHON-4796 Update type checkers and handle with_options typing (#1880) 2024-09-30 18:01:53 -05:00
Iris
1e395de9c5
PYTHON-4737 Migrate test_binary.py to async (#1863) 2024-09-30 11:17:57 -07:00
Noah Stapp
7742b7f24f
PYTHON-4797 - Convert test.test_raw_bson to async (#1882) 2024-09-30 14:14:12 -04:00
Steven Silvester
e03f8f24f2
PYTHON-4781 Handle errors on Async PyMongo import (#1873) 2024-09-20 16:50:59 -05:00
Shane Harvey
0f84ad6ed9
PYTHON-4769 Avoid pytest collection overhead when running perf benchmarks (#1869) 2024-09-20 10:06:03 -07:00
mongodb-dbx-release-bot[bot]
9df635f102
BUMP 4.10.0.dev0
Signed-off-by: mongodb-dbx-release-bot[bot] <167856002+mongodb-dbx-release-bot[bot]@users.noreply.github.com>
2024-09-18 22:27:23 +00:00
mongodb-dbx-release-bot[bot]
8b26d4bc09
BUMP 4.9.1
Signed-off-by: mongodb-dbx-release-bot[bot] <167856002+mongodb-dbx-release-bot[bot]@users.noreply.github.com>
2024-09-18 22:10:50 +00:00
Noah Stapp
d0772f2161
PYTHON-4773 - Async PyMongo Beta docs update (#1868) 2024-09-18 17:09:20 -05:00
mongodb-dbx-release-bot[bot]
2ddd16de5a
BUMP 4.10.0.dev0
Signed-off-by: mongodb-dbx-release-bot[bot] <167856002+mongodb-dbx-release-bot[bot]@users.noreply.github.com>
2024-09-18 14:33:00 +00:00
mongodb-dbx-release-bot[bot]
699d962758
BUMP 4.9
Signed-off-by: mongodb-dbx-release-bot[bot] <167856002+mongodb-dbx-release-bot[bot]@users.noreply.github.com>
2024-09-18 14:15:44 +00:00
Noah Stapp
2c432b580b
PYTHON-4768 - Fix atlas connection tests and cleanup uses of raw MongoClients in tests (#1867) 2024-09-18 09:23:07 -04:00
Steven Silvester
6d472a10a1
PYTHON-4738 Skip encryption test_fork on PyPy (#1865) 2024-09-17 20:00:06 -05:00
Shane Harvey
9a71be1615
PYTHON-4740 Convert asyncio.TimeoutError to socket.timeout for compat (#1864) 2024-09-17 17:54:09 -07:00
Iris
c136684047
PYTHON-4585 Cursor.to_list does not apply client's timeoutMS setting (#1860) 2024-09-17 13:38:24 -07:00
Steven Silvester
40ebc1644c
PYTHON-4764 Update to use current supported EVG hosts (#1858) 2024-09-17 15:16:55 -05:00
Noah Stapp
163e3d4a0d
PYTHON-4738 - Make test_encryption.TestClientSimple.test_fork sync-only (#1862) 2024-09-17 12:56:03 -04:00
Noah Stapp
739510214b
PYTHON-4731 - Explicitly close all MongoClients opened during tests (#1855) 2024-09-17 09:22:17 -04:00
Steven Silvester
fb51c11cac
PYTHON-4756 Add changelog note about dropping srv extra (#1861) 2024-09-16 21:23:40 -05:00
Jib
3b21517608
PYTHON-4752 Migrate docs links to Internal Docs Where Possible (#1715)
Co-authored-by: Steven Silvester <steve.silvester@mongodb.com>
2024-09-16 21:23:09 -05:00
Iris
0c0633da23
PYTHON-4763 Migrate test_change_stream.py to async (#1853) 2024-09-16 10:20:34 -07:00
Noah Stapp
9b9cf73368
PYTHON-4758 - Only emit warnings for unclosed clients after opening (#1856) 2024-09-12 16:19:05 -04:00
Iris
0ca926ccfa
PYTHON-4753 [Build Failure] Async tests missing awaits (#1851) 2024-09-12 08:59:57 -07:00
Noah Stapp
63d957c213
PYTHON-4590 - Fix MRO type guards (#1852) 2024-09-11 11:22:22 -04:00
Noah Stapp
039db2f20a
PYTHON-4590 - Make type guards more compatible (#1850) 2024-09-11 08:46:44 -04:00
Steven Silvester
e6da57ebba
Merge PYTHON-4747 2024-09-10 12:16:07 -05:00
Steven Silvester
8e3e652c39
PYTHON-4747 Sync grid_file.py to master 2024-09-10 12:16:06 -05:00
Steven Silvester
264c6edb9c
PYTHON-4747 Rename gridfs/grid_file.py to gridfs/synchronous/grid_file.py 2024-09-10 12:16:06 -05:00
Steven Silvester
600da067d1
PYTHON-4747 Sync database.py to master 2024-09-10 12:16:06 -05:00
Steven Silvester
4b85f84137
PYTHON-4747 Rename pymongo/database.py to pymongo/synchronous/database.py 2024-09-10 12:16:06 -05:00
Steven Silvester
134d00a102
PYTHON-4747 Sync auth.py to master 2024-09-10 12:16:05 -05:00
Steven Silvester
8b5479c746
PYTHON-4747 Rename pymongo/auth.py to pymongo/synchronous/auth.py 2024-09-10 12:16:05 -05:00
Steven Silvester
731bf9bbc0
PYTHON-4747 Sync cursor.py to master 2024-09-10 12:16:05 -05:00
Steven Silvester
489b2f8a1a
PYTHON-4747 Rename pymongo/cursor.py to pymongo/synchronous/cursor.py 2024-09-10 12:16:05 -05:00
Steven Silvester
96faacb578
PYTHON-4747 Sync change_stream.py to master 2024-09-10 12:16:05 -05:00
Steven Silvester
42e48eaa2a
PYTHON-4747 Rename pymongo/change_stream.py to pymongo/synchronous/change_stream.py 2024-09-10 12:16:04 -05:00
Steven Silvester
8bafdb04e4
PYTHON-4747 Sync mongo_client.py to master 2024-09-10 12:16:04 -05:00
Steven Silvester
1cbcf14e0d
PYTHON-4747 Rename pymongo/mongo_client.py to pymongo/synchronous/mongo_client.py 2024-09-10 12:16:04 -05:00
Steven Silvester
2861be8f81
PYTHON-4747 Sync command_cursor.py to master 2024-09-10 12:16:04 -05:00
Steven Silvester
b3e1f01774
PYTHON-4747 Rename pymongo/command_cursor.py to pymongo/synchronous/command_cursor.py 2024-09-10 12:16:03 -05:00
Steven Silvester
5c6bb0a039
PYTHON-4747 Sync pool.py to master 2024-09-10 12:16:03 -05:00
Steven Silvester
3280769d6f
PYTHON-4747 Rename pymongo/pool.py to pymongo/synchronous/pool.py 2024-09-10 12:16:03 -05:00
Steven Silvester
4e1035ece8
PYTHON-4747 Sync collection.py to master 2024-09-10 12:16:03 -05:00
Steven Silvester
6bdf583f3d
PYTHON-4747 Rename pymongo/collection.py to pymongo/synchronous/collection.py 2024-09-10 12:16:03 -05:00
Steven Silvester
bdf5ac6a5d
PYTHON-4747 Sync auth_oidc.py to master 2024-09-10 12:16:02 -05:00
Steven Silvester
6fc461183e
PYTHON-4747 Rename pymongo/auth_oidc.py to pymongo/synchronous/auth_oidc.py 2024-09-10 12:16:02 -05:00
Steven Silvester
5e4a5e7454
PYTHON-4747 Sync encryption.py to master 2024-09-10 12:16:02 -05:00
Steven Silvester
4ef252bfe3
PYTHON-4747 Rename pymongo/encryption.py to pymongo/synchronous/encryption.py 2024-09-10 12:16:02 -05:00
Steven Silvester
57305e0179
PYTHON-4747 Sync client_session.py to master 2024-09-10 12:16:01 -05:00
Steven Silvester
4436b1c676
PYTHON-4747 Rename pymongo/client_session.py to pymongo/synchronous/client_session.py 2024-09-10 12:16:01 -05:00
Steven Silvester
42f2d31057
PYTHON-4750 Add support for Python 3.13 (#1849) 2024-09-10 09:53:07 -05:00
Steven Silvester
0119062abe
PYTHON-4749 Add Script to Cherry-Pick PRs (#1848) 2024-09-10 07:33:46 -05:00
Iris
ead3201a4e
PYTHON-4733 Migrate test_auth.py to async (#1838) 2024-09-09 11:35:34 -07:00
Noah Stapp
2cca2d9e3d
PYTHON-3193 - Add ResourceWarning for unclosed MongoClients in __del__ (#1833) 2024-09-09 12:04:23 -04:00
Noah Stapp
e683b81bf4
PYTHON-4739 - Use AsyncBulkTestBase in Async TestEncryptedBulkWrite (#1846) 2024-09-09 11:05:04 -04:00
Steven Silvester
f6a418f590
PYTHON-4182 Unskip test_unpin_after_TransientTransactionError_error_on_abort on latest (#1847) 2024-09-09 09:44:03 -05:00
Steven Silvester
c883012b56
PYTHON-4703 MongoClient should default to connect=False on FaaS environments (#1844) 2024-09-06 15:38:58 -05:00
Noah Stapp
f2cd655d04
PYTHON-4746 - Bump minimum pytest and pytest-asyncio versions (#1845) 2024-09-06 16:04:39 -04:00
Shane Harvey
6bdaf19c78
PYTHON-4617 Skip unified retryable writes tests on MMAPv1 (#1841) 2024-09-06 10:46:10 -07:00
Shane Harvey
1eb3b8550e
PYTHON-4735 Resync SDAM tests to fix TestUnifiedLoggingLoadbalanced (#1839) 2024-09-06 10:20:29 -07:00
Steven Silvester
22b66b2ed6
PYTHON-4695 Fix test event loop policy and improve error traceback for ClientBulkWriteException (#1828) 2024-09-06 12:17:47 -05:00
Shane Harvey
4e102235ad
PYTHON-4560 Disable rsSyncApplyStop tests on 8.0+ (#1840) 2024-09-06 10:16:38 -07:00
Iris
bf329add7c
PYTHON-4732 Migrate test_auth_spec.py to async (#1836) 2024-09-06 08:57:32 -07:00
Steven Silvester
044d92cc14
PYTHON-4706 Allow running pytest directly without hatch (#1824) 2024-09-05 19:34:01 -05:00
Shane Harvey
29bbf77dad
PYTHON-4607 Use LogRecord.getMessage() not LogRecord.message (#1837) 2024-09-05 14:18:48 -07:00
Iris
25f724badb
PYTHON-4727 Migrate test_monitoring.py to async (#1834) 2024-09-05 13:09:43 -07:00
Shane Harvey
3504130322
PYTHON-4663 Fix coverity warnings in datetime decoding change (#1835) 2024-09-05 11:28:49 -07:00
Iris
2742a000c4
PYTHON-4730 Fix Failing Async Bulk Tests (#1831) 2024-09-05 09:05:24 -07:00
Noah Stapp
6e9bf1e4a8
PYTHON-4708 - Convert test.qcheck to async (#1832) 2024-09-05 10:20:32 -04:00
Jib
26c55048d4
PYTHON-4631: Pushed PREPARE_SHELL creation into an env.sh file (#1788)
Co-authored-by: Steven Silvester <steve.silvester@mongodb.com>
2024-09-05 09:39:55 -04:00
Steven Silvester
4d4813070d
PYTHON-4667 Handle $clusterTime from error responses in client Bulk Write (#1822) 2024-09-04 19:40:37 -05:00
Shane Harvey
e27b428914
PYTHON-4150 Document compatibility with MongoDB 3.6 will soon be dropped (#1829) 2024-09-04 14:53:32 -07:00
Shane Harvey
653ea8b8d2
PYTHON-4164 Document support for KMIP delegated master_key (#1830) 2024-09-04 14:53:21 -07:00
Iris
b37fb91896
PYTHON-4704 Migrate test_bulk.py to async (#1827) 2024-09-04 10:36:35 -07:00
Noah Stapp
4e74c8274e
PYTHON-4669 - Update Async GridFS APIs for Motor Compatibility (#1821) 2024-09-04 08:58:14 -04:00
Noah Stapp
5a49ccc759
PYTHON-4590 - Add type guards to async API methods (#1820) 2024-09-04 08:57:59 -04:00
Noah Stapp
5a70039ad2
PYTHON-4701 - Topology logging should use suppress_event (#1826) 2024-09-03 16:57:41 -04:00
Iris
ba8a139e72
PYTHON-4651: Migrate test_client_context.py to async (#1819) 2024-09-03 11:18:58 -07:00
Noah Stapp
3840d9dd0f
Add script to help convert sync tests to async tests (#1825) 2024-09-03 13:26:11 -04:00
Shane Harvey
a4645f0f8b
PYTHON-4712 Improve BSON encoding/decoding docs (#1823) 2024-08-30 13:36:40 -07:00
Noah Stapp
e6b95f6595
PYTHON-4673 - Add Async Encryption Tests (#1818) 2024-08-29 10:02:47 -04:00
Shane Harvey
a2059dc9cb
PYTHON-4663 Fix compatibility with dateutil timezones (#1812) 2024-08-28 14:20:55 -07:00
Noah Stapp
c6967ab139
PYTHON-3472 - Add log messages to SDAM spec (#1771)
Co-authored-by: Jib <Jibzade@gmail.com>
2024-08-28 14:48:49 -04:00
Shane Harvey
28697df6f8
PYTHON-4691 Fix non-UTC timezones with DATETIME_CLAMP/DATETIME_AUTO (#1811) 2024-08-28 11:39:03 -07:00
Steven Silvester
9d3b5033fa
PYTHON-3967 SDAM unit test sharded/too_new needs to defined wireVersions for host b (#1817) 2024-08-28 07:38:43 -05:00
Noah Stapp
e430d2e2fa
PYTHON-4662 - Capture Async PyMongo metadata (#1814) 2024-08-28 08:31:42 -04:00
Steven Silvester
fd0787a57b
PYTHON-4615 Address sign-compare warning, improve array_of_documents_to_buffer validation (#1804) 2024-08-27 19:05:15 -05:00
Noah Stapp
81ea92b808
PYTHON-4669 - Update More APIs for Motor Compatibility (#1815) 2024-08-27 13:38:42 -04:00
Noah Stapp
b8213f2817
PYTHON-4698 Rename the async ClientEncryption to AsyncClientEncryption (#1816) 2024-08-27 10:50:44 -04:00
Steven Silvester
f4392041b2
PYTHON-4692 Skip TestClientBulkWriteCSOT on MacOS and Windows (#1810) 2024-08-26 14:39:48 -05:00
Steven Silvester
50586baf8d
PYTHON-4025 Move Release Instructions to Wiki (#1808) 2024-08-23 14:57:48 -05:00
Steven Silvester
7ee08ddbe6
PYTHON-4672 Clarify Reauthentication and Speculative Authentication combination behavior (#1802)
Co-authored-by: Jib <Jibzade@gmail.com>
2024-08-23 14:57:07 -05:00
Shane Harvey
4eae7d2d94
PYTHON-4690 Add repr for FixedOffset eg FixedOffset(datetime.timedelta(seconds=3600), '+60')) (#1806) 2024-08-23 09:50:05 -07:00
Shruti Sridhar
4dde30147c
PYTHON-4671 Skip client.bulk_write tests on Atlas Serverless (#1807) 2024-08-22 14:06:02 -07:00
Steven Silvester
d6b896d18b
PYTHON-4229 Get remaining secrets from AWS secrets manager (#1805) 2024-08-21 16:52:16 -05:00
Steven Silvester
7295fe17b7
PYTHON-4226 Add Projection with aggregation expressions example (#1803) 2024-08-21 14:28:55 -05:00
Shruti Sridhar
4024a1b85d
PYTHON-4668 Improve performance of client.bulk_write (#1800) 2024-08-20 17:18:28 -07:00
Steven Silvester
c03721c8f5
PYTHON-4656 Fix running of enterprise auth tests (#1801) 2024-08-20 14:37:00 -05:00
Shruti Sridhar
ad888797cf
PYTHON-4666 Fix handling of large documents in client.bulk_write (#1798) 2024-08-19 12:57:57 -07:00
Steven Silvester
f16206cb89
PYTHON-4392 Support Range Indexes as GA (#1795) 2024-08-19 14:29:18 -05:00
Steven Silvester
efcecc9a7f
PYTHON-4648 Fix handling of event_loop_policy in tests (#1799) 2024-08-19 12:57:15 -05:00
Shruti Sridhar
559d8b1ea1
PYTHON-4596 Only encode each operation document once for MongoClient.bulk_write (#1797) 2024-08-16 15:55:57 -07:00
Shruti Sridhar
768858eed6
PYTHON-4630 Add documentation for MongoClient.bulk_write (#1794) 2024-08-16 15:55:30 -07:00
Shruti Sridhar
ce5c5adb63
PYTHON-4578 Benchmark collection and client bulk write (#1796) 2024-08-16 14:45:32 -07:00
Shane Harvey
8b44bc4bf3
PYTHON-4150 Resync spec tests to bump maxWireVersion (#1787) 2024-08-16 14:14:07 -07:00
Shruti Sridhar
297dfe6aa3
PYTHON-4660 Fix AttributeError when MongoClient.bulk_write batch fails with InvalidBSON (#1792) 2024-08-15 14:13:00 -07:00
Steven Silvester
adf8817df8
PYTHON-4584 Add length option to Cursor.to_list for motor compat (#1791) 2024-08-14 13:13:56 -05:00
Shane Harvey
f2f75fc1c8
PYTHON-4659 Fix async with TLS (#1793) 2024-08-13 18:32:48 -07:00
Steven Silvester
f69d330b25
PYTHON-4654 Clean up Async API to match Motor (#1789) 2024-08-13 19:17:45 -05:00
Shruti Sridhar
47b2257028
PYTHON-4641 Fix failure in async version of client bulk CSOT test (#1790) 2024-08-12 17:59:44 -07:00
Noah Stapp
a232b657d0
PYTHON-4613 Skip async tests when testing eventlet/gevent (#1780) 2024-08-12 10:23:43 -07:00
Shruti Sridhar
2afbd4b279
PYTHON-4650 Fix MongoClient.bulk_write test failure when compression is enabled (#1786) 2024-08-12 10:21:09 -07:00
Shane Harvey
30b32d00c4
PYTHON-4649 Skip CSOT tests on slow Windows and macOS hosts (#1784) 2024-08-12 10:10:19 -07:00
Shane Harvey
cd9de28c8f
PYTHON-4652 Remove duplicate async tests in Github Actions (#1785) 2024-08-09 23:19:46 -07:00
Shane Harvey
4742737876
PYTHON-4643 Fix test_to_list_tailable (#1783) 2024-08-09 23:19:15 -07:00
Steven Silvester
940d2c85fb
PYTHON-4616 Remove EVG release scripts (#1776) 2024-08-09 16:28:10 -05:00
Steven Silvester
d91393bc83
PYTHON-4644 Use a random name for hatchenv (#1782) 2024-08-09 16:27:38 -05:00
Shane Harvey
8939ea359c
PYTHON-4640 Improve performance of creating ObjectIds with multiple threads (#1781) 2024-08-08 19:34:39 -07:00
Steven Silvester
b14420a9df
PYTHON-4614 Do not test PyPy with OpenSSL 1.0.2 (#1777) 2024-08-08 15:40:18 -05:00
Steven Silvester
6934611879
PYTHON-4637 Fix azure kms task variant (#1779) 2024-08-08 13:43:51 -05:00
Shane Harvey
0a578b4452
PYTHON-4396 Unskip failCommand+appName tests on MongoDB 4.4.7+ (#1735) 2024-08-08 11:26:25 -07:00
Steven Silvester
f17f5e286e
PYTHON-4379 Test that durations are included on relevant pool events (#1765) 2024-08-08 13:18:28 -05:00
Noah Stapp
682f15b21e
PYTHON-4618 - Fix TypeError: Socket cannot be of type SSLSocket (#1772) 2024-08-08 08:21:59 -07:00
Shane Harvey
13cf110f01
PYTHON-4633 Speed up TestCollectionChangeStream.test_uuid_representations (#1775) 2024-08-07 16:17:48 -07:00
Shane Harvey
dcaa42bfa4
PYTHON-4632 Fix test_connection_timeout_message (#1774) 2024-08-07 11:31:23 -07:00
Steven Silvester
000e50c076
PYTHON-4266 Migrate Atlas Data Lake tests to unified test format (#1760) 2024-08-07 12:14:40 -05:00
Steven Silvester
d4e5ee10fc
PYTHON-4601 Address Azure KMS and GCP KMS setup failures (#1766) 2024-08-07 08:04:01 -05:00
Shane Harvey
da59318327
PYTHON-4610 More robust to_list tests (#1773) 2024-08-06 16:29:24 -07:00
Shruti Sridhar
d08fec6342
PYTHON-4550 Add MongoClient.bulk_write API (#1745) 2024-08-06 11:10:01 -07:00
Shane Harvey
da2465f2c7
PYTHON-4611 Prefer non deprecated cryptography apis (#1770) 2024-08-06 10:50:52 -07:00
Shane Harvey
a5d519775d
PYTHON-4605 Test serverMonitoringMode=poll waits after a successful heartbeat (#1767) 2024-08-05 12:26:06 -07:00
Shane Harvey
9c7adf89ef
PYTHON-4609 Speed up unified tests (#1768) 2024-08-02 16:32:11 -07:00
Shane Harvey
d28ceb2058
PYTHON-4021 Fix previous topologyDescription published when closing a client (#1769) 2024-08-02 16:31:59 -07:00
morotti
3d936d5c7d
PYTHON-4600 Handle round trip time being negative when time.monotonic() is not monotonic (#1758)
Co-authored-by: rmorotti <romain.morotti@man.com>
2024-08-02 13:25:32 -07:00
Noah Stapp
f7da1172cb
PYTHON-4592 - Synchronize inline examples and docstrings (#1756) 2024-08-02 12:02:28 -07:00
Noah Stapp
294f10b724
PYTHON-4021 - Publish TopologyDescriptionChangedEvent on topology close (#1762) 2024-08-02 09:42:49 -07:00
Steven Silvester
5699f8029d
PYTHON-4267 Convert read/write concern spec tests to unified test format (#1763) 2024-08-01 20:01:00 -05:00
Noah Stapp
8143f056b5
PYTHON-4571 - Add async examples to PyMongo's tutorial (#1744) 2024-08-01 13:10:47 -05:00
Steven Silvester
ecab109315
PYTHON-4478 Use single mongos in racy unacknowledged write tests (#1764) 2024-08-01 12:54:06 -05:00
Steven Silvester
a6c5c90ad7
PYTHON-4240 & PYTHON-4570 Update test definition in Client-Side encryption tests (#1761) 2024-07-31 17:43:00 -05:00
Steven Silvester
3235d392c1
PYTHON-4242 Convert retryable writes spec tests to unified test format (#1752) 2024-07-31 16:36:49 -05:00
Noah Stapp
17a8154f66
PYTHON-4594 - Add to_list documentation (#1757) 2024-07-31 13:18:04 -07:00
Steven Silvester
6020ae474d
PYTHON-4249 Convert retryable reads spec tests to unified test format (#1754) 2024-07-31 14:15:57 -05:00
Shane Harvey
bf12e975e3
PYTHON-4588 Don't include invalid port in URI parsing error message (#1753) 2024-07-31 09:41:43 -07:00
Noah Stapp
a3cd7045df
PYTHON-4549 - Optimize Cursor.to_list (#1749) 2024-07-30 15:45:30 -07:00
Noah Stapp
d79eee51ba
PYTHON-4521 Example transition of an existing test to an async one (#1702) 2024-07-30 15:09:45 -07:00
Noah Stapp
a5c0db66a1
PYTHON-4589 - Add async API docs (#1755) 2024-07-30 13:18:40 -07:00
Steven Silvester
98658cfd1f
PYTHON-4245 Convert CRUD v1 spec tests to unified test format (#1751) 2024-07-29 17:42:18 -05:00
Steven Silvester
af9cbda58d
PYTHON-4586 Fix hatch invocation (#1750) 2024-07-26 17:38:19 -05:00
Noah Stapp
cb89061627
PYTHON-4537 - Use selector asyncio loop on windows tests (#1748) 2024-07-26 09:49:28 -07:00
Steven Silvester
afd0b6f84c
PYTHON-4541 Add attestations for Python Releases (#1746) 2024-07-25 11:55:26 -05:00
Noah Stapp
0f5349e2e0
PYTHON-4572 - Fix type errors caused by new PyOpenSSL type hints (#1743) 2024-07-23 13:41:51 -07:00
Noah Stapp
993171cd3d
PYTHON-4565 - Use pytest markers for test suite configuration (#1741) 2024-07-23 14:28:55 -05:00
Steven Silvester
272538513a
PYTHON-4551 Remove Serverless Proxy Incremental Rollout Tests (#1742) 2024-07-23 14:02:08 -05:00
Shane Harvey
960eed5bf5
PYTHON-4556 Migrate to macOS 14 in AWS (#1737) 2024-07-23 11:09:48 -07:00
Noah Stapp
3e5387e0ac
PYTHON-4539 Add SSLContext async wrap_socket support (#1740) 2024-07-22 14:00:17 -07:00
Noah Stapp
105393109e
PYTHON-4533 - Fix failing async tests (#1739) 2024-07-17 12:57:55 -07:00
Shane Harvey
0d89e1276c
PYTHON-4558 Fix coverage and XML results for async tests (#1738) 2024-07-16 17:01:20 -04:00
Noah Stapp
f0e025a127
PYTHON-4533 - Convert test/test_cursor.py to async (#1731) 2024-07-16 13:55:11 -07:00
Noah Stapp
b6f72adb21
PYTHON-4533 - Convert test/test_sessions.py to async (#1733) 2024-07-16 12:58:01 -07:00
Noah Stapp
636603f893
PYTHON-4552 - Make AsyncCollection.find synchronous (#1734) 2024-07-16 11:05:51 -07:00
Noah Stapp
1b3dea3f03
PYTHON-4533 - Convert test/test_transactions.py to async (#1732) 2024-07-15 16:45:59 -07:00
Steven Silvester
875688cecc
PYTHON-4483 Use hatch as task runner (#1728)
Co-authored-by: Noah Stapp <noah@noahstapp.com>
2024-07-11 11:56:18 -05:00
Noah Stapp
d0193eb045
PYTHON-4533 - Convert test/test_client.py to async (#1730) 2024-07-10 13:15:13 -07:00
Steven Silvester
554ce7d984
PYTHON-4458 Test against Python 3.13 beta (#1729) 2024-07-10 10:05:16 -05:00
Shane Harvey
5cba4c44fe
PYTHON-4538 await _check_user_provided (#1726) 2024-07-08 12:11:50 -04:00
Shane Harvey
b2f0a52003
PYTHON-4526 DRIVERS_TOOLS needs to be set for encryption tests (#1723) 2024-07-08 11:53:03 -04:00
Shane Harvey
e4ba8ce6a3
PYTHON-4536 Cleanup param doc strings (#1725) 2024-07-05 17:09:20 -04:00
shruti-sridhar
f5b102ab2a
PYTHON-4525 Transition the existing test_database.py test to be asynchronous (#1716) 2024-07-02 17:03:10 -07:00
Noah Stapp
cfa215c185
PYTHON-4530 - Move synchronized test code into top-level test directory (#1718) 2024-07-02 08:59:39 -07:00
Shane Harvey
2d301e2db2
PYTHON-4531 Add back RANGEPREVIEW (#1719) 2024-06-28 12:09:00 -07:00
Shane Harvey
13185338f7
PYTHON-4524 Document support for MongoDB 8.0 (#1721) 2024-06-28 12:01:27 -07:00
Noah Stapp
32a5933d52
PYTHON-4532 - Fix blank docs pages for generated modules (#1722) 2024-06-27 15:19:47 -07:00
Shane Harvey
26f7a9d2ca
PYTHON-4524 Bump maxWireVersion for MongoDB 8.0 (#1720) 2024-06-27 13:46:30 -07:00
Shane Harvey
5c7bc15ca5
PYTHON-4529 Require pymongocrypt>=1.10 (#1714) 2024-06-27 11:25:38 -07:00
Steven Silvester
be448e0dae
PYTHON-4518 Clean up EVG S3 handling (#1717) 2024-06-27 12:58:54 -05:00
Noah Stapp
b035c9ce65
PYTHON-4520 Add test-async tox command and automated async testing (#1699) 2024-06-26 12:21:00 -07:00
Shane Harvey
3617b5cf51
PYTHON-4507 pip>=21.3 is required for editable installs (#1712) 2024-06-26 11:07:31 -07:00
Noah Stapp
ffa6555485
PYTHON-4476 Separate data and IO classes more effectively (#1678) 2024-06-26 10:12:39 -07:00
Steven Silvester
1c2f1f5c3d
PYTHON-4388 Fix dist handling in SSDLC workflow (#1705) 2024-06-26 11:26:37 -05:00
Shane Harvey
b82068541c
PYTHON-4527 Opt into range V2 encryption (#1704) 2024-06-25 15:03:49 -07:00
Noah Stapp
ff1d903bf2
PYTHON-4499 Log pymongo.connection at DEBUG without EventListeners (#1703) 2024-06-25 13:20:17 -07:00
Shane Harvey
1d9adfa3b9
Cleanup sys.version_info compat code (#1698) 2024-06-25 12:31:30 -07:00
Steven Silvester
8fbf84d314
PYTHON-4388 Add evergreen link in SSDLC Report (#1700) 2024-06-25 09:26:38 -05:00
shruti-sridhar
1d8d3fef00
PYTHON-2052 Truncate client metadata document to 512 bytes (#1696) 2024-06-24 11:59:41 -07:00
Shane Harvey
77087dd3c2
PYTHON-4323 Add regression test for out-of-bounds read when decoding invalid bson (#1693) 2024-06-20 09:57:04 -07:00
Steven Silvester
25cbc7e2a5
PYTHON-4388 Add SSDLC workflows (#1691)
Signed-off-by: mongodb-dbx-release-bot[bot] <167856002+mongodb-dbx-release-bot[bot]@users.noreply.github.com>
Co-authored-by: mongodb-dbx-release-bot[bot] <167856002+mongodb-dbx-release-bot[bot]@users.noreply.github.com>
2024-06-20 08:12:05 -05:00
Steven Silvester
d4b4b740dd
PYTHON-4509 Update to FIPS host with Python 3.8 binary (#1688) 2024-06-17 12:04:12 -05:00
Steven Silvester
76fa4686fd
PYTHON-4463 Add missing data in connection string test (#1685) 2024-06-17 11:43:20 -05:00
Noah Stapp
1f910b5ab7
PYTHON-4494 - AsyncMongoClient._cleanup_cursor needs to be synchronous (#1680) 2024-06-17 09:35:20 -07:00
Steven Silvester
bba5f8153a
PYTHON-4504 Use a venv for mod_wsgi test (#1687) 2024-06-14 18:58:14 -05:00
Steven Silvester
fe0faf74a6
PYTHON-4504 Update mod_wsgi test to not call setup.py (#1684) 2024-06-14 11:29:44 -05:00
Noah Stapp
8b6bb832ac
PYTHON-4503 - Re-enable accidentally disabled tests (#1683) 2024-06-14 09:25:34 -07:00
Shane Harvey
48bdbfd278
PYTHON-4347 Ensure client can be opened after fork() (#1681) 2024-06-13 14:35:10 -07:00
Steven Silvester
6f8a22d7d4
PYTHON-4497 Fix handling of Python executable in run-tests (#1677) 2024-06-12 19:13:55 -05:00
Noah Stapp
9a980202f8
PYTHON-4348 PYTHON-4455 Fix missing changes from async beta merge (#1674) 2024-06-12 13:55:58 -07:00
Esa Jokinen
4ec79fbde7
PYTHON-4492 Fallback to stdlib ssl when pyopenssl import fails with AttributeError (#1669) 2024-06-12 11:09:57 -07:00
Shane Harvey
6715cd3ba4
BUMP 4.9.0.dev0 (#1672) 2024-06-12 11:07:35 -07:00
Shane Harvey
5dd6ffbbb8
PYTHON-4347 Improve performance by only calling get_topology once (#1673) 2024-06-12 11:02:19 -07:00
Noah Stapp
76f1221e22
PYTHON-4206 - QE Range Protocol V2 (#1670) 2024-06-12 10:02:59 -07:00
Shane Harvey
8c35d1e481
PYTHON-4347 Improve performance by making _ServerSessionPool lock-free (#1660) 2024-06-11 12:50:26 -07:00
Noah Stapp
f7d2deb27d
PYTHON-4480 Deprecate create=True for Collection (#1659) 2024-06-10 12:31:19 -07:00
Steven Silvester
f7faff829c
PYTHON-4489 Make setup.py private (#1667) 2024-06-10 13:26:49 -05:00
Steven Silvester
ca543d4881
PYTHON-4463 Add authMechanism option to tests where needed (#1665) 2024-06-07 13:25:46 -05:00
Steven Silvester
63834127c8
PYTHON-4373 Add components field to SBOM file (#1661) 2024-06-07 09:57:24 -05:00
Steven Silvester
2b030018e5
PYTHON-4451 Use Hatch as Build Backend (#1644) 2024-06-07 06:24:18 -05:00
Noah Stapp
d6bf0e1e78
PYTHON-4264 Async PyMongo Beta (#1629) 2024-06-06 09:01:24 -07:00
Steven Silvester
e9c86f4c00
PYTHON-4463 Disallow comma character in authMechanismProperties connection string value (#1646) 2024-06-05 14:39:00 -05:00
Steven Silvester
42d30b31ac
PYTHON-4373 Add SBOM file (#1653) 2024-06-04 11:50:29 -05:00
Shane Harvey
cdf04ffa18
PYTHON-4261 Reduce verbosity of "Waiting for suitable server to become available" log message (#1656) 2024-06-03 15:04:05 -07:00
Steven Silvester
9cb03654e4
PYTHON-4384 Add Custom CodeQL Scanning (#1651) 2024-06-03 12:25:20 -05:00
Shane Harvey
2210f74002
PYTHON-4473 Optimize find/aggregate/command by avoiding duplicate calls to _get_topology (#1652) 2024-05-31 14:42:36 -07:00
Terry Patterson
ac66c9dfd2
PYTHON-4468 Hide the value of sensitive subtype binary objects (#1649)
Co-authored-by: Steven Silvester <steven.silvester@ieee.org>
2024-05-30 16:44:06 -05:00
Steven Silvester
49987e6a8a
PYTHON-4441 Use deferred imports instead of lazy module loading (#1648) 2024-05-30 16:40:23 -05:00
Steven Silvester
1d6cf42b81
PYTHON-4455 Improve import time on Windows (#1645) 2024-05-29 20:35:02 -05:00
Shane Harvey
8456293da2
PYTHON-4398 Close mongos test clients to avoid thread build up (#1643) 2024-05-21 11:30:43 -07:00
Steven Silvester
594dacaaf9
MOTOR-1315 Fix handling of explicitly skipped tests (#1642) 2024-05-20 10:07:30 -04:00
col
49466f9f67
PYTHON-4449 Ensure resume options aren't combined during automatic retry (#1641) 2024-05-15 10:03:40 -05:00
Steven Silvester
e45ca51e8b
PYTHON-4447 Use 8.0 for local OIDC server (#1639) 2024-05-15 09:59:40 -05:00
Steven Silvester
2153cd912d
PYTHON-4448 Drop MacOS 10.14 from Builds (#1640) 2024-05-15 09:58:04 -05:00
Steven Silvester
328c06d454
PYTHON-4356 & PYTHON-4414 Skip Failing Tests (#1638) 2024-05-14 14:56:09 -05:00
Steven Silvester
3004523ab0
PYTHON-4439 Use environment variable to detect dataLake test (#1637) 2024-05-13 14:14:47 -05:00
Noah Stapp
da03da34c6
PYTHON-4406 Skip rangePreview tests on server version 8.0+ (#1636) 2024-05-10 10:00:13 -07:00
Steven Silvester
7b12dd482c
PYTHON-4256 OIDC Test Cleanup (#1632) 2024-05-08 19:31:19 -05:00
Steven Silvester
46da55b4d1
PYTHON-4429 Add Changelog for 4.7.2 (#1635) 2024-05-08 16:50:24 -05:00
Steven Silvester
847bb36465
PYTHON-4414 Increase interruptInUseConnections timeout again to fix flaky test (#1634) 2024-05-07 12:09:25 -05:00
Noah Stapp
42f45034f3
PYTHON-4372 & PYTHON-4378 Deprecate Python 3.7 and Update supported PyPy Versions to 3.9 and 3.10 (#1630) 2024-05-06 09:36:50 -07:00
Steven Silvester
3ff1e84cb2
PYTHON-4428 Test against 8.0 builds (#1631) 2024-05-03 15:30:33 -05:00
Steven Silvester
263977a8c8
PYTHON-4424 Add workaround for ModuleNotFoundError TypeError (#1628) 2024-05-03 04:49:05 -05:00
Steven Silvester
7e5945e0c4
PYTHON-4420 Fix GitHub Actions publish job (#1626) 2024-04-30 14:04:35 -05:00
Steven Silvester
4758f1fb46
BUMP 4.8.0.dev0 2024-04-30 09:39:49 -05:00
Steven Silvester
0841039941
PYTHON-4411 Prep for 4.7.1 Release (#1625) 2024-04-30 09:37:37 -05:00
Steven Silvester
4c0f884c04
PYTHON-4409 Streamline Wheel Building (#1624) 2024-04-30 09:34:05 -05:00
Steven Silvester
6584dd2389
PYTHON-4256 Clean up handling of TOKEN_RESOURCE (#1620) 2024-04-29 15:45:24 -05:00
Steven Silvester
b83fd991fe
PYTHON-3601 OIDC: Clarify TOKEN_RESOURCE and client_id usage (#1621)
Co-authored-by: Mike Woofter <108414937+mongoKart@users.noreply.github.com>
2024-04-29 13:22:14 -05:00
Subin Kim
21461ace4f
fix: update pyproject.toml project source url (#1623) 2024-04-29 05:19:28 -05:00
Steven Silvester
4ea8fcbb3b
PYTHON-4407 Eagerly import dnspython (#1622) 2024-04-26 09:15:02 -05:00
Steven Silvester
256f5a23a7
PYTHON-4402 Remove dead links (#1619) 2024-04-25 14:51:13 -05:00
Steven Silvester
9f0c0c50d7
PYTHON-4401 Fix make_sdist job (#1618) 2024-04-24 19:37:49 -05:00
Steven Silvester
4cd8191856
BUMP 4.8.0.dev0 2024-04-24 13:01:36 -05:00
Steven Silvester
366492530a
PYTHON-4228 Update changelog and bump to 4.7 version (#1617) 2024-04-24 12:08:41 -05:00
Steven Silvester
b6f0081cf9
PYTHON-3601 OIDC: Fix documentation example and remove EKS section (#1614) 2024-04-24 12:03:36 -05:00
Steven Silvester
b5e54aae23
PYTHON-4256 Ensure TOKEN_RESOURCE is url-encoded (#1616) 2024-04-24 10:21:18 -05:00
Steven Silvester
ec5711e4b5
PYTHON-3664 OIDC: Fix GCP headers (#1615) 2024-04-24 10:48:29 -04:00
Casey Clements
e8900ad9f4
PYTHON-4227 Unified tests: Advance cluster_time of ClientSessions after initialData creation (#1603) 2024-04-24 06:27:06 -05:00
Steven Silvester
79fb19c1a6
PYTHON-4256 OIDC - Convert two unified tests to prose tests (#1612) 2024-04-22 15:12:28 -05:00
Steven Silvester
a053a6d4b9
PYTHON-4363 Add dependabot config for Python (#1613) 2024-04-22 14:22:19 -05:00
Steven Silvester
9a3caefbeb
PYTHON-4376 Fix typo in changelog (#1611) 2024-04-19 15:20:45 -05:00
Steven Silvester
2588ca3782
PYTHON-3601 OIDC: Add Documentation Examples (#1601)
Co-authored-by: Noah Stapp <noah@noahstapp.com>
2024-04-19 13:29:50 -05:00
Steven Silvester
90906c3f9d
PYTHON-4346 Remove CODEOWNERS file (#1609) 2024-04-19 13:06:39 -05:00
Steven Silvester
a1def1542a
PYTHON-4376 Document recommended dnspython version (#1610) 2024-04-19 10:55:20 -05:00
Steven Silvester
a421c662e6
PYTHON-4373 Use requirements files for deps (#1605) 2024-04-17 17:58:35 -05:00
Shane Harvey
aa8322e1ce
PYTHON-2048 Add test case for better error behavior (#1606) 2024-04-17 15:50:15 -07:00
Steven Silvester
5f372ba63a
PYTHON-4373 Move dependency declaration to setup.py (#1602) 2024-04-17 13:08:50 -05:00
Steven Silvester
4470309fa0
PYTHON-2048 Improve error message for bulk_write failures due to unsupported storage enginge (#1600) 2024-04-17 12:21:09 -05:00
Shane Harvey
8ff9c829bc
PYTHON-4305 Add changelog for 4.6.3 (#1598) 2024-04-16 18:13:47 -07:00
Shane Harvey
50eeb6788b
PYTHON-4348 Reinstate fork warning because network I/O and threads are not fork safe (#1597) 2024-04-16 16:22:39 -07:00
Shane Harvey
70bb43b30b
PYTHON-4334 Fix test_heartbeat_start_ordering, ensure TCPServer starts before client (#1599) 2024-04-16 16:18:10 -07:00
Shane Harvey
5a0c81c00c
PYTHON-4371 Fix include_system_collections example in migration guide (#1596) 2024-04-16 11:30:05 -07:00
Shane Harvey
724186700f
PYTHON-3741 Fix rendering of CodecOptions links in docs (#1595) 2024-04-16 11:29:27 -07:00
Steven Silvester
8f7b86f3f3
PYTHON-4057 Emit DeprecationWarning for deprecated GridFS apis (#1593) 2024-04-16 11:02:05 -05:00
Steven Silvester
09e24a4bea
PYTHON-4346 Reinstate CODEOWNERS File and Add Static Check in CI (#1587) 2024-04-16 11:01:18 -05:00
Steven Silvester
cbf11da323
PYTHON-3741 Fix rendering of CodecOptions links in docs (#1594) 2024-04-16 10:58:26 -05:00
Steven Silvester
2df024f814
PYTHON-3984 Deprecate WriteConcern.wtimeout in favor of pymongo.timeout() (#1591) 2024-04-16 05:27:09 -05:00
Shane Harvey
ff442674e1
PYTHON-4367 Fix link to GCP VM metadata (#1592) 2024-04-15 17:48:40 -07:00
Steven Silvester
60f1a43efa
PYTHON-4353 Make dns import optional but required for tests (#1588) 2024-04-15 18:45:22 -05:00
Shane Harvey
9d2a1ce4ba
PYTHON-4362 Resync CMAP tests (#1586) 2024-04-12 17:56:08 -07:00
Noah Stapp
bc7181c3c0
PYTHON-4354 & PYTHON-4355 - Increase logging limit for tests cleanup (#1585) 2024-04-12 17:13:57 -07:00
Noah Stapp
29df4159ed
PYTHON-4354 & PYTHON-4355 - Increase logging limit for tests (#1584) 2024-04-12 16:15:54 -07:00
Shane Harvey
74595a1608
PYTHON-4361 Skip transactions tests on MMAPv1 (#1583) 2024-04-12 15:28:34 -07:00
Steven Silvester
1e6147ba22
PYTHON-4355 Remove extra imports for Green Framework tests (#1582) 2024-04-12 13:55:51 -07:00
Steven Silvester
cbff329775
PYTHON-4349 Fix snappy support on PyPy 3.8 (#1579) 2024-04-12 12:39:26 -05:00
Casey Clements
c8727e98eb
PYTHON-4303 Temporarily skip two transaction tests (#1577) 2024-04-12 10:20:33 -04:00
Steven Silvester
e40ff35168
PYTHON-4322 Fix racy unified tests of unacknowledged writes (#1578) 2024-04-10 20:19:51 -05:00
Shane Harvey
9d43606662
PYTHON-4325 Add multi-threaded benchmarks for Find and RunCommand (#1576) 2024-04-10 17:34:16 -07:00
Shane Harvey
4e5813c07b
PYTHON-4299 Add support for TopologyDescriptionChangedEvent to expectEvents (#1572) 2024-04-10 17:16:20 -07:00
Steven Silvester
efe8cc38a6
PYTHON-4256 OIDC Spec Cleanup (#1556) 2024-04-10 11:29:42 -05:00
Shane Harvey
8be31bf8f1
PYTHON-4350 Faster and more consistent performance benchmark execution times (#1575) 2024-04-09 18:44:42 -07:00
Shane Harvey
48d5a46e46
PYTHON-4332 create_search_index only sends "type" field when provided (#1573) 2024-04-08 11:34:51 -07:00
Noah Stapp
2da8af01a6
PYTHON-3416 Mongos SRV Poller should wait 60 seconds to poll (#1571) 2024-04-05 11:21:18 -07:00
Alessio Castrica
167b9648ca
PYTHON-4298 Raise ConfigurationError not TypeError when round_trip_time is None in server selection (#1566)
Co-authored-by: Alessio <alessio.castrica@investsuite.com>
2024-04-04 12:57:07 -07:00
Steven Silvester
1e0ef67ab8
PYTHON-3664 OIDC: Automatic token acquisition for GCP Identity Provider (#1540) 2024-04-03 16:07:41 -05:00
Steven Silvester
c154c6b67b
PYTHON-4037 Avoid Appending Write/Read Concern in Atlas Search Index Helper Commands (#1570) 2024-04-03 06:17:51 -05:00
Steven Silvester
44e47304ff
PYTHON-4300 Forward comment argument in list_search_indexes (#1569) 2024-04-01 16:41:55 -05:00
Steven Silvester
bce047dfc9
PYTHON-4309 OIDC Atlas Testing Updates (#1567) 2024-04-01 14:39:07 -05:00
Steven Silvester
61488918f9
PYTHON-4303 Fix Unified Transaction Test Runner (#1568) 2024-04-01 11:57:30 -05:00
Shane Harvey
add6a30766
PYTHON-4285 Fix PyModule_GetState check (#1565) 2024-03-29 10:09:29 -07:00
Shane Harvey
372b5d68d5
PYTHON-4305 Fix bson size check (#1564) 2024-03-27 18:51:23 -05:00
Steven Silvester
e68bd6f83e
PYTHON-2723 Make mongos_clients a class property (#1563) 2024-03-27 13:37:19 -05:00
Steven Silvester
9a206a3896
PYTHON-4301 Fix MONGODB-AWS credential caching (#1562) 2024-03-27 12:37:53 -05:00
Steven Silvester
3699f513fa
PYTHON-4265 Rename OIDC property PROVIDER_NAME and config values (#1545)
Co-authored-by: Jib <Jibzade@gmail.com>
2024-03-27 12:29:45 -05:00
Steven Silvester
e37394d402
PYTHON-2723 Convert transactions spec tests to unified test format (#1543) 2024-03-26 17:28:32 -05:00
Shane Harvey
f757fe39cc
PYTHON-4297 Allow passing arbitrary options to create_search_index/SearchIndexModel (#1561) 2024-03-26 10:18:54 -07:00
Shane Harvey
ec4cb3ee55
PYTHON-4285 More consistent PyModule_GetState checks (#1560) 2024-03-25 13:48:45 -07:00
Steven Silvester
42a08c4a34
PYTHON-4260 Lazily load optional imports (#1550) 2024-03-25 12:55:41 -05:00
Steven Silvester
5e49363c97
PYTHON-4295 Fix Installation of Crytography on PyPy3.8 (#1559) 2024-03-22 13:34:46 -05:00
Steven Silvester
8194e875f3
PYTHON-4293 Update link to mongodump example (#1557) 2024-03-22 09:45:43 -05:00
Zak
bcb75cf5f7
PYTHON-4294 Add Note on Dict Ordering (#1558) 2024-03-22 09:28:57 -05:00
Noah Stapp
f7a7b5a332
PYTHON-4271 Skip failing serverless proxy tests (#1555) 2024-03-19 15:23:47 -07:00
Noah Stapp
a46331d478
PYTHON-4286 Remove duplicate test_detect_external_db (#1554) 2024-03-18 16:22:35 -07:00
Steven Silvester
126a9ab0af
PYTHON-3467 Use client_id instead of object_id for Azure username (#1551) 2024-03-18 11:34:44 -05:00
Shane Harvey
5fedbeed51
PYTHON-4282 Stop using filemd5 in docs example for db.command (#1553) 2024-03-15 15:14:49 -07:00
Noah Stapp
c3f09f635b
PYTHON-4277 Fix redaction logging test failures (#1552) 2024-03-15 13:31:52 -07:00
Noah Stapp
17c64a6dd8
PYTHON-4208 [Vector Search GA] Add support for types in search index creation (#1544) 2024-03-15 13:04:47 -07:00
Steven Silvester
944bea3892
PYTHON-4270 Run typing tests on Python 3.7 (#1548) 2024-03-12 11:52:27 -05:00
Steven Silvester
7a90fe8828
PYTHON-4255 Add __getitem__ and __getattr__ methods to API docs (#1547) 2024-03-12 10:36:45 -05:00
Steven Silvester
6a56d09433
PYTHON-4269 Limit when pull request-specific tasks are run (#1546) 2024-03-11 11:45:02 -05:00
Noah Stapp
266b3dd8e9
PYTHON-3835 Log informational message client-side based on detected environment (#1537) 2024-03-07 14:53:09 -08:00
Noah Stapp
b041ca5f7c
PYTHON-4022 - Ensure ServerHeartbeatStartedEvents are emitted before connecting (#1542) 2024-03-05 07:53:53 -08:00
Noah Stapp
af2d56c5b5
PYTHON-3841 Add durations to connection pool events (#1538) 2024-03-04 11:55:00 -08:00
Shane Harvey
7da5688d00
PYTHON-2822 Fix changelog for Hello.connection_id (#1541) 2024-03-04 11:11:18 -08:00
Steven Silvester
3510c4e5f6
PYTHON-4243 Use GitHub App to Auto Assign Reviewer (#1539) 2024-03-01 11:42:31 -06:00
Shane Harvey
dc50cbd35a
PYTHON-4223 Log serviceId as hex string (#1535) 2024-02-23 13:50:44 -08:00
Steven Silvester
4d2deba8db
PYTHON-4210 Migrate Remaining Secrets to AWS Vaults (#1517) 2024-02-23 05:47:08 -06:00
Steven Silvester
06bf176208
PYTHON-4219 Add changelog entry for 4.6.2 (#1534) 2024-02-22 09:46:22 -06:00
Jib
19b45df434
PYTHON-3951: Remove SkipTest on ListSearchIndex tests (#1531) 2024-02-21 09:11:12 -05:00
Steven Silvester
5d01a4102c
PYTHON-4182 Skip additional TransientTransactionError test on latest (#1529) 2024-02-20 18:46:36 -06:00
Steven Silvester
0793138d7f
PYTHON-4117 Require 4.3.1+ server version when using failCommand errorLabels option (#1526) 2024-02-20 13:28:08 -06:00
Shane Harvey
5b5a7e640b
PYTHON-4156 Increase interruptInUseConnections timeout to fix flaky test (#1528) 2024-02-16 14:14:06 -08:00
Shane Harvey
a8b8dab04a
PYTHON-3745 Add support for multiphase initialization (#1499)
Co-authored-by: Steven Silvester <steven.silvester@ieee.org>
2024-02-16 10:44:13 -08:00
Shane Harvey
7d6635b56c
PYTHON-3847 Encode DatetimeMS using type_marker lookup (#1524) 2024-02-16 10:43:57 -08:00
Steven Silvester
158e6c6574
PYTHON-4218 Update links to change-streams specification (#1525) 2024-02-16 08:37:03 -06:00
Noah Stapp
ebb94b669e
PYTHON-3457 Easier debugging with standardized logging (#1515)
PYTHON-3458 Add command logging.
PYTHON-3459 Add server selection logging.
PYTHON-3473 Add connection pool logging.
PYTHON-4167 Add documentation and examples.

Co-authored-by: sleepyStick <itsirisho@gmail.com>
2024-02-15 11:35:08 -08:00
Steven Silvester
d99a095b33
PYTHON-4205 Fix TestDataLakeProse.test_3 (#1519) 2024-02-09 19:41:47 -06:00
Steven Silvester
42f5ff17ce
PYTHON-4194 Fix Cryptography Install on PyPy (#1518) 2024-02-09 15:19:42 -06:00
Jib
fe37841f07
PYTHON-4147-fix: Remove quote wrapping and remove shell=true usage (#1513) 2024-02-07 14:24:20 -05:00
Steven Silvester
5c2e3991dc
PYTHON-4195 Build x86_64 wheels for MacOS (#1505) 2024-02-06 19:58:52 -06:00
Shane Harvey
4c2e717b9f
PYTHON-4204 Optimize JSON decoding using lookup table to find $ keys (#1512) 2024-02-06 16:18:31 -08:00
Shane Harvey
296a44df46
PYTHON-4179 Verify document_class type in json_util.loads test (#1509) 2024-02-06 14:18:09 -08:00
Steven Silvester
051ff77062
PYTHON-4196 Fix import in OIDC Test (#1504) 2024-02-06 08:49:57 -06:00
Steven Silvester
2f94927354
PYTHON-4182 Skip test_unpin_after_TransientTransactionError_error_on_abort on latest (#1508) 2024-02-05 20:30:35 -06:00
Shane Harvey
698599c737
PYTHON-2267 Test passing UUID to encrypt_expression (#1510) 2024-02-05 15:53:44 -08:00
ilukyanchikov
97b9a333c8
PYTHON-4179: Optimize JSON decoding performance by avoiding object_pairs_hook (#1493) 2024-02-05 13:59:14 -08:00
Noah Stapp
62c6d0f330
PYTHON-3587 Do not perform server selection to determine sessions support (#1491) 2024-02-05 13:19:26 -08:00
Steven Silvester
12e8778fbd
PYTHON-4184 Clean up tox config (#1500) 2024-02-05 13:31:37 -06:00
Steven Silvester
f052b7e82e
PYTHON-4187 Ensure secrets are not logged in Evergreen (#1503) 2024-02-05 12:35:05 -06:00
dependabot[bot]
ead6586178
Bump the actions group with 6 updates (#1502)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Steven Silvester <steven.silvester@ieee.org>
2024-02-05 12:30:11 -06:00
Jib
62c3cb10b5
PYTHON-4183: Improve changelog entry for breaking SON -> dict change in PYTHON-2884 (#1498) 2024-02-05 12:49:53 -05:00
Jib
0f7e1b0110
PYTHON-4147: Silence noisy thread.start() RuntimeError at shutdown (#1486) 2024-02-05 08:46:32 -05:00
ilukyanchikov
da2bf9dbcc
PYTHON-2267: Allow UUID key_id to be passed to ClientEncryption.encrypt (#1494) 2024-02-02 10:29:14 -08:00
Steven Silvester
c2af3dfeed
PYTHON-4186 Add Dependabot Config for GitHub Actions (#1501) 2024-02-02 10:39:28 -06:00
Steven Silvester
4bc2a482d9
PYTHON-3467 OIDC: Automatic token acquisition for Azure Identity Provider (#1443)
Co-authored-by: Jib <Jibzade@gmail.com>
2024-02-02 09:53:48 -06:00
Steven Silvester
78ccdcb2b3
PYTHON-4177 Build and Test M1 macOS wheels on GHA (#1497) 2024-02-01 12:55:31 -06:00
Steven Silvester
b185e50e41
PYTHON-4174 Update TLS cheat sheet link (#1496) 2024-01-31 13:57:43 -06:00
Steven Silvester
1d65448af6
Revert "PYTHON-4018 Clarify exactly what code/label fields drivers should inspect to determine retryability" (#1495) 2024-01-31 13:57:23 -06:00
Shane Harvey
55f12c684c
PYTHON-4112 Revert to testing with pymongocrypt@master and update mock KMS ports (#1492) 2024-01-30 17:51:15 -08:00
Shane Harvey
0615df47b5
PYTHON-4112 Support named KMS providers (#1487)
Requires pymongocrypt >= 1.9.0 and libmongocrypt >= 1.9.0.
2024-01-30 12:00:24 -08:00
Steven Silvester
68d22b20bd
PYTHON-4151 Use Centralized Scripts for CSFLE Tests (#1477) 2024-01-29 17:19:24 -06:00
Steven Silvester
85b0c0e3c1
PYTHON-4018 Clarify exactly what code/label fields drivers should inspect to determine retryability (#1489) 2024-01-29 12:58:15 -06:00
Noah Stapp
5877be9623
PYTHON-4166 Pools should be properly closed instead of reset in topology (#1485) 2024-01-29 10:43:35 -08:00
Shane Harvey
c05a62b188
PYTHON-4170 Fix test_invalid_hostname_in_kms_certificate (#1488) 2024-01-26 10:22:21 -08:00
Steven Silvester
41a131ea1c
PYTHON-4031 Add driver tests for Serverless Proxy incremental rollout (#1428) 2024-01-25 13:20:28 -06:00
Jari Van Melckebeke
5cd4ca319b
PYTHON-4158 Fix typo in create_index docstring (#1483) 2024-01-23 08:24:20 -06:00
Shane Harvey
59c2f7cd5b
PYTHON-4157 Fix broken links (#1482) 2024-01-22 13:48:18 -08:00
Shane Harvey
2fc4282acd
PYTHON-4146 Improve GridFS upload performance by batch writing chunks with insert_many (#1478) 2024-01-22 10:53:53 -08:00
Shane Harvey
c3458e9d8e
PYTHON-4155 Add perf benchmark with TLS enabled (#1481) 2024-01-22 10:39:26 -08:00
Noah Stapp
c4e4bd638f
PYTHON-3175 Preemptively cancel in progress operations when SDAM heartbeats timeout (#1465) 2024-01-19 10:55:10 -08:00
Shane Harvey
b8d6bfdf08
PYTHON-4144 Optimize json_util encoding performance using single dispatch table (#1475) 2024-01-18 11:43:36 -08:00
Steven Silvester
b9e1bf7f44
PYTHON-4148 Update documentation dependencies (#1476) 2024-01-16 13:29:51 -06:00
Shane Harvey
cd3f502de6
PYTHON-4143 Optimize JSON encoding of int, float, str, and None (#1474) 2024-01-12 12:59:15 -08:00
Shane Harvey
72663deb33
PYTHON-4142 json_util.default should always convert Int64 (#1473) 2024-01-12 10:57:54 -08:00
Noah Stapp
f67e9ae207
PYTHON-1374 Optimize json_util performance (#1460) 2024-01-11 16:44:38 -08:00
Casey Clements
7adda818a5
PYTHON-4016 making ReadConcernMajorityNotAvailableYet a retryable error (#1467) 2024-01-11 08:55:53 -05:00
Casey Clements
dcec415771
PYTHON-4015 Add test that ExceededTimeLimit is a retryable exception for reads (#1463) 2024-01-10 11:20:10 -05:00
Shane Harvey
70bd1632cf
PYTHON-4125 Add JSON micro-benchmarks (#1466) 2024-01-09 10:17:33 -08:00
Shane Harvey
3dea7ccf31
PYTHON-4087 Fix test_validate_collection_background by flushing writes via fsync (#1464) 2024-01-05 13:30:05 -08:00
Steven Silvester
99c7338163
PYTHON-4111 Search index management operations fail with a different error message (#1462) 2024-01-04 05:32:57 -06:00
Jib
60d0761527
PYTHON-2884: Replaced SON usage in all internal classes and commands (#1426) 2023-12-19 15:42:23 -08:00
Casey Clements
ffd61f8d74
PYTHON-4077 Make sure to upload release wheel for python 3.7 on macos… (#1459) 2023-12-19 12:34:21 -05:00
Steven Silvester
423b2f8b09
PYTHON-4103 Add badges to README (#1461) 2023-12-15 06:10:58 -06:00
Steven Silvester
b976531f1d
PYTHON-4079 Generate ManyLinux2014 and ManyLinux1 Wheels (#1454) 2023-12-13 15:14:44 -06:00
Noah Stapp
9d32a09e30
PYTHON-4084 Fix BSON inflation for DBRef (#1458) 2023-12-12 13:00:14 -08:00
Noah Stapp
568a3b1294
PYTHON-4084 Fix BSON inflation for RawBSONDocument (#1456) 2023-12-08 10:08:41 -08:00
Steven Silvester
8422edf3ab
PYTHON-4054 Add ability to serve live docs (#1447) 2023-12-07 15:46:46 -06:00
Noah Stapp
8c293d2662
PYTHON-3963 Migrate CSFLE Tests to AWS Secrets Vault (#1446) 2023-12-07 10:06:52 -08:00
Steven Silvester
1412afef61
PYTHON-4046 Add connection string tests for uppercase UNIX socket names (#1453) 2023-12-05 15:27:34 -06:00
Shane Harvey
1a6f99c653
PYTHON-3822 Add SRV test with uppercase hostname (#1423) 2023-12-05 13:27:18 -08:00
Casey Clements
988ce0df33
PYTHON-4070 Add setuptools as dep for test target (#1451) 2023-12-04 14:51:40 -08:00
Steven Silvester
704858ee3e
PYTHON-4045 Use PyPI Trusted Publishing (#1442) 2023-12-04 13:11:39 -06:00
Casey Clements
0cc968c029
PYTHON-4072 Add test decorator turning off test.test_database.TestDat… (#1449) 2023-12-04 11:11:35 -06:00
Noah Stapp
b1939e1470
PYTHON-2822 Add server connectionId to command monitoring events (#1438) 2023-12-01 14:33:37 -08:00
Steven Silvester
fa25311726
PYTHON-4068 Fix AWS ECS Task (#1444) 2023-12-01 15:29:44 -06:00
Casey Clements
2dd33a2c15
PYTHON-4055 Add xunit-results to .gitignore (#1445) 2023-11-30 19:39:40 -06:00
Casey Clements
d4dfd4a044
PYTHON-3036 Improve error message for unknown MongoClient options (#1440) 2023-11-30 11:21:10 -08:00
Steven Silvester
6537415da7
PYTHON-3605 Move type annotations to parameter list in rendered docs (#1441) 2023-11-27 09:24:00 -06:00
Steven Silvester
51f7fe29f6
PYTHON-4047 Convert top level docs files to Markdown (#1432) 2023-11-21 14:24:49 -06:00
Shane Harvey
ec35f7f76e
PYTHON-3823 Audit benchmark data_size and calculate dynamically it where possible (#1439) 2023-11-17 12:07:33 -08:00
Shane Harvey
fc220532df
PYTHON-3823 Merge perf task into main project (#1436) 2023-11-17 10:35:46 -08:00
Shane Harvey
2ac7f0d88d
PYTHON-3823 Migrate perf testing to rhel90-dbx-perf-large, Python 3.10.4, MongoDB 6.0.6 (#1431) 2023-11-16 12:50:13 -08:00
Steven Silvester
134b7efaec
PYTHON-4043 [v4.6] Add changelog entry for 4.6.1 (#1435) 2023-11-16 10:56:35 -06:00
Steven Silvester
9c45ef808a
PYTHON-4043 Add changelog entry for 4.6.1 (#1433) 2023-11-16 09:50:58 -06:00
Jib
0ff6a87438
PYTHON-4038: Ensure retryable read OperationFailures re-raise exception when 0 or NoneType error code is provided. (#1425) 2023-11-15 15:03:36 -05:00
Noah Stapp
5dc60342ed
PYTHON-2834 Direct read/write retries to another mongos if possible (#1421) 2023-11-14 12:49:42 -08:00
Steven Silvester
b0cd7d2361
PYTHON-4039 Handle more warnings in tests (#1427) 2023-11-13 13:59:23 -06:00
Shane Harvey
578024e16a
PYTHON-3170 Run ping command in SRV spec tests (#1424) 2023-11-08 12:59:13 -08:00
Steven Silvester
83d0e7afa4
PYTHON-4033 Address perf test UserWarning (#1422) 2023-11-07 13:19:20 -06:00
Steven Silvester
f230a2e486
DRIVERS-2543 Fix source branch for drivers-tools (#1420) 2023-11-06 13:21:07 -06:00
Steven Silvester
afc2c285b2
DRIVERS-2543 Pull mongohouse image from ADL ECR repo (#1390) 2023-11-06 12:51:20 -06:00
Noah Stapp
6c88c73219
PYTHON-3837 Driver Container and Kubernetes Awareness (#1418) 2023-11-02 13:13:45 -07:00
Steven Silvester
923c8a5abe
PYTHON-4024 Use ruff formatter (#1419) 2023-11-02 12:46:40 -05:00
Steven Silvester
7936708d97
PYTHON-4014 Apply QA Suggestions from Scientific Python Library Development Guide (#1414) 2023-11-01 19:37:22 -05:00
Jib
57ca5b19d0 updated the RELEASE.rst to have more recent links 2023-11-01 17:03:24 -04:00
Jib
3932c2fdc4 BUMP 4.7.0.dev0 2023-11-01 16:51:22 -04:00
Jib
8e25ce1ca8 BUMP 4.6.0 2023-11-01 16:26:29 -04:00
Jib
a17e412fee
Updated changelog with timeout info change (#1417) 2023-11-01 16:25:25 -04:00
Shane Harvey
a09a03e5df
PYTHON-3930 Add docs page for network compression (#1415) 2023-11-01 11:53:15 -07:00
Shane Harvey
4b9c5b9a1e
PYTHON-3968 Fix mockupdb tox config (#1416) 2023-11-01 11:49:52 -07:00
Steven Silvester
c146017de1
PYTHON-4012 Adopt more RST static checks (#1412) 2023-10-31 07:55:24 -05:00
Noah Stapp
8faa910f3c
PYTHON-3743 Bump minServerVersion for CSFLE deterministic encryption … (#1411) 2023-10-30 14:20:27 -07:00
Noah Stapp
06653c9e21
PYTHON-3926 Add more information to connection errors and timeouts (#1375) 2023-10-30 14:20:18 -07:00
Steven Silvester
28250580d1
PYTHON-3950 Add PyMongo 3.13 Changelog Entry to Current Branch (#1410) 2023-10-30 12:59:16 -05:00
Shane Harvey
7bb9a73b2f
PYTHON-3968 Allow pymongo to be installed in tox when C extension fails to build (#1409) 2023-10-27 18:06:19 -07:00
Shane Harvey
58a36e9838
PYTHON-4010 Fix test_timeout_kills_cursor_asynchronously (#1408) 2023-10-25 12:25:20 -07:00
Shane Harvey
33fef9f113
PYTHON-4009 Include bson+gridfs in coverage report (#1407) 2023-10-24 14:56:52 -07:00
Shane Harvey
2431d71757
PYTHON-3987 Enable coverage relative_files=true and use pyproject.toml (#1406) 2023-10-24 13:31:04 -07:00
Shane Harvey
650cde992f
PYTHON-4007 Stop sending exhaustAllowed to Serverless/load balanced clusters unless configured (#1405) 2023-10-23 15:49:21 -07:00
Shane Harvey
6b1bef3711
PYTHON-3962 Make delimiting slash between hosts and options optional (#1404) 2023-10-20 16:29:59 -07:00
Shane Harvey
a0e9d61678
PYTHON-3747 Fix flaky test_list_databases (#1403) 2023-10-20 14:45:52 -07:00
Noah Stapp
19c5fcfb74
PYTHON-3757 Bulk write operations don't consider hint field in equality checks (#1402) 2023-10-20 14:08:43 -07:00
Shane Harvey
b9bb6f847b
PYTHON-1424 Add repr to write result classes (#1400) 2023-10-20 13:52:52 -07:00
Noah Stapp
d82946334e
PYTHON-3953 - PyMongo should send killCursors on MaxTimeMSExpired Error (#1372) 2023-10-20 13:42:59 -07:00
Noah Stapp
61269c0f89
PYTHON-3958 BSON failure - TestDatetimeConversion.test_millis_from_da… (#1394) 2023-10-19 11:46:21 -07:00
Steven Silvester
992d1507e7
PYTHON-4005 Replace flake8 and isort with ruff (#1399) 2023-10-19 11:56:22 -05:00
Noah Stapp
1f7b74f37d
PYTHON-3943 Serverless failure - TestUnifiedRunCursorCommand (#1374) 2023-10-19 09:41:21 -07:00
Steven Silvester
8eb74838db
PYTHON-3489 Remove legacy shell from test scripts (#1397) 2023-10-17 14:15:04 -05:00
Noah Stapp
015073d4c1
PYTHON-3988 Python Test Suite still uses legacy isMaster Command when… (#1395) 2023-10-17 10:55:18 -07:00
Noah Stapp
4fa6056e72
PYTHON-2878 Allow passing dict to sort/create_index/hint performance … (#1396) 2023-10-17 10:50:06 -07:00
Steven Silvester
fbf29374bc
PYTHON-4002 No module named coverage.__main__ (#1398) 2023-10-17 09:28:15 -05:00
Shane Harvey
1cbd192a84
PYTHON-3995 Fix race in serverMonitoringMode test (#1393) 2023-10-16 15:27:49 -07:00
Noah Stapp
81c759a3a0
PYTHON-2878 Allow passing dict to sort/create_index/hint (#1389) 2023-10-16 14:36:27 -07:00
Steven Silvester
2f13aee868
PYTHON-3987 Fix coverage report handling (#1391) 2023-10-16 15:35:59 -05:00
Steven Silvester
8762f014d6
PYTHON-3994 Remove link to MongoAlchemy (#1392) 2023-10-16 13:00:21 -05:00
Shane Harvey
4c00227c1d
PYTHON-3668 Use polling SDAM mode on FaaS and add sdamMode=auto/stream/poll (#1360)
Disable streaming SDAM by default on AWS Lambda and similar FaaS platforms.
Introduce the serverMonitoringMode=stream/poll/auto URI option.
Add Unified Test Format version 1.17 to add support for server heartbeat events.
2023-10-12 13:19:16 -07:00
Shane Harvey
c0f463f6d3
PYTHON-3991 Fix MockupDB tests when run through tox (#1388) 2023-10-12 12:06:27 -07:00
Steven Silvester
6ffae5522c
BUILD-17329 Updated ECS Task (#1387) 2023-10-11 12:25:10 -05:00
Steven Silvester
ed3ae41407
PYTHON-3983 Clean up handling of PYTHON_BINARY (#1382) 2023-10-06 19:11:52 -05:00
Jib
556557255a
PYTHON-3598 Add Command(Succeeded|Failed)Event.database_name property (#1368) 2023-10-06 10:45:41 -04:00
Jib
cbd61c5236
PYTHON-3951: [Temporary] Skip list search index Unified Tests (#1385) 2023-10-05 21:51:42 -04:00
Steven Silvester
8de5c5932d
PYTHON-3987 Pin coverage for now (#1384) 2023-10-04 14:58:04 -05:00
Steven Silvester
42d87e2c9c
PYTHON-3985 [Build Failure] TestCollectionChangeStream.test_split_large_change (#1383) 2023-10-03 12:29:04 -05:00
Steven Silvester
8029c180eb
PYTHON-3942 Use MongoDB managed Azure KMS credentials (#1381) 2023-10-02 16:52:44 -05:00
Steven Silvester
0590ce49ca
PYTHON-3716 OIDC-SASL Follow-Up (#1365) 2023-09-28 12:48:36 -05:00
Steven Silvester
9b6f2e18cf
PYTHON-3698 Support mypy 1.2 --strict testing (part 1) (#1371) 2023-09-20 14:29:17 -05:00
Noah Stapp
611303ac00
PYTHON-3916 Deprecate Deprecated GridFS Fields, remove in 5.0 (#1379) 2023-09-19 10:41:24 -07:00
Noah Stapp
db4406b951
PYTHON-3848 Test $changeStreamSplitLargeEvent on MongoDB 6.0.9+ (#1377) 2023-09-18 11:11:10 -07:00
Noah Stapp
bd4e09521d
PYTHON-3890 Data Lake Tests Were Failing Silently (#1376) 2023-09-18 11:05:50 -07:00
Steven Silvester
db526f7d36
PYTHON-3716 Move OIDC test file (#1378) 2023-09-15 22:00:44 -05:00
Steven Silvester
87d6a54f77
PYTHON-3929 Add check-manifest support (#1366) 2023-09-15 17:54:03 -05:00
Noah Stapp
14640256cb
PYTHON-3940 Pytest Config Improvements (#1373) 2023-09-13 11:31:43 -07:00
Jib
ee9cf10976
PYTHON-3922: Contributor PR Template (#1358)
* Added Basic PR Template

* Update .github/workflows/pull_request_template.md

* changed the CONTRIBUTING.rst

* added some bold spaces and sleek linking

* slight rearrangement of Template Breakdown section

* changed template breakdown to sub-bullets

* addressed PR resolutions

* Update CONTRIBUTING.rst

Co-authored-by: Steven Silvester <steven.silvester@ieee.org>

* Apply suggestions from code review

Co-authored-by: Steven Silvester <steven.silvester@ieee.org>

* added blurb to include accompanying JIRA ticket

* added some more punctuation

---------

Co-authored-by: Steven Silvester <steven.silvester@ieee.org>
2023-09-13 12:34:29 -04:00
Jib
6787187f70
PYTHON-1744: Clean-Up, remove setdefault on multi/upsert calls (#1369) 2023-09-13 12:33:33 -04:00
Steven Silvester
6f4e617e6d
PYTHON-3905 Use from __future__ import annotations in all files (#1370)
* PYTHON-3905 Use from __future__ import annotations in all files

* cleanup

* cleanup

* cleanup
2023-09-11 10:49:24 -05:00
Noah Stapp
b67ca68cc5
PYTHON-3920 - Migrate AWS Auth Tests to use AWS Secrets (#1367) 2023-09-05 12:25:22 -07:00
Steven Silvester
f2867a9abf
PYTHON-3933 Clean up EVG output (#1364) 2023-08-29 15:40:15 -05:00
Steven Silvester
83ab612aa1
PYTHON-3932 Support mypy --strict testing in bson package (#1362) 2023-08-29 13:49:11 -05:00
Jib
3e1a4ab56e
PYTHON-3739 Refactor retryable reads and writes logic to avoid duplication (#1344)
* first draft commit; consolidated _retryable_(read|write) to call _retry_internal

* removed extra self usage

* formatting

* swapped last_error usage

* switched to using more objective syntax

* black formatter

* don't use conn_from_server

* changed variable naming is_write -> is_read; consolidated errorhandling; revisited is_retrying

* added an explicit if not self._is_read catch

* switched self._in_transaction to be self._not_in_transaction

* fixed logic on checking if a read/write was in transaction and added commentary

* fixed encryption-based error getting retried

* separated server selection as the exception raised gets handled differently in each caller

* do not mutate 'retryable' within the class instantiation

* centralized usage of _retryable_write to avoid _retry_with_session used outwardly

* added docstrings to our _retryable_(read|write) operations

* refactored docstrings to align with rest of the file

* clearer docstrings and function calls
2023-08-29 10:13:38 -04:00
Steven Silvester
52112a2220
PYTHON-3935 Use Ubuntu 22 for mod_wsgi tests (#1363) 2023-08-25 16:09:18 -05:00
Jib
c9f8829749
PYTHON-3855: Appends suggestion Use CodecOptions into errorhandler for datetime conversions (#1349)
* first commit, appends suggestion into errorhandler

* catch only ArithmeticErrors, scoped try clause, and using raise _ from

* fixed unused import

* formatting

* stepped through each logical call to ensure functional parity; added refactoring suggestions

* Revert "stepped through each logical call to ensure functional parity; added refactoring suggestions"

This reverts commit 77e99c97d6.
I took PYTHON-3739 and accidentally super-imposed it onto this one. Reverting to fix

* place the msg check in the excxeption handle

* cleaned up some code callsites. applied refactor changes. made a more generic error checking test

* edited code comment

* Update test/test_bson.py

rename just to retrigger test suite

* DECREF -> XDECREF and formatting
2023-08-23 11:34:07 -04:00
Shane Harvey
3ce9ac7ecb Fix pre-commit on version_tuple string 2023-08-22 13:09:37 -07:00
Steven Silvester
608a0dcf8f BUMP 4.6.0.dev0 2023-08-22 06:24:31 -05:00
Steven Silvester
3353b11cf2
PYTHON-3914 Release 4.5.0 (#1359) 2023-08-22 06:22:18 -05:00
Noah Stapp
aaff6edd8b
PYTHON-3912 Migrate Enterprise Auth Tests to AWS Secrets Vault (#1356) 2023-08-18 09:56:43 -07:00
Steven Silvester
5bd444a604
PYTHON-3917 Fix handling of warnings in connection string tests (#1357) 2023-08-17 19:10:15 -05:00
Noah Stapp
42c0841700
PYTHON-3906 Use AWS Secrets for Atlas tests (#1342) 2023-08-15 13:05:24 -05:00
Shane Harvey
02de1ba00e
PYTHON-3909 Fix OIDC reauth for bulk write operations, remove unneeded AUTH_MECH (#1353)
Co-authored-by: Steven Silvester <steven.silvester@ieee.org>
2023-08-14 17:41:24 -07:00
Steven Silvester
43845c36b2
PYTHON-3877 Test Python 3.12 on MacOS and build wheel (#1355) 2023-08-14 11:36:20 -05:00
Steven Silvester
28b11219ed
PYTHON-3461 Test FaaS (AWS Lambda) Behavior Per Driver (#1310) 2023-08-11 12:58:14 -05:00
Iris
0d44783edd
PYTHON-3821 use overload pattern for _DocumentType (#1352) 2023-08-10 16:46:41 -07:00
Iris
c1d33831e8
PYTHON-3907 add --disallow-untyped-defs for mypy (#1351) 2023-08-10 11:08:36 -07:00
Steven Silvester
f7738b8665
PYTHON-3887 Remove custom test command in setup.py (#1350) 2023-08-09 20:11:38 -05:00
Iris
34da931b3a
PYTHON-3867 add types to topology.py (#1346) 2023-08-09 14:21:43 -07:00
Steven Silvester
5d6d8ca68e
PYTHON-3885 Use tox in remaining Evergreen Tests (#1347) 2023-08-09 14:13:59 -05:00
Steven Silvester
1f1e5bd3c9
PYTHON-3715 Migrate off of Arch Linux for EG Testing (#1348) 2023-08-09 12:53:01 -05:00
Shane Harvey
d203f68977
PYTHON-3904 Fix socket vs _socket pyopenssl typing (#1345) 2023-08-08 11:21:01 -07:00
Steven Silvester
0660f32e76
PYTHON-3761 Add e2e testing against Atlas to the search index management API (#1337) 2023-08-08 08:08:35 -05:00
Steven Silvester
b8c1364368
PYTHON-3884 Replace uses of run-test.sh with tox (#1333) 2023-08-07 12:47:57 -05:00
Iris
e0b8b36f41
PYTHON-3813 add types to pool.py (#1318) 2023-08-04 17:28:30 -07:00
Iris
54840752d2
PYTHON-3866 add types to topology_description.py (#1339) 2023-08-03 16:08:44 -07:00
Steven Silvester
359e924719
PYTHON-3896 Drop support for pypy3.7 (#1343) 2023-08-03 17:58:37 -05:00
Iris
94fd83e92e
PYTHON-3814 add types to pyopenssl_context.py (#1341) 2023-08-03 15:40:58 -07:00
Iris
dc63c5d9b8
PYTHON-3863 add types to server_selectors.py (#1340) 2023-08-03 14:53:32 -07:00
Iris
255ef770f1
PYTHON-3869 add types to uri_parser.py (#1338) 2023-08-03 13:23:30 -07:00
Iris
02a365276c
PYTHON-3806 add types to message.py (#1312) 2023-08-02 20:11:25 -07:00
Iris
43046e04c0
add bson encoding performance to 4.5 changelog (#1336) 2023-08-02 16:38:27 -07:00
Noah Stapp
240a748fb2
PYTHON-3893 Add BSON Binary Data subtype Sensitive (#1335) 2023-08-02 13:07:44 -07:00
Iris
dc59eb86c7
PYTHON-3809 add types to monitoring.py (#1332) 2023-08-02 12:09:06 -07:00
Iris
b7796e1794
PYTHON-3807 add types to mongo_client.py (#1315) 2023-08-01 16:49:33 -07:00
Iris
883d57f7ce
PYTHON-3808 add types to monitor.py (#1328) 2023-08-01 09:41:07 -07:00
Noah Stapp
c88ae79e58
PYTHON-3879 Rename SocketInfo to Connection (#1329) 2023-07-28 10:04:16 -07:00
Steven Silvester
c945ec6302
PYTHON-3889 Implement Load Balancing for GitHub PR Reviews (#1331) 2023-07-27 19:53:19 -05:00
Steven Silvester
fbecc75b37
PYTHON-3844 Enable Pytest XML Reporting in Tox (#1330) 2023-07-27 11:22:51 -05:00
Shane Harvey
eed4a55184
PYTHON-694 Test mod_wsgi sub interpreters (#1327)
Test mod_wsgi sub interpreters and embedded mode.
Use unique collection name for each mod_wsgi interpreter.
Test encoding/decoding all bson types.
2023-07-26 18:03:29 -07:00
Iris
c259dde1de
PYTHON-3860 add types to read_preferences.py (#1320) 2023-07-25 14:25:25 -07:00
Iris
b90765dbbd
PYTHON-3865 add types to ssl_support.py (#1326) 2023-07-24 18:27:39 -07:00
Iris
f8b79a122b
PYTHON-3861 add types to results.py (#1321) 2023-07-24 16:07:46 -07:00
Iris
43d3fa6774
PYTHON-3868 add types to typings.py (#1324) 2023-07-24 16:07:12 -07:00
Iris
e4f1a35fd8
PYTHON-3864 add types to socket_checker.py (#1323) 2023-07-24 16:06:18 -07:00
Iris
efcbfbef8c
PYTHON-3870 add types to write_concern.py (#1325) 2023-07-24 16:05:03 -07:00
Iris
adbb578b9d
PYTHON-3862 add types to server_description.py (#1322) 2023-07-24 16:03:13 -07:00
Iris
1adbc27b6f
PYTHON-3812 add types to periodic_executor.py (#1316) 2023-07-24 13:45:14 -07:00
Iris
007e3d7a42
PYTHON-3859 add types to read_concern.py (#1319) 2023-07-24 13:43:47 -07:00
Noah Stapp
8573ee2f9d
PYTHON-3681 Build wheels for Python 3.12 beta (#1304) 2023-07-20 10:47:29 -07:00
Iris
4d42931823
PYTHON-3820 Optimize PyObject_CallMethod calls (#1314) 2023-07-19 09:03:45 -07:00
Iris
e23eb7691e
PYTHON-3811 add types to operations.py (#1313) 2023-07-18 14:28:57 -07:00
Shane Harvey
70da43ffe8
PYTHON-3846 Faster int encoding (#1311) 2023-07-17 14:40:27 -04:00
Shane Harvey
a59bcb6eee
Add changelog for 4.4.1 (#1305) 2023-07-17 13:00:51 -04:00
Shane Harvey
469e2e95f5
PYTHON-3511 Cleanup some more Python 2 references (#1309) 2023-07-14 17:02:24 -04:00
Soroush Mahdavi
c6a6ea6066
PYTHON-3511 Remove Python 2 references from the docs (#1161)
Co-authored-by: Nicky Lee <40870742+iceypotato@users.noreply.github.com>
Co-authored-by: DanielZavala11 <89770626+DanielZavala11@users.noreply.github.com>
Co-authored-by: Shane Harvey <shane.harvey@mongodb.com>
2023-07-14 15:30:14 -04:00
Iris
992df04da6
PYTHON-3831 remove _DocumentIn (#1308) 2023-07-14 11:12:58 -07:00
Noah Stapp
62a4d12239
PYTHON-3829 Certificate typecast in encryption breaking build (#1306) 2023-07-14 10:28:52 -07:00
Steven Silvester
1a249386cf
PYTHON-3723 Add search index management helpers (#1224) 2023-07-14 09:51:19 -05:00
Iris
3f9e722e01
PYTHON-3824 Optimize BSON encoding of standard Python list and tuples (#1302) 2023-07-13 14:29:00 -07:00
Noah Stapp
72e9180558
PYTHON-3795 Simplify db.cursor_command api arguments (#1307) 2023-07-13 13:48:50 -07:00
Iris
c33b9d6b4d
PYTHON-3780 add types to cursor.py (#1290) 2023-07-13 12:40:30 -07:00
Iris
dbb196fdfc
PYTHON-3810 add types to network.py (#1303) 2023-07-13 11:29:33 -07:00
Iris
7bcbb0de9b
PYTHON-3802 add types to database.py (#1295) 2023-07-12 10:48:33 -07:00
Noah Stapp
f81cda0e22
PYTHON-3774 Update Evergreen run-atlas-tests to use tox + pytest (#1270) 2023-07-12 09:41:31 -07:00
Iris
9a4911fca6
PYTHON-3817 Optimize BSON encoding of standard Python dict (#1301) 2023-07-11 12:32:56 -07:00
Iris
f813f56362
PYTHON-3803 add types to encryption.py (#1296) 2023-07-11 08:24:15 -07:00
Shane Harvey
fd760c2b66
PYTHON-3818 Create unique key vault index in auto QE example (#1300) 2023-07-10 15:10:35 -04:00
Noah Stapp
2d2126bd7d
PYTHON-3790 Standardize Evergreen tox setup (#1280) 2023-07-10 11:28:30 -07:00
Iris
58f04dc3d6
PYTHON-3804 add types to errors.py (#1297) 2023-07-07 22:07:41 -07:00
Iris
07653f3ab1
PYTHON-3805 add types to hello.py (#1298) 2023-07-07 21:44:35 -07:00
Iris
5a8f422b9f
PYTHON-3816 use Use PyObject_GetItem instead of PyMapping_GetItemString (#1294) 2023-07-07 12:27:35 -07:00
Shane Harvey
1d7f2ea1c8
PYTHON-3800 Add test for SRV URI with uppercase hostname (#1293) 2023-07-07 10:15:52 -04:00
Iris
7e96249212
PYTHON-3797 cache commonly used strings (#1292) 2023-07-06 08:26:21 -07:00
Iris
919d7f3585
PYTHON-3779 add types to compression_support.py (#1288) 2023-07-06 08:17:05 -07:00
qkrwjdan
7d7118bde4
PYTHON-3800 Add lower() to node when validate hosts of srv records (#1289) 2023-07-05 11:40:20 -05:00
Iris
966a5adc4a
PYTHON-3778 add types to common.py (#1287) 2023-07-05 08:57:42 -07:00
Iris
c8133cdbe3
PYTHON-3776 add types to collection.py (#1283) 2023-07-03 16:08:27 -07:00
Iris
fd095955f5
PYTHON-3777 add types to command_cursor.py (#1285) 2023-07-03 15:16:33 -07:00
Noah Stapp
94fabf5e98
PYTHON-3793 Make tox fail with invalid environment (#1286) 2023-07-03 12:17:11 -04:00
Iris
0b5bdccf3a
PYTHON-3729 use PyObject_GetAddr instead of PyObject_GetAddrString (#1281) 2023-07-03 09:15:04 -07:00
Steven Silvester
a3940ac278
PYTHON-3759 Update to Newer Build Hosts (#1257) 2023-07-03 05:24:25 -05:00
Shane Harvey
46276439ac
PYTHON-3796 Fix typo in docs and reformat using blacken-docs (#1284) 2023-06-30 17:02:36 -04:00
Iris
e56c08afcc
PYTHON-3770 add types to auth_oidc.py (#1265) 2023-06-28 15:25:46 -07:00
Noah Stapp
cae124c32c
PYTHON-3588 Expose an API to create a cursor from a command response (#1263) 2023-06-28 14:19:04 -07:00
Iris
820823891d
PYTHON-3773 add types to client_session.py (#1268) 2023-06-28 11:54:23 -07:00
Iris
0c727bba85
PYTHON-3791 Fix access to last_write_date (#1279) 2023-06-28 11:53:43 -07:00
Noah Stapp
d5882075d6
PYTHON-3789 Use tox for Evergreen mockupdb tests (#1277) 2023-06-28 10:57:23 -07:00
Iris
01dd2f8ce0
PYTHON-3786 add types to srv_resolver.py (#1275) 2023-06-28 10:49:04 -07:00
Iris
2a75a18198
PYTHON-3788 add types to server_selectors.py (#1278) 2023-06-28 10:48:04 -07:00
Iris
2c563f128d
PYTHON-3785 add types to response.py (#1274) 2023-06-28 10:47:17 -07:00
Iris
ebba342aaa
PYTHON-3787 add types to max_staleness_selectors.py (#1276) 2023-06-28 09:48:57 -07:00
Iris
7d19205540
PYTHON-3782 add types to lock.py (#1271) 2023-06-28 09:29:32 -07:00
Iris
91711ee366
PYTHON-3783 add types to compression_support.py (#1272) 2023-06-28 09:28:46 -07:00
Iris
12cbeb86ec
PYTHON-3784 add types to daemon.py (#1273) 2023-06-28 09:27:57 -07:00
Iris
ba7be3c1bb
PYTHON-3781 fix type for server_selector (#1269) 2023-06-28 09:24:17 -07:00
Iris
de61d1ac8f
PYTHON-3752 add types to bulk.py (#1250) 2023-06-27 13:17:47 -07:00
Iris
5c3cfa7848
PYTHON-3764 add types to settings.py (#1259) 2023-06-27 13:16:20 -07:00
Iris
386f6d8b7f
PYTHON-3765 add types to server_api.py (#1260) 2023-06-27 13:15:58 -07:00
Iris
70666a65cc
PYTHON-3766 add types to ocsp_cache.py (#1261) 2023-06-27 13:15:38 -07:00
Iris
1f7cf0941d
PYTHON-3772 add types to change_stream.py (#1267) 2023-06-27 13:13:58 -07:00
Iris
5397d74668
PYTHON-3767 add types to ocsp_support.py (#1262) 2023-06-27 13:13:25 -07:00
Iris
1e14e89d0e
PYTHON-3769 add types to auth_aws.py (#1264) 2023-06-27 13:13:07 -07:00
Iris
940404ad3f
PYTHON-3771 add types to client_options.py (#1266) 2023-06-27 13:08:42 -07:00
Iris
3d2a650cbe
PYTHON-3755 add types to aggregation.py (#1254) 2023-06-27 12:32:05 -07:00
stephan-hof
8b23204408
PYTHON-3758 Support overflow integers in fallback_encoder. (#1243)
bson only supports 64-bit integer within range:
[-9_223_372_036_854_775_807, +9_223_372_036_854_775_807]

This change calls the fallback_encoder before raising OverflowError on
integers outside of this range.
2023-06-26 15:20:01 -04:00
Iris
eb8013ce02
PYTHON-3740 add types to helpers.py (#1246) 2023-06-22 14:21:04 -07:00
Iris
a750098057
PYTHON-3750 add types to server.py (#1248) 2023-06-22 14:20:33 -07:00
Steven Silvester
2a4dc9cb0c
PYTHON-3760 Add C extension building as part of tox test environment (#1255) 2023-06-22 16:18:55 -05:00
Shane Harvey
424e6c46fa
PYTHON-3762 Remove global code owners (#1256) 2023-06-22 14:10:27 -07:00
Steven Silvester
e78a91ef28
PYTHON-2965 Migrate to a PEP517 compliant build system (#1252) 2023-06-22 13:00:55 -05:00
Noah Stapp
df07641687
PYTHON-2523 Remove unneeded bson-stdint-win32.h (#1253) 2023-06-21 16:25:58 -07:00
Noah Stapp
b16e06acfd
PYTHON-3727 Use tox for unit tests and switch to pytest (#1249) 2023-06-21 15:07:14 -07:00
Shane Harvey
bafb73cb8c BUMP 4.5.0.dev0 2023-06-21 11:16:45 -07:00
Shane Harvey
55a9bee810
BUMP 4.4 (#1251) 2023-06-20 23:20:39 -07:00
Noah Stapp
bc66d83efc
PYTHON-3738 Use tox for sphinx doc instead of setup.py (#1245) 2023-06-20 09:13:23 -07:00
Noah Stapp
82d87dc173
PYTHON-3744 Fix utcnow deprecation build regressions (#1244) 2023-06-16 13:30:54 -07:00
Noah Stapp
374250d549
PYTHON-2963 Add tox config in preparation for migration from setup.py (#1240) 2023-06-16 13:05:18 -07:00
Steven Silvester
37202c0db1
PYTHON-3726 Migrate off of Ubuntu in EG Builds (#1227) 2023-06-16 14:31:26 -05:00
Noah Stapp
601d1ec3a1
PYTHON-3737 Use __future__ annotations for forward reference type hints (#1234) 2023-06-15 12:54:29 -07:00
Shane Harvey
2cfebf52cd
PYTHON-3706 Skip flaky test on Windows/macOS (#1241) 2023-06-15 12:34:02 -07:00
Steven Silvester
ada1280ad3
PYTHON-3011 Skip test_connections_are_only_returned_once on PyPy for now (#1239) 2023-06-15 14:08:13 -05:00
Steven Silvester
d86fb9496a
PYTHON-3519 Skip test_pool_paused_error_is_retryable on PyPy for now (#1238) 2023-06-15 14:07:48 -05:00
Iris
f7874fb110
PYTHON-2287 Improve error message for invalid boolean option (#1236) 2023-06-15 11:54:20 -07:00
Noah Stapp
bcfdd200c3
PYTHON-3702 bson datetime utc import cleanup (#1233) 2023-06-15 08:57:50 -07:00
Noah Stapp
e27e710184
PYTHON-3736 Add Noah to code owners for PyMongo, Motor, and PyMongoArrow (#1237) 2023-06-15 08:57:18 -07:00
Noah Stapp
6a04fe2c91
PYTHON-3702 Stop using utcnow and utcfromtimestamp changelog update (#1235) 2023-06-14 16:11:26 -07:00
Noah Stapp
1269c006da
PYTHON-3735 Add types to PyMongo auth module (#1231) 2023-06-14 11:27:58 -07:00
Shane Harvey
ece45b1edf
PYTHON-3699 Add prose test for change stream splitting (#1232) 2023-06-14 10:00:52 -07:00
Steven Silvester
eed9d02a2e
PYTHON-3731 Disable MONGODB-OIDC Auth for 4.4 (#1230) 2023-06-13 11:30:50 -05:00
Noah Stapp
ec3437849e
PYTHON-3702 Stop using utcnow and utcfromtimestamp (#1229) 2023-06-12 15:43:30 -07:00
Shane Harvey
3f687f71fb
PYTHON-3443 Remove redundant code to avoid Coverity warnings (#1228) 2023-06-12 12:41:59 -07:00
Shane Harvey
0bce579b81
PYTHON-3728 Simplify convert_codec_options signature (#1225) 2023-06-09 13:08:56 -07:00
Noah Stapp
7146be01ae
PYTHON-3721 Stop Testing on AWS Linux 2018 (#1226) 2023-06-09 12:00:14 -07:00
Shane Harvey
1ad0df0858
PYTHON-3724 Remove null values from command_started_event in fle2v2-CreateCollection.yml (#1223) 2023-06-06 12:06:08 -07:00
Dainis Gorbunovs
c7e06e6fc1
PYTHON-3725 Fix Test Failure - MockupDB test_network_disconnect_primary (#1222) 2023-06-05 16:38:28 -07:00
thalassemia
1ba4c0bcbd
PYTHON-3718 Faster INT2STRING (#1221) 2023-06-05 18:35:39 -05:00
Steven Silvester
5831934b37
PYTHON-3691 [Build Failure] test_client.TestClient.test_exhaust_network_error (#1216) 2023-06-05 12:03:51 -05:00
Steven Silvester
2fe01929e9
BUILD-17302 AWS EC2 credential retrieval 404s in Drivers CI (#1218) 2023-05-31 18:48:34 -05:00
Steven Silvester
3bc853a620
PYTHON-3692 [Build Failure] Container Test failed MONGODB-AWS on MongoDB 5.0 (#1220) 2023-05-31 18:48:05 -05:00
thalassemia
4c0196d340
PYTHON-3717 Speed up _type_marker check in BSON (#1219) 2023-05-26 09:40:32 -05:00
Steven Silvester
bda9e3a0bb
PYTHON-3469 Error if RewrapManyDataKey is called with masterKey and without provider (#1214) 2023-05-15 06:36:36 -05:00
Steven Silvester
2a869b56ca
PYTHON-3613 Improving Time-Series Scalability (#1213) 2023-05-12 16:58:10 -05:00
Steven Silvester
738048bf4e
PYTHON-3646 Update readme for PyMongo driver (#1212) 2023-05-12 16:29:24 -05:00
Steven Silvester
622df873ae
PYTHON-3696 Bump minimum pymongocrypt version req to >=1.6 for QEv2 (#1211) 2023-05-12 16:05:23 -05:00
Shane Harvey
0123d32a20
PYTHON-3709 Remove "beta" from Queryable Encryption Equality API (#1210) 2023-05-12 12:17:40 -07:00
Shane Harvey
bc1a513d10 PYTHON-2504 Add pyupgrade/ruff commit to git-blame ignore 2023-05-11 15:29:43 -07:00
Shane Harvey
0092b0af79
PYTHON-2504 Run pyupgrade 3.4.0 and ruff 0.0.265 (#1196)
pyupgrade --py37-plus bson/*.py pymongo/*.py gridfs/*.py test/*.py tools/*.py test/*/*.py
ruff --fix-only --select ALL --fixable ALL --target-version py37 --line-length=100 --unfixable COM812,D400,D415,ERA001,RUF100,SIM108,D211,D212,SIM105,SIM,PT,ANN204,EM bson/*.py pymongo/*.py gridfs/*.py test/*.py test/*/*.py
2023-05-11 15:27:17 -07:00
Steven Silvester
afd7e1c2cd
PYTHON-3460 Implement OIDC SASL mechanism (#1138) 2023-05-11 14:35:30 -05:00
Shane Harvey
d504322a74
PYTHON-3694 Test with MongoDB 7.0 (#1207) 2023-05-09 23:19:44 -07:00
Steven Silvester
2752a7dd30
PYTHON-3456 CSFLE/QE Naming (#1208) 2023-05-09 20:19:57 -05:00
Steven Silvester
873032660b
PYTHON-3708 Fix ReadTheDocs Build Failure (#1206) 2023-05-08 12:33:28 -05:00
Steven Silvester
ae83a0b8be
PYTHON-3570 Deprecate currentOp/collStats commands by 7.0 (#1205) 2023-05-08 11:49:05 -05:00
Shane Harvey
3d3e4dc238
PYTHON-3464 Add FaaS platform to handshake metadata (#1204)
Truncate metadata env, os, and platform fields if needed.
2023-05-04 18:24:14 -07:00
Jean-Christophe Fillion-Robin
d340710e3d
PYTHON-3703 Fix typos and add codespell pre-commit hook (#1203)
Update pre-commit config adding "codespell" hook
2023-05-03 14:47:24 -07:00
Shane Harvey
14e8b011c2
PYTHON-3700 Clean up docs for create_index/drop_indexes (#1201) 2023-05-02 13:45:55 -07:00
Shane Harvey
eb137fdf5c PYTHON-3686 codec_options is no longer shadowed 2023-05-02 12:53:16 -07:00
Steven Silvester
3f1e960c4b
PYTHON-3690 Do not install unittest-xml-reporting on MacOS EG Hosts (#1200) 2023-05-01 12:24:18 -05:00
Shane Harvey
deb0566c3e
PYTHON-3614 Support Queryable Encryption protocol v2 on 7.0+ (#1197)
Resync FLE spec tests and update docs for new QE protocol on 7.0.
Add client side error for createEncryptedCollection on MongoDB < 7.0.
KMS timeout errors should always have exc.timeout==True.
PYTHON-3583 Drivers should not create the ECC collection in v2 of queryable encryption.
2023-05-01 09:16:28 -07:00
Shane Harvey
bc9029a228
PYTHON-3679 Support mypy 1.2 (#1194) 2023-04-28 14:27:06 -07:00
Steven Silvester
e75cfec34f
PYTHON-3686 Consolidate CodecOptions Typings (#1199) 2023-04-28 16:11:27 -05:00
Steven Silvester
dfd82d2375
PYTHON-3677 Update docs on Range Index (#1195) 2023-04-25 17:28:10 -05:00
Shane Harvey
79488d95db
PYTHON-3678 Username/password needs to be escaped with quote_plus to account for '/' (#1193) 2023-04-25 11:30:23 -07:00
Shane Harvey
2cc8fb1f2e
PYTHON-3672 Increase server selection timeout in more tests (#1192) 2023-04-14 15:35:20 -07:00
Shane Harvey
c5652336ef
PYTHON-3671 Use default server selection timeout in test setup (#1191) 2023-04-14 14:45:57 -07:00
Steven Silvester
be355e2bea
PYTHON-3604 Remove Duplicate API Docs (#1190) 2023-04-13 10:30:54 -05:00
Steven Silvester
b38a416836
PYTHON-3162 Deprecate ServerDescription.election_tuple (#1189) 2023-04-12 11:10:28 -05:00
Steven Silvester
f7225fda55
PYTHON-3652 Bump maxWireVersion for MongoDB 7.0 (#1188) 2023-04-12 10:40:44 -05:00
Steven Silvester
9256cb20af
PYTHON-3649 Use RHEL8 for PyOpenSSL Builds (#1187) 2023-04-11 12:49:34 -05:00
Steven Silvester
1010ea62f5
PYTHON-3649 Switch to Supported Build Hosts (#1184) 2023-04-10 16:41:30 -05:00
Kevin Albertson
6088b53152
PYTHON-3658 Reload expansions before deleting Azure resources (#1185) 2023-04-10 14:24:44 -07:00
Michael Pacheco
3077bbf1f9
PYTHON-3657 Allow index name explicitly set to None (#1182)
Co-authored-by: Michael Pacheco <michael.dias@luizalabs.com>
2023-04-07 11:09:50 -07:00
Shane Harvey
acc6605ea1
PYTHON-3522 Increase test timeout for Windows (#1181)
Temporarily skip CSOT GridFS tests on Windows.
2023-04-05 11:24:27 -07:00
Julius Park
d8897fce3e
PYTHON-3066 Test against Apple silicon in Evergreen (#1180) 2023-04-05 08:45:27 -07:00
lilinjie
30ebc1d090
fix typo (#1179) 2023-04-04 06:46:14 -05:00
Steven Silvester
148f7877cf
PYTHON-3644 Test encryption KMS connections with stdlib ssl, not just pyopenssl (#1178) 2023-04-03 17:13:23 -05:00
Julius Park
9bc7093355
PYTHON-3634 Windows crypt shared rewrap many data key timing out sometimes (#1173) 2023-04-03 13:45:54 -07:00
Shane Harvey
e85a84e3f4
PYTHON-3643 Use mongodb+srv in MONGODB-AWS auth examples (#1177) 2023-03-31 13:58:47 -07:00
Julius Park
9d65395d7f
PYTHON-3567 Add guidance for setting uuidRepresentation in 4.0 migration guide (#1176) 2023-03-28 14:51:08 -07:00
Steven Silvester
cbad35ec9d
PYTHON-3619 MacOS hosts are incredibly slow (#1175) 2023-03-27 18:32:34 -05:00
Steven Silvester
1d052cb706
PYTHON-3639 Release Build is Failing to Create Universal Wheels for MacOS (#1174) 2023-03-27 11:31:51 -05:00
Julius Park
880f3dd8ea
PYTHON-3615 Add docs example for how to rotate CMKs using rewrap_many_data_key (#1171) 2023-03-21 16:59:35 -07:00
Julius Park
04c9f87d70
PYTHON-2468 Add pymongoexplain example to pymongo docs (#1172) 2023-03-20 15:54:42 -07:00
Steven Silvester
e9a6482c4d
PYTHON-3610 Add blacken-docs to pre-commit hook (#1170) 2023-03-14 15:37:45 -05:00
Julius Park
25ba21770c
PYTHON-3624 Update fle2-* tests to match name requirements in SERVER-74069 (#1169) 2023-03-13 14:57:46 -07:00
Shane Harvey
5e203bea8d
PYTHON-3629 Actually install pymongo for Atlas connect tests (#1168) 2023-03-07 10:55:20 -08:00
Julius Park
10a55001c8
PYTHON-3626 Document srvMaxHosts in MongoClient options (#1167) 2023-03-02 14:14:47 -08:00
Steven Silvester
c27ce70d1c
PYTHON-3620 Ensure unittest-xml-reporting is Installed in Evergreen Tasks (#1165) 2023-03-01 19:02:24 -06:00
Steven Silvester
67023b3835
PYTHON-3622 Improve Server Log Download in Evergreen (#1166) 2023-03-01 15:46:19 -06:00
Steven Silvester
7155351599
PYTHON-3618 Perf tests are failing on the centos6-perf boxes due to mongosh download (#1164) 2023-02-23 15:00:57 -06:00
Shane Harvey
32faa261b6
PYTHON-3616 Use minimum RTT for CSOT maxTimeMS calculation (#1163)
Require at least 2 RTT samples, otherwise use 0 as RTT. Only keep last 10 samples.
2023-02-23 11:09:11 -08:00
Julius Park
715dd34810
PYTHON-2754 Add Spec Tests For DB Names With Commas (#1162) 2023-02-23 10:20:17 -08:00
Steven Silvester
6e2e70ab80
PYTHON-3381 Improve readability of sphinx docs (#1156) 2023-02-17 08:31:57 -06:00
Steven Silvester
1f80805251
PYTHON-3607 FAIL: test_01_aws (test.test_encryption.TestKmsTLSOptions) (#1159) 2023-02-17 08:31:09 -06:00
Shane Harvey
c0dd24e4a7
PYTHON-3609 Stop using deprecated setDaemon api in test suite (#1158) 2023-02-16 15:49:00 -08:00
Julius Park
5b96757b0e
PYTHON-3579 Test Failure - Amazon Linux 2018 fails downloading crypt_shared when it is not even needed (#1157) 2023-02-15 13:03:12 -08:00
Steven Silvester
b63dfbe1e4
PYTHON-3533 Permit tlsDisableOCSPEndpointCheck in KMS TLS options (#1155) 2023-02-15 11:36:42 -06:00
Shane Harvey
1797785f99
PYTHON-3577 Fix test_session_gc on serverless (#1153) 2023-02-14 10:18:55 -08:00
Steven Silvester
6ed6c374f1
PYTHON-3593 Remove bulk api docs page which is blank (#1154) 2023-02-13 16:50:29 -06:00
Julius Park
05845b8038
PYTHON-3562 Type annotation of bson.json_utils.loads is incorrect (only accepts str) (#1152) 2023-02-10 15:28:04 -08:00
Shane Harvey
5635ef9ff0
PYTHON-3599 Fix create_data_key/key_alt_names docs example (#1151) 2023-02-09 11:39:04 -08:00
Julius Park
2e6e9a8507
PYTHON-3592 createEncryptedCollection should raise a specialized exception to report the intermediate encryptedFields (#1148) 2023-02-07 10:23:59 -08:00
Shane Harvey
dcbba962dd
PYTHON-3596 Guarantee a document update in retryable writes tests (#1149) 2023-02-07 07:35:19 -08:00
Julius Park
79ccf4e287
PYTHON-3589 createEncryptedCollection should not accept keyAltNames (#1147) 2023-02-03 21:10:30 -08:00
Shane Harvey
540562a606
PYTHON-3577 Fix test_aggregate_out on 4.0 replica set (#1146) 2023-01-31 15:22:28 -08:00
Julius Park
b492263826
PYTHON-3357 Automatically create Queryable Encryption keys (#1145) 2023-01-31 14:58:37 -08:00
Julius Park
b3099c62de
PYTHON-3558 Missing docs for JSONOptions (#1143) 2023-01-30 12:13:30 -08:00
Shane Harvey
06dd536669 BUMP 4.4.0.dev1 2023-01-27 12:32:18 -08:00
Julius Park
e353d5791b BUMP 4.5.0.dev1 2023-01-25 15:29:54 -08:00
Julius Park
4af7a07618 BUMP 4.5.0.dev0 2023-01-25 14:13:17 -08:00
Julius Park
0b843b76f6
BUMP 4.4.0b0 (#1144) 2023-01-25 14:09:15 -08:00
Steven Silvester
a3720d9cea
PYTHON-3568 Intellisense highlights multiple PyMongo methods because of CodecOptions (#1139) 2023-01-25 09:41:23 -06:00
Julius Park
2b21e7359f
PYTHON-3582 Add specification tests for range indexes (#1142) 2023-01-24 21:40:18 -08:00
Julius Park
d3117ce75d
PYTHON-3280 Support for Range Indexes (#1140) 2023-01-24 15:33:56 -08:00
Shane Harvey
ec074010d8
PYTHON-3523 Resync unified test format tests for getnonce (#1141) 2023-01-24 14:38:48 -08:00
Steven Silvester
124dee66c3
PYTHON-3565 The docs page appears to be missing a component reference (#1137) 2023-01-18 13:39:38 -06:00
Julius Park
57f757b74c
PYTHON-3446 Do not connect to mongocryptd if shared library is loaded (#1136) 2023-01-17 23:14:26 -08:00
Steven Silvester
24170dd523
PYTHON-3523 Remove getNonce command usage for 6.2+ (#1135) 2023-01-12 12:08:53 -06:00
Julius Park
a4c90ae157
PYTHON-3466 Test crypt_shared with older server versions (#1133) 2023-01-11 20:03:28 -08:00
Julius Park
eaea70bf08
DRIVERS-2369 Disable causal consistency in implicit sessions (#1132) 2023-01-10 15:49:46 -08:00
Steven Silvester
a43f320753
PYTHON-3470 Build Python 3.11 Wheels for MacOS (#1130) 2023-01-05 13:56:22 -06:00
Steven Silvester
7299dff84d
PYTHON-3546 bson.CodecOptions docs missing unicode_decode_error_handler=ignore option in newer documentation (#1131) 2023-01-05 13:55:47 -06:00
Steven Silvester
47686c8f68
PYTHON-3543 Broken Links for ICU Project (#1129) 2022-12-20 16:29:43 -06:00
Steven Silvester
f5d09e1c97
PYTHON-3542 Test Failure - test_iteration on PyPy 3.8+ (#1128) 2022-12-20 13:39:04 -06:00
Shane Harvey
024148ca2b
PYTHON-3541 Use bash instead of sh in perf testing (#1127) 2022-12-19 14:23:40 -08:00
Julius Park
6419266395
PYTHON-3492 Test mongocryptd is not spawned when shared library is loaded (#1124) 2022-12-06 15:29:48 -08:00
Julius Park
ccade9bc05
PYTHON-3351 Provide access to raw result document when the server returns an error for a command (#1125) 2022-12-02 12:52:01 -08:00
Julius Park
26efc0f43d
PYTHON-3388 Propagate Original Error for Write Errors Labeled NoWritesPerformed (#1117) 2022-12-01 17:54:15 -08:00
Steven Silvester
ee2badff75
PYTHON-3524 Support passing list of strings to create_index (#1121) 2022-11-29 05:27:45 -06:00
Steven Silvester
0c6aacb0fb
PYTHON-3531 Pre-commit failure due to flake8 repository move (#1122) 2022-11-22 13:34:17 -06:00
Steven Silvester
f92dd40c86 BUMP 4.4.0.dev0 2022-11-17 15:00:04 -06:00
Steven Silvester
3d032768a0 BUMP 4.3.3 2022-11-17 14:59:25 -06:00
Shane Harvey
1edbfad0c8
PYTHON-3529 Improve reliability of test_list_databases (#1120) 2022-11-17 12:27:15 -08:00
Shane Harvey
cde9adf6ab
PYTHON-3527 + PYTHON-3528 Fix no-server tests (#1118)
Fix TestCreateEntities when no server is running.
Fix no-server test_typeddict_find_notrequired.
2022-11-17 12:27:00 -08:00
Shane Harvey
b290f7b1a1
PYTHON-3526 Fix mockup tests (#1119) 2022-11-17 12:26:32 -08:00
Shane Harvey
3ab73905dc
PYTHON-3500 Resync retryable tests to fix serverless failures (#1116) 2022-11-15 17:43:34 -08:00
Steven Silvester
363e0b2b2c
PYTHON-2818 Add documentation and changelog (#1115) 2022-11-14 15:13:51 -06:00
Shane Harvey
79aa5e6757
PYTHON-3516 Improve test EventListener api (#1114) 2022-11-14 08:50:08 -08:00
Steven Silvester
d0568042fa
PYTHON-2818 Add native support for AWS IAM Roles for service accounts, EKS in particular (#1032) 2022-11-14 07:41:49 -06:00
Steven Silvester
fcb1151450
PYTHON-3517 Add documentation for on-demand KMS providers (#1113) 2022-11-11 16:23:03 -06:00
Julius Park
92e6150d84
PYTHON-3493 Bulk Write InsertOne Should Be Parameter Of Collection Type (#1106) 2022-11-10 14:19:55 -08:00
Shane Harvey
133c55d8cb
PYTHON-3500 Improve test coverage for retryable handshake errors (#1112) 2022-11-10 13:31:14 -08:00
Julius Park
87b09847a4
PYTHON-3494 Improve Documentation Surrounding Type-Checking "_id" (#1104) 2022-11-10 09:53:19 -08:00
Shane Harvey
0d301f13c5 PYTHON-3295 Improve description of nested timeout() calls 2022-11-08 12:46:52 -08:00
Shane Harvey
c106c08c1d
PYTHON-3295 Add CSOT docs page (#1111) 2022-11-08 11:13:34 -08:00
Steven Silvester
bcb0ac0170
PYTHON-3396 Support the Azure VM-assigned Managed Identity for Automatic KMS Credentials (#1105) 2022-11-08 12:10:44 -06:00
Shane Harvey
1abcd3fc0c
PYTHON-3513 Correctly pin to mypy==0.990 (#1110) 2022-11-07 13:01:56 -08:00
Shane Harvey
da4df79555
PYTHON-3508 Improve the performance of GridOut.readline and GridOut.read (#1109) 2022-11-07 10:37:33 -08:00
Steven Silvester
ff94b0e309
PYTHON-3501 Ensure Auth Environment Variables are Always Dynamic (#1107) 2022-11-04 14:25:36 -05:00
Steven Silvester
a00aabfa0d
PYTHON-3502 GridFSBucket.download_to_stream slow (#1108) 2022-11-04 13:47:32 -05:00
Steven Silvester
04356b0ffd
PYTHON-3498 Error installing virtual environment on zseries hosts (#1101) (#1103) 2022-11-01 17:37:41 -05:00
Julius Park
9083821300
PYTHON-3454 Specifying a generic type for a collection does not correctly enforce type safety when inserting data (#1081) 2022-11-01 14:33:21 -07:00
Steven Silvester
f08776c522
PYTHON-3367 Use zip url for install (#1093) 2022-10-24 14:57:01 -05:00
Steven Silvester
3fc301cd22
PYTHON-3256 Obtain AWS credentials for CSFLE in the same way as for MONGODB-AWS (#1035) 2022-10-24 14:55:58 -05:00
Steven Silvester
228edd21f8
PYTHON-3471 Test Support for Gevent in Python 3.11 (#1091) 2022-10-24 12:10:22 -05:00
Steven Silvester
84fbc1f319
PYTHON-3367 Add support for GCP attached service accounts when using GCP KMS (#1064) 2022-10-21 05:22:39 -05:00
Shane Harvey
45b809e41c
Mention crypt_shared in encryption examples pages and fix formatting (#1088) 2022-10-20 16:07:39 -07:00
Shane Harvey
3d3ffaf6f3
PYTHON-3410 Resync CSOT spec tests to be less flaky (#1087) 2022-10-20 13:06:34 -07:00
Shane Harvey
614e22c46c
PYTHON-3478 Improve test_change_stream_can_resume_after_timeouts (#1083) 2022-10-19 15:14:46 -07:00
Shane Harvey
1d117c1f39 Fix pre-commit for _version.py 2022-10-19 12:09:58 -07:00
Steven Silvester
520b26fba3 BUMP 4.4.0.dev0 2022-10-18 09:50:46 -05:00
Steven Silvester
bed75044e8 BUMP 4.3.2 2022-10-18 09:09:45 -05:00
Steven Silvester
5dec36195a
PYTHON-3474 Improve documentation about credential handling (#1080) 2022-10-17 19:12:41 -05:00
Steven Silvester
942e28170a
PYTHON-1889 Single-source the version tuple/string (#1079) 2022-10-17 14:49:02 -05:00
Steven Silvester
1c9193f226 BUMP 4.3.1 2022-10-17 09:46:25 -05:00
Steven Silvester
3eb316ed30 BUMP 4.3.0 2022-10-13 17:06:55 -05:00
Steven Silvester
f79b90992e
PYTHON-3453 Fix handling of enterprise auth vars (#1076) 2022-10-13 17:01:52 -05:00
Steven Silvester
f3fc409e24
PYTHON-3474 Document changes to AWS Credential Handling (#1077) 2022-10-13 16:44:43 -05:00
Steven Silvester
df77653ccc
PYTHON-3347 Test against Python 3.11 prerelease (#1069) 2022-10-13 06:09:23 -05:00
Julius Park
4e11bdaa3e
PYTHON-3445 Fix documentation for with_options (#1075) 2022-10-12 15:30:37 -07:00
Julius Park
438539eaa2
PYTHON-3445 Improve documentation for with_options (#1074) 2022-10-12 13:59:51 -07:00
Steven Silvester
4a5e0f6655
PYTHON-3313 Cache AWS Credentials Where Possible (#982) 2022-10-12 10:21:06 -05:00
Steven Silvester
775c0203ca
PYTHON-3453 Test failure - Enterprise Auth Windows 64 Python 3.7 (#1072) 2022-10-11 14:16:08 -05:00
Steven Silvester
24a343b830
PYTHON-3468 Test failures in test_srv_polling.TestSrvPolling (#1073) 2022-10-11 14:14:59 -05:00
Shane Harvey
8abeb882b4
PYTHON-3452 Skip SDAM test that relies on retryWrites on MMAPv1 (#1071) 2022-10-10 12:48:42 -07:00
Julius Park
eaf0e6d84f
PYTHON-3445 Improve documentation for custom readPreference tags (#1068) 2022-10-07 12:05:20 -07:00
Shane Harvey
774154e934
PYTHON-3451 Stop passing bytes to getaddrinfo to fix eventlet support (#1066) 2022-10-05 14:34:59 -07:00
Shane Harvey
85f0987e1d PYTHON-3400 Only use new electionId/setVersion logic on 6.0+ 2022-10-05 13:02:15 -07:00
Shane Harvey
64d7d6da8a PYTHON-2970 Prioritize electionId over setVersion for stale primary check (#845) 2022-10-05 13:02:15 -07:00
Shane Harvey
c9ac5a5cf8
PYTHON-3447 Add back empty tls extra to avoid pip warnings (#1065) 2022-09-28 16:00:15 -07:00
Julius Park
c874c96e29
PYTHON-3232 Improved change stream event visibility for C2C Replication (#1062) 2022-09-27 15:31:20 -07:00
Julius Park
2af12e6463
PYTHON-3444 MyPy Errors With Version 0.981 (#1063) 2022-09-26 15:48:48 -07:00
Steven Silvester
449cb8fb0f
PYTHON-2722 Improve performance of find/aggregate_raw_batches (#1047) 2022-09-22 15:14:40 -05:00
Max Zhenzhera
0143881f02
PYTHON-3441 Add missing pool_ready method in monitoring docs example (#1060) 2022-09-19 13:19:14 -07:00
Steven Silvester
eb028d0195
PYTHON-3420 Update ChangeStreamEvent type definition to include clusterTime (#1057) 2022-09-16 13:41:06 -05:00
Julius Park
dcb1327395
PYTHON-3423 Make dnspython a required dependency (#1055) 2022-09-15 13:31:45 -07:00
Shane Harvey
179efda312
PYTHON-3406 Reinstate warning and docs that PyMongo is not fork safe (#1050)
Log child process C-level stacks when fork tests deadlock.
Encode hostname to bytes to avoid getaddrinfo importlib deadlock.
2022-09-13 14:14:53 -07:00
Steven Silvester
b8cb1c1cf0
PYTHON-3413 Skip EC2 test on Windows (#1054) 2022-09-13 15:30:56 -05:00
Steven Silvester
1019c91bf6
PYTHON-3424 PyMongo Universal Wheels Are Improperly Compiled (#1051) 2022-09-12 19:14:50 -05:00
Steven Silvester
e3ff041b47
PYTHON-3433 Failure: test.test_encryption.TestSpec.test_legacy_maxWireVersion_operation_fails_with_maxWireVersion___8 (#1052) 2022-09-09 16:28:15 -05:00
Steven Silvester
78256368c7
PYTHON-3411 Stop testing MongoDB 6.0 on Amazon1 2018 (#1049) 2022-08-29 17:33:00 -05:00
Steven Silvester
0f135a157e
PYTHON-3413 Ensure AWS EC2 Credential Test is Running Properly (#1048) 2022-08-25 20:16:39 -05:00
Shane Harvey
1575e53ef7
PYTHON-3409 Retry flakey CSOT tests twice (#1046) 2022-08-22 16:19:30 -07:00
Julius Park
9ff0ac8a62
PYTHON-3407 macos release failing on Python 3.8 AttributeError: 'Distribution' object has no attribute 'convert_2to3_doctests' (#1044) 2022-08-22 15:05:39 -07:00
Shane Harvey
1e6b4a48d4
PYTHON-3406 Log traceback when fork() test encounters a deadlock (#1045)
Co-authored-by: Ben Warner <ben.warner@mongodb.com>
2022-08-22 14:16:27 -07:00
Shane Harvey
7f19186cac
PYTHON-3406 Refactor fork tests to print traceback on failure (#1042) 2022-08-18 17:06:02 -07:00
Shane Harvey
a0a5c7194d
PYTHON-3405/PYTHON-2531 Fix tests for primary step down (#1041) 2022-08-18 15:38:09 -07:00
Ben Warner
09aeef0f9d
Changelog 4.3 (#1038) 2022-08-18 15:30:45 -07:00
Shane Harvey
cfc99c82f3
PYTHON-3402 Fix TestRewrapWithSeparateClientEncryption (#1040) 2022-08-18 14:01:35 -07:00
Ben Warner
dd3b4b11d2
PYTHON-3403 Skips unit test if eventlent or gevent is imported (#1039) 2022-08-18 12:15:44 -07:00
Ben Warner
4170dc958e
PYTHON-3393 Added fork-safety stress test. (#1036) 2022-08-16 10:40:28 -07:00
Julius Park
6d2e27a1b7
PYTHON-3355 Test with consistent versions of crypt_shared and server (#1033) 2022-08-15 21:18:44 -07:00
Ben Warner
a20ff68d51
PYTHON-3390 Test for encrypted client post-fork (#1037) 2022-08-15 12:07:49 -07:00
Steven Silvester
c0dadcb6ca
PYTHON-3385 Add prose test for RewrapManyDataKey (#1034) 2022-08-12 13:53:07 -05:00
Ben Warner
3204290e93
PYTHON-2484 Added lock sanitization for MongoClient and ObjectId (#985) 2022-08-04 16:58:56 -07:00
Ben Warner
46673c3705
PYTHON-3379 Refactored DatetimeConversionOpts to DatetimeConversion (#1031) 2022-08-04 12:53:57 -07:00
Ben Warner
92a6fa79b6
PYTHON-3376/PYTHON-3378 Update FAQ about OverflowError when decoding out of range datetimes (#1025) 2022-08-03 16:53:50 -07:00
Shane Harvey
13e2715af0
PYTHON-3312 Convert SDAM integration tests to unified (#1028) 2022-08-03 15:34:16 -07:00
Shane Harvey
5b85ad2bcf
PYTHON-3391 Skip unsupported CSOT tests on serverless (#1030) 2022-08-03 13:30:41 -07:00
Shane Harvey
7c19ff7f7a
PYTHON-3389 Close ChangeStream after non-resumable non-timeout errors (#1029) 2022-08-03 12:23:50 -07:00
Ben Warner
fbb8dde826
PYTHON-3375 Added docstrings to DatetimeConversionOpts (#1024)
* Added docstrings

* Fixed detail

* Fixed punctuation and links

Co-authored-by: Ben Warner <ben.warner@mongodb.com>
2022-07-29 15:53:38 -07:00
Shane Harvey
1166bb96cd
PYTHON-3382 Resync csfle tests (#1027) 2022-07-29 15:39:11 -07:00
Ben Warner
3c18c20795
PYTHON-3377 datetime_ms documentation page is empty (#1026)
Co-authored-by: Ben Warner <ben.warner@mongodb.com>
2022-07-29 12:07:04 -07:00
Ben Warner
0c56d56658
PYTHON-3371 Remove DatetimeConversionOpts.__repr__ (#1023)
* Removed __repr__ and adjusted repr string

* Changed to %s

Co-authored-by: Ben Warner <ben.warner@mongodb.com>
2022-07-28 15:55:34 -07:00
Ben Warner
14002a5a0d
PYTHON-1824 Allow encoding/decoding out-of-range datetimes via DatetimeMS and datetime_conversion (#981)
https://jira.mongodb.org/browse/PYTHON-1824

Co-authored-by: Ben Warner <ben.warner@mongodb.com>
2022-07-27 16:53:52 -07:00
Steven Silvester
e96f112d84
PYTHON-3274 Add commandStartedEvent assertions to clustered index spec tests (#1022) 2022-07-27 18:28:23 -05:00
Shane Harvey
864812d400
PYTHON-3366 Support mypy 0.971 and test with latest version (#1021)
PYTHON-3369 Use https://www.gevent.org
2022-07-25 15:25:41 -07:00
Shane Harvey
f5ac946020
PYTHON-3368 Add test that reads are not retried in a transaction (#1020) 2022-07-25 15:19:22 -07:00
Shane Harvey
925537575b
PYTHON-3284 Fix test_snapshot_query by waiting for documents to be committed to the snapshot (#1019) 2022-07-25 14:22:51 -07:00
Shane Harvey
065b02bcb3
PYTHON-3358 Skip obsolete StaleShardVersion test on 6.1.0+ (#1018) 2022-07-21 11:47:02 -07:00
Shane Harvey
c131ad8cc1
Update readme for 6.0 support (#1017) 2022-07-20 13:04:49 -07:00
Shane Harvey
e192c7f85e BUMP 4.2.1.dev0 2022-07-20 08:37:16 -07:00
Shane Harvey
9bc134cf61
BUMP 4.2 (#1016) 2022-07-20 08:33:41 -07:00
Shane Harvey
6172c00dbe
PYTHON-3362 Fix CSOT gridfs test (#1015) 2022-07-19 19:08:54 -07:00
Shane Harvey
4d4fddaf69
PYTHON-3363 Allow change stream to be resumed after a timeout (#1014)
Apply client timeoutMS to ChangeStream iteration.
2022-07-19 18:17:12 -07:00
Shane Harvey
935f926bd9
PYTHON-3362 Ignore wtimeout when timeoutMS or timeout() is configured (#1013)
Apply client timeoutMS to gridfs operations.
2022-07-19 17:46:09 -07:00
Shane Harvey
db3f2dca05
PYTHON-2459 Implement unified GridFS tests (#1012) 2022-07-19 15:01:41 -07:00
Shane Harvey
667046129a
PYTHON-3289 Apply client timeoutMS to every operation (#1011) 2022-07-18 23:22:43 -07:00
Shane Harvey
5c38676d53
PYTHON-3359 Remove Database and Collection timeout override (#1009)
Remove MongoClient.timeout in favor of client.options.timeout.
2022-07-18 19:54:45 -05:00
Shane Harvey
c43486101f
PYTHON-3291 Add PyMongoError.timeout to identify timeout related errors (#1008) 2022-07-18 15:58:20 -05:00
Julius Park
484374eb3f
PYTHON-3298 Add flag to create_collection to skip listCollections pre-check (#1006) 2022-07-18 13:40:16 -07:00
Shane Harvey
bbe364fea8
PYTHON-3294 Bump minimum pymongocrypt version to 1.3.0 (#1007) 2022-07-18 13:06:08 -05:00
Julius Park
61add4a1cf
PYTHON-3303 Upgrade encryption testing to macos 10.15+ (#1004) 2022-07-14 16:30:52 -07:00
Shane Harvey
309a7e0b3d
PYTHON-3353 Improve reliability of SDAM heartbeat error spec tests (#1005) 2022-07-14 17:09:42 -05:00
Steven Silvester
135efdd23f
PYTHON-3153 Update initial DNS seedlist discovery tests to support dedicated load balancer port (#1002) 2022-07-14 14:57:52 -05:00
Tim Gates
418130d923
docs: Fix a few typos (#1003) 2022-07-12 12:00:39 -05:00
Steven Silvester
34f3a1585c
PYTHON-3349 Don't clear entire load balanced pool when serviceId is unknown (#1001) 2022-07-11 16:11:32 -05:00
Steven Silvester
d2b95d1bf0
PYTHON-3336 Test Failure - test_load_balancer failing (#1000) 2022-07-08 19:40:25 -05:00
Julius Park
b9884f34a9
Test Failure - crypt_shared FLE tests fail on Windows/macos (#999) 2022-07-08 12:30:39 -07:00
Shane Harvey
b16533951c
PYTHON-3345 CSOT use connection handshake RTT for load balanced mode (#998) 2022-07-07 16:55:16 -07:00
Steven Silvester
b40f13bf7d
PYTHON-3311 Module "pymongo" does not explicitly export attribute "MongoClient"; implicit reexport disabled (#994) 2022-07-06 18:30:00 -05:00
Steven Silvester
c09af5876d
PYTHON-3338 Add versionadded to docs for key management APIs (#992) 2022-07-06 18:29:28 -05:00
Steven Silvester
ff1efd1ab2
PYTHON-2986 Update serverless testing for load balancer fronting single proxy (#997) 2022-07-06 17:03:58 -05:00
Steven Silvester
b8f857d19e
PYTHON-3292 Remove ElectionInProgress (216) from ResumableChangeStreamError (#996) 2022-07-06 16:59:46 -05:00
Steven Silvester
751949a22a
PYTHON-3316 Add Type Check Test for Transactions (#995) 2022-07-06 14:24:06 -05:00
Steven Silvester
256cd002d6
PYTHON-3339 Ignore Sourceforge link that is giving 403 Error (#993) 2022-07-06 14:23:14 -05:00
Shane Harvey
6acc9f64cf
PYTHON-3333 Fix bug where non-cursor read operations fail in a transaction with directConnection=True on primary (#991) 2022-07-06 11:39:41 -07:00
Shane Harvey
02de2c93e0
PYTHON-3337 Fix capped collection test on MMAPv1 (#990) 2022-07-06 11:39:07 -07:00
Julius Park
6d916d68c2
PYTHON-3315 Remove index_key_id option from ClientEncryption encrypt method (#989) 2022-07-01 12:36:12 -07:00
Steven Silvester
b37b146ac8
PYTHON-3053 Key Management API (#958) 2022-06-30 12:35:29 -05:00
Steven Silvester
0631039118
PYTHON-3319 Require contentionFactor for "Indexed" explicit encryption (#987) 2022-06-29 16:08:38 -05:00
Julius Park
bacaf7fa50
PYTHON-3309 Explicit Queryable Encryption doc example needs to utilize index_key_Id (#986) 2022-06-29 13:11:25 -07:00
Steven Silvester
6ed38529e8
PYTHON-3286 Update expected FLE 2 find payloads in tests (#988) 2022-06-29 15:11:13 -05:00
Julius Park
f290290261
PYTHON-3097 Language specific examples for AWS Lambda (#984) 2022-06-29 12:18:52 -07:00
Julius Park
ae71872fa9
PYTHON-3297 Test auto decryption occurs after CommandSucceeded events (#980) 2022-06-24 10:52:09 -07:00
Julius Park
1f7f46faa2
PYTHON-3282 Add comment option tests for distinct helper (#979) 2022-06-21 15:30:17 -07:00
Julius Park
3169f1fe31
PYTHON-3310 Test Failure - query_type must be str or None, not: <enum 'QueryType'> (#978) 2022-06-21 10:46:49 -07:00
Ben Warner
4ae93c4937
PYTHON-1552 Prevent uploading partial or corrupt GridFS files after an error occurs 2022-06-16 15:26:27 -07:00
Ben Warner
922e63d6e0
PYTHON-3093 Continuation of #972 (#976) 2022-06-16 11:40:09 -07:00
Julius Park
02a9df69f6
PYTHON-3227 Clustered Indexes for all Collections (#971) 2022-06-15 13:16:22 -07:00
Julius Park
f45f00b4e5
PYTHON-3300 Fix Explicit Queryable Encryption Example (#975) 2022-06-15 13:16:07 -07:00
Julius Park
dc21a083f4
PYTHON-3300 Add Explicit Queryable Encryption Example to Docs (#973) 2022-06-15 12:25:11 -07:00
Ben Warner
43c2062305
PYTHON-3093 Change streams support for user-facing PIT pre- and post-images (#972) 2022-06-15 11:22:55 -07:00
Steven Silvester
98d3933364
PYTHON-3253 Provide FLE 2.0 API example for docs team (#969) 2022-06-13 19:54:36 -05:00
Ben Warner
3f7231a1a2
PYTHON-3048 Fixed bug with incorrect validation of UTF-8 regex patterns (#970) 2022-06-13 16:04:30 -07:00
Ben Warner
be3008aa11
PYTHON-2110 Refactored some C to avoid symbol conflicts (#968)
* Refactored to avoid symbol conflicts

* Forgot a replacement

* Found a symbol

* Undid symbol replacement for PyInit__cmessage

* Changed cbson too

Co-authored-by: Ben Warner <ben.warner@mongodb.com>
2022-06-13 11:42:41 -07:00
Atiab Bin Zakaria
b8653b018d
Remove extra period in is_mongos documentation (#967) 2022-06-09 11:10:03 -04:00
Steven Silvester
e59a11ef4b back to dev version 2022-06-07 20:24:59 -04:00
Steven Silvester
83ade52b1b bump to 4.2.0b0 2022-06-07 20:24:12 -04:00
Shane Harvey
a6ae852c36
PYTHON-3290 Nested pymongo.timeout() calls only shorten the deadline (#966) 2022-06-07 17:40:46 -04:00
Steven Silvester
77ace9a988
PYTHON-3299 Add Automatic Queryable Encryption Example to Docs (#964) 2022-06-07 17:29:51 -04:00
Steven Silvester
3e8487826a
PYTHON-3294 Depend on PyMongoCrypt 1.3.0b0 tag for beta (#963) 2022-06-07 17:06:54 -04:00
Shane Harvey
09b18244cc
PYTHON-3293 Document Queryable Encryption API is in beta (#965) 2022-06-07 15:46:13 -04:00
Shane Harvey
70cfe46063
PYTHON-3290 Support nested pymongo.timeout() calls (#962) 2022-06-07 14:29:07 -04:00
Shane Harvey
890cd26e1a
PYTHON-3288 Implement client side operation timeout (#954)
Add timeoutMS URI option and MongoClient keyword argument.
Add provisional/beta pymongo.timeout() api to set a deadline for a block of operations.
2022-06-06 15:36:52 -04:00
Julius Park
6b088ffa4e
PYTHON-3241 Add Queryable Encryption API to AutoEncryptionOpts (#957) 2022-06-06 12:33:31 -04:00
Shane Harvey
d98e44e27e
PYTHON-3245 Fix docs for index_key_id (#960) 2022-06-03 13:43:47 -07:00
Shane Harvey
154d8787c5
PYTHON-3245 Support explicit queryable encryption (#959) 2022-06-03 13:11:28 -07:00
Shane Harvey
09385be549
PYTHON-2924 Improve test_load_balancing (#955) 2022-06-02 10:55:15 -07:00
Shane Harvey
cf08d46ff9
PYTHON-3277 Rename csfle library to crypt_shared (#956) 2022-06-01 16:48:08 -07:00
Steven Silvester
62a6302181
PYTHON-2683 Convert change stream spec tests to unified test format (#950) 2022-06-01 18:26:52 -05:00
Julius Park
f4fc742ff3
PYTHON-3276 [pymongo] FLE 1.0 shared library (#947) 2022-05-27 12:34:22 -07:00
Shane Harvey
78476d0217
PYTHON-3187 Avoid tight poll() loop on pyopenssl connections (#953) 2022-05-26 15:14:59 -07:00
Steven Silvester
9f191d6bb3
PYTHON-3283 Remove Generic Typing from the ClientSession Class (#952) 2022-05-25 05:55:36 -05:00
Shane Harvey
89d3fd0355
PYTHON-3279 Don't link check flakey wiki.centos.org (#951) 2022-05-23 12:44:44 -07:00
Steven Silvester
e02eb287e8
PYTHON-3254 Bump maxWireVersion for MongoDB 6.0 (#948) 2022-05-12 15:42:06 -05:00
Shane Harvey
a7579b02d2
PYTHON-3259 Improve migration guide for loads/JSONOptions/tz_aware (#946) 2022-05-10 11:05:59 -07:00
Shane Harvey
a624197338
PYTHON-3260 Improve test_transaction_starts_with_batched_write and test_continuous_network_errors (#945) 2022-05-10 10:29:48 -07:00
Shane Harvey
a1c33e0b84
PYTHON-3257 Fix "connection pool paused" errors in child after fork (#944) 2022-05-09 15:37:48 -07:00
Shane Harvey
cbab615231
PYTHON-3065 Ignore SRV polling update when topology is discovered to be a replica set (#943) 2022-05-09 12:01:36 -07:00
Steven Silvester
21ead3a7e5
PYTHON-3189 Change Stream event document missing to field for rename events (#924) 2022-05-06 16:48:02 -05:00
Shane Harvey
3e57bde2ee
PYTHON-3230 Migrate to newer zSeries, POWER8, and ARM platforms (#942) 2022-05-06 13:53:30 -07:00
Julius Park
aa16f1c5fe
PYTHON-3242 Test against MongoDB 6.0 (#940) 2022-05-06 12:02:36 -07:00
Shane Harvey
75685c006c
PYTHON-3235 Drop support for Python 3.6 (#939) 2022-05-05 16:13:41 -07:00
Shane Harvey
502effeeba
PYTHON-3167 Fix mockupdb tests for estimated_document_count (#938) 2022-05-05 10:52:53 -07:00
Shane Harvey
9a829acf2e
PYTHON-3251 Make extra whitespace visible in invalid port exception (#937) 2022-05-04 11:12:58 -07:00
Julius Park
252ed1cef6
PYTHON-3247 Mitigate user issues caused by change in directConnection defaults in 4.x (#935) 2022-05-03 14:49:18 -07:00
Shane Harvey
ede07f44dd
PYTHON-3250 Speed up majority writes in test suite (#936) 2022-05-03 14:41:24 -07:00
Shane Harvey
6e4e90a882
PYTHON-3167 Revert to using the count command for estimated_document_count (#934)
Resolves PYTHON-2885, PYTHON-3166, PYTHON-3224, and PYTHON-3219.
2022-05-02 16:32:05 -07:00
Julius Park
05b55e88df
PYTHON-3038 The doc should clarify that the resulting documents that are produced with upserts are constructed from both the filter and the update params (#933) 2022-05-02 06:21:44 -07:00
Steven Silvester
9e317bf417
PYTHON-3243 Pin version of mypy used (#932) 2022-04-28 11:07:46 -05:00
Steven Silvester
a2606cfc03
PYTHON-3194 Adopt doc8 checker (#931) 2022-04-22 13:44:14 -05:00
Shane Harvey
fe057cf577 PYTHON-3220 Add CSFLE spec test for auto encryption on a collection with no jsonSchema 2022-04-20 12:01:26 -07:00
Steven Silvester
cfa2d990f0
PYTHON-3228 _tmp_session should validate session input (#930) 2022-04-18 20:38:46 -05:00
Shane Harvey
109eaaff7b BUMP 4.2.0.dev1 2022-04-13 13:32:58 -07:00
Shane Harvey
8b3eaafb40 BUMP 4.1.1 2022-04-13 13:32:58 -07:00
Julius Park
868b3f77f3
PYTHON-3080 Add section to troubleshooting FAQ per driver with top SEO results (#918) 2022-04-13 13:03:37 -07:00
Shane Harvey
ff288faf39
PYTHON-3221 Resync CSFLE spec tests (#929) 2022-04-13 12:20:54 -07:00
Steven Silvester
a319075ba7
PYTHON-3197 Update docs.mongodb.com links in source, API & Reference documentation (#926) 2022-04-13 14:11:13 -05:00
Shane Harvey
fd512d5c90
PYTHON-3225 Stop testing delete on capped collections (#928) 2022-04-12 17:43:10 -07:00
Shane Harvey
dca72b7884
PYTHON-3222 Fix memory leak in cbson decode_all (#927)
Add decode_all keyword arg for codec_options.
Make decode_all show up in docs.
2022-04-12 17:18:23 -07:00
Shane Harvey
5ccbb4d6d8
PYTHON-3216 Include codec_options.pyi in release distributions (#923) 2022-04-06 12:18:44 -07:00
Shane Harvey
3cb16cae24
PYTHON-3210 Remove flakey string assertion from invalid aws creds FLE test (#922) 2022-04-06 12:09:47 -07:00
Shane Harvey
49c3f9fdfd PYTHON-3215 Add Typing :: Typed trove classifier 2022-04-06 11:47:31 -07:00
Terence Honles
01f983e8ab
PYTHON-3214 Fix typing markers not being included in the distribution (#921) 2022-04-06 11:25:25 -07:00
Shane Harvey
821b5620f7
PYTHON-3198 Fix NameError: name sys is not defined (#920) 2022-04-05 13:07:06 -07:00
Shane Harvey
331600d491 BUMP 4.2.0.dev0 2022-04-04 11:06:52 -07:00
Shane Harvey
6e99bf4515 BUMP 4.1.0 2022-04-04 10:57:01 -07:00
Duncan
b0fd5cbdf5
Improve docstrings for SON parameters (#919) 2022-04-01 12:37:47 -05:00
Steven Silvester
a809b3c005
PYTHON-3190 Test Failure - doctests failing cannot import name 'TypedDict' (#917) 2022-03-31 16:11:20 -05:00
Shane Harvey
1d6914f749
PYTHON-3191 Fix test_sigstop_sigcont with Versioned API (#916) 2022-03-31 12:25:45 -07:00
Steven Silvester
113d66dc18
PYTHON-2406 Clean up of tools documentation page (#913) 2022-03-31 04:31:05 -05:00
Shane Harvey
484058e18d
PYTHON-3160 Fix MMAPv1 tests (#914) 2022-03-30 21:50:22 -07:00
Shane Harvey
3179eab91d
Improve the changelog for 4.1 (#915) 2022-03-30 20:57:12 -05:00
Shane Harvey
c58950a8d4
PYTHON-3186 Avoid SDAM heartbeat timeouts on AWS Lambda (#912)
Poll monitor socket with timeout=0 one last time after timeout expires.
This avoids heartbeat timeouts and connection churn on Lambda and other FaaS envs.
2022-03-30 14:29:46 -07:00
Steven Silvester
1d30802f8c
PYTHON-3074 Add documentation for type hints (#906) 2022-03-29 18:03:42 -05:00
Shane Harvey
a4bba9dd5c Revert "PYTHON-2970 Prioritize electionId over setVersion for stale primary check (#845)"
This reverts commit 225d131c2d.
2022-03-29 13:45:27 -07:00
Steven Silvester
d8c2b315b0
PYTHON-3185 Pre-Commit Needs an Upgrade (#911) 2022-03-29 14:59:33 -05:00
Shane Harvey
c15fce0b3c
PYTHON-3138 copydb was removed in MongoDB 4.2 (#910) 2022-03-28 15:23:00 -07:00
Shane Harvey
75fa14d19b
PYTHON-3084 MongoClient/Database/Collection should not implement Iterable (#909) 2022-03-28 15:09:53 -07:00
Steven Silvester
72d8900c36
PYTHON-3058 Bump maxWireVersion for MongoDB 5.2 (#908) 2022-03-28 13:48:58 -05:00
Steven Silvester
e325b24b78
PYTHON-3127 Snapshot Query Examples for the Manual (#907) 2022-03-28 12:18:26 -05:00
Julius Park
9562a81903
PYTHON-3119 getMore helper should explicitly send inherited comment (#904) 2022-03-25 16:47:18 -07:00
Shane Harvey
861d79537f
PYTHON-3180 Use server v3 toolchain in perf tests (#905) 2022-03-22 14:52:06 -07:00
Steven Silvester
da81c69644
PYTHON-3157 Update Release Documentation to Include Github Releases (#900) 2022-03-16 15:26:45 -05:00
Steven Silvester
b3604a81d3
PYTHON-3171 Add usage of NoReturn annotation (#901) 2022-03-16 15:26:10 -05:00
Shane Harvey
648a87e228
PYTHON-3173 Skip version API test for count (#902) 2022-03-16 12:32:00 -07:00
Shane Harvey
0a6e7bc387
PYTHON-3174 Don't reinit client_context.client (#899) 2022-03-16 09:36:31 -07:00
Steven Silvester
474420b2e5
PYTHON-3085 Audit consistent and correct types for _DocumentOut (#893) 2022-03-16 05:56:07 -05:00
Shane Harvey
9ada6543d5
PYTHON-3174 Remove noisy running Topology check for main test client (#898) 2022-03-15 14:52:47 -07:00
Steven Silvester
087950d869
PYTHON-3164 Outdated link from PyMongo docs to community forum (#895) 2022-03-15 15:49:11 -05:00
Shane Harvey
225d131c2d
PYTHON-2970 Prioritize electionId over setVersion for stale primary check (#845) 2022-03-09 11:13:18 -08:00
Shane Harvey
f081297a86
PYTHON-3159 Fix typo in zlib compression support (#894) 2022-03-04 17:29:33 -08:00
Shane Harvey
671d1e622c
PYTHON-3147 Fix pip install in MONGODB-AWS auth tests (#892) 2022-03-03 12:47:36 -08:00
Steven Silvester
a61ea0660a
PYTHON-3090 Clean up Database Command Typing (#879) 2022-03-02 13:10:15 -06:00
Julius Park
b737b843e9
PYTHON-2956 Drivers should check out an implicit session only after checking out a connection (#876) 2022-03-01 15:44:05 -08:00
Steven Silvester
782c5517e0
PYTHON-3146 Test Failure - Could not import extension sphinxcontrib.shellcheck (#889) 2022-03-01 14:10:57 -06:00
Steven Silvester
0672d2d1c3
PYTHON-3141 Add slotscheck to pre-commit checks (#890) 2022-02-28 17:02:53 -06:00
Shane Harvey
a3f0f91588
PYTHON-3123 Convert sessions spec tests to unified test format (#888)
Create implicit session _before_ starting a retryable read.
2022-02-25 10:36:05 -08:00
Shane Harvey
f8f34b0438
PYTHON-2951 Test that handshake errors are retryable (#846) 2022-02-23 14:00:43 -08:00
Julius Park
6fb8d7afe8
PYTHON-3129 Re-sync CRUD spec tests (#887) 2022-02-23 14:00:16 -08:00
Shane Harvey
8496ed4b3d
PYTHON-3142 Stop using $where in test_maxConnecting (#886) 2022-02-23 11:52:55 -08:00
Julius Park
2141621194
PYTHON-3088 Test rapid releases with load balancers (#885)
PYTHON-3088 [v3.13] Update load balancer tests to support dedicated load balancer port (#870)

(cherry picked from commit 341d489)
2022-02-22 14:45:56 -08:00
Arie Bovenberg
2f13a51cd4
PYTHON-3124 Remove overlapping slots from _WriteResult subclasses (#884) 2022-02-22 10:27:16 -08:00
Julius Park
52ff8c2e90
PYTHON-3068 Support 'let' option in BulkWriteOptions (#874) 2022-02-18 10:43:56 -08:00
Julius Park
dce5072dd1
PYTHON-3137 Handle falsey values for "let" parameter (#881) 2022-02-18 10:43:07 -08:00
Julius Park
e6b65860f5
PYTHON-3136 [DevOps] Resync-specs.sh removes ignored files from working tree (#878) 2022-02-17 17:13:25 -08:00
Julius Park
f5eec45250
PYTHON-3111 Rename "Versioned API" to "Stable API" in documentation (#867) 2022-02-17 16:23:23 -08:00
Steven Silvester
a0fe7c03af
PYTHON-3120 Set up flake8 linting (#868) 2022-02-17 06:44:08 -06:00
Steven Silvester
1a90e477cf
PYTHON-3131 Test Failure - test_mypy on macos + auth (#875) 2022-02-16 19:29:21 -06:00
Shane Harvey
7a8f6b3442
PYTHON-2147 Use verified peer cert chain in OCSP when available (#877) 2022-02-16 17:11:12 -08:00
Shane Harvey
09f8aa9928
PYTHON-3072 Use _Address in more places (#871) 2022-02-15 15:49:39 -08:00
Shane Harvey
9482019a53
Add resync-syncs workarounds for incomplete spec work (#873) 2022-02-15 15:40:36 -08:00
Steven Silvester
2db512f5d5
PYTHON-3078 Remove Use of Unsupported NoReturn Type Class (#864) 2022-02-14 16:14:36 -06:00
Julius Park
341d489f38
PYTHON-3088 Update load balancer tests to support dedicated load balancer port (#866) 2022-02-14 11:26:14 -08:00
Steven Silvester
405c11dc2c
PYTHON-3109 Test against latest rapid releases (#862) 2022-02-11 12:43:02 -06:00
Steven Silvester
80314255d7
PYTHON-3092 Add Type Discovery Files (#863) 2022-02-11 12:41:29 -06:00
Steven Silvester
0700a84432
PYTHON-1834 Add shellcheck (#858) 2022-02-11 06:32:01 -06:00
Steven Silvester
c47557bc63
PYTHON-3062 Make Regex generic (#860) 2022-02-10 18:59:26 -06:00
Steven Silvester
cbc7cc33e5
PYTHON-3073 Copy the unit tests from pymongo-stubs into pymongo (#859) 2022-02-10 18:54:46 -06:00
Julius Park
ddb6614442
PYTHON-2682 Add support for the comment field to all helpers (#847) 2022-02-09 15:12:02 -08:00
Steven Silvester
b7057ecf9f
PYTHON-1834 (cont) Add pre-commit config (#853) 2022-02-09 14:24:23 -06:00
Steven Silvester
5578999a90
PYTHON-1834 Use a code formatter (#852) 2022-02-09 06:44:28 -06:00
Bernie Hackett
3150c60d02
PYTHON-3043 Test mod_wsgi with Python 3.10 (#850) 2022-02-08 10:01:46 -08:00
Steven Silvester
f4cef37328
PYTHON-3064 Add typings to test package (#844) 2022-02-07 19:33:41 -06:00
Shane Harvey
561ee7cf77
PYTHON-3110 Remove use of example.com in CSFLE tests (#848) 2022-02-07 19:33:16 -06:00
Julius Park
51691246e9
PYTHON-2858 Use OP_MSG to authenticate if server supports OP_MSG (#843) 2022-02-03 15:25:14 -08:00
Steven Silvester
dd6c140d43
PYTHON-3060 Add typings to pymongo package (#831) 2022-02-02 21:12:36 -06:00
Steven Silvester
abfa0d35bc
PYTHON-3075 bulk_write does not apply CodecOptions to upserted_ids result (#840) 2022-02-02 13:53:58 -06:00
Julius Park
aa60c2a2c0
PYTHON-3071 [DevOps] Merge and improve resync_specs.sh (#839) 2022-02-01 12:45:47 -08:00
Bernie Hackett
308b4f4e08
PYTHON-1596 Test on RHEL7 FIPS (#838) 2022-01-26 17:28:38 -08:00
Julius Park
4eeb685c57
PYTHON-3069 Require hello command + OP_MSG when 'loadBalanced=True' (#837) 2022-01-26 11:57:36 -08:00
Shane Harvey
bdafc35733
PYTHON-3041 Fix doc example for initializing a replica set (#835) 2022-01-21 10:09:03 -08:00
Shane Harvey
b7c33debbf
PYTHON-3046 Document support for backslashreplace and surrogateescape (#836) 2022-01-21 10:08:48 -08:00
Alexander Golin
d6fc05ae49
Create CODEOWNERS (#834) 2022-01-20 17:03:43 -05:00
Steven Silvester
f074cfb696
PYTHON-2863 Allow hint for unacknowledged writes using OP_MSG when supported by the server (#830) 2022-01-20 08:18:13 -06:00
Julius Park
c9229ace26
PYTHON-3061 Add 'let' option to ReplaceOptions (#832) 2022-01-18 16:40:28 -08:00
Steven Silvester
52ed5a4135
PYTHON-3052 Add Typings to PyMongo Itself (#829) 2022-01-13 16:09:48 -06:00
David Kim
c760f900f2
Edit simple typo in docs (#828) 2021-12-20 07:32:53 -06:00
Bernie Hackett
ee80ebab54
PYTHON-3049 Test with PyPy 3.8 (#827) 2021-12-17 12:10:35 -08:00
Shane Harvey
3886d0660e PYTHON-3040 Remove duplicate srvMaxHosts tests 2021-12-14 15:29:57 -08:00
Bernie Hackett
2b53bf3b85
PYTHON-3042 Migrate OCSP testing to Ubuntu 20.04 (#826) 2021-12-14 15:12:01 -08:00
Roberto Martinez
3843cef3f2
Use quotes for pip install with extras in README (#825) 2021-12-14 11:24:33 -08:00
Roberto Martinez
b502c44c06
Use quotes for pip install with extras (#824) 2021-12-14 11:24:05 -08:00
Shane Harvey
0fc82d9c7b
PYTHON-2763 Fix check_keys removal in encryption (#823) 2021-12-14 10:32:13 -08:00
Bernie Hackett
68b818141a
PYTHON-2903 Migrate testing from Amazon1 to Ubuntu 18.04 (#822) 2021-12-13 16:30:36 -08:00
Shane Harvey
ff3a8b44dc
PYTHON-1864 PYTHON-2931 Spec complaint $readPreference (#809)
Stop sending $readPreference to standalone servers.
Stop sending $readPreference primary because it's the server default.
Remove outdated secondary_ok flag.
2021-12-13 15:47:34 -08:00
Shane Harvey
b2f3c66575
PYTHON-2888 Migrate from json.send to perf.send (#819)
Rename ops_per_sec to bytes_per_sec to better reflect the perf measurement.
2021-12-13 14:41:25 -08:00
Steven Silvester
a7891480d1
PYTHON-2353 Update create_collection docs with more options (#820) 2021-12-10 13:34:18 -06:00
Shane Harvey
797197e73b
PYTHON-2763 Remove outdated check_keys and $clusterTime logic (#817) 2021-12-10 10:22:49 -08:00
Shane Harvey
c94a3ad1df
PYTHON-2585 Remove legacy multi-auth code (#816) 2021-12-09 18:00:41 -08:00
Shane Harvey
7bd9bd7b47
PYTHON-2160 Stop using Google Groups email address (#818) 2021-12-09 17:55:26 -08:00
Shane Harvey
57ad29e4bd PYTHON-2203 Resync auth spec tests 2021-12-09 16:29:20 -08:00
Shane Harvey
d504c1f399 PYTHON-2086 Verify max set version and max election id on topologies in SDAM spec tests 2021-12-09 14:03:01 -08:00
Shane Harvey
9deb1069f3 PYTHON-1643 Resync read write concern spec tests 2021-12-09 13:50:53 -08:00
Shane Harvey
9f29e73137
PYTHON-2473 Add basic Github Actions testing (#815) 2021-12-09 13:02:32 -08:00
Shane Harvey
1d7b9a80b9
PYTHON-3026 Fix Windows Python 3.6 tests (#813) 2021-12-07 16:41:10 -08:00
Shane Harvey
bf992c20a6
PYTHON-2554 Support aggregate $merge and $out executing on secondaries (#774) 2021-12-07 16:26:01 -08:00
Shane Harvey
e154642968
Removed references to outdated server versions (#812) 2021-12-07 15:47:28 -08:00
Shane Harvey
f3a76a703b BUMP 4.1.0.dev0 2021-12-07 11:14:09 -08:00
Julius Park
70f7fe7542
PYTHON-3028 $regex as a field name does not allow for non-string values (#807) 2021-12-06 13:13:15 -08:00
Shane Harvey
44853ea9c3
PYTHON-3033 Fix typo in uuid docs (#808) 2021-12-06 11:26:36 -08:00
Shane Harvey
5ec4e6cc4c
PYTHON-3027 Fix server selection when topology type is Unknown (#806) 2021-12-02 13:45:50 -08:00
Julius Park
046d789d9f
PYTHON-2957 Support 'let' option for multiple CRUD commands (#804) 2021-11-30 15:02:40 -08:00
Shane Harvey
e3d1d6f5b4 BUMP 4.0.1.dev0 2021-11-29 10:32:30 -08:00
Shane Harvey
2c28149a30 BUMP 4.0 2021-11-29 10:31:12 -08:00
Julius Park
7de879a9fe
PYTHON-3018 Add docs for removed methods from Collection (#801) 2021-11-23 16:56:41 -08:00
Shane Harvey
37b5195eef
PYTHON-2434 Automatically combine release wheels + sdist into one archive (#803) 2021-11-23 16:15:52 -08:00
Shane Harvey
64a4f6e141
PYTHON-3024 Update estimatedDocumentCount test for Atlas Data Lake (#802)
Migrate data lake testing to ubuntu 18.
Ensure mongohouse downloads the right build via VARIANT.
2021-11-23 15:45:49 -08:00
Shane Harvey
2af521ec03
PYTHON-2984 Fix retry behavior for bulk write writeConcernError (#800) 2021-11-19 12:15:23 -08:00
Shane Harvey
cddae7ae93
PYTHON-2919 Remove MongoDB 2.6-3.4 from performance testing (#798) 2021-11-18 16:28:42 -08:00
Shane Harvey
79659063c5
PYTHON-3021 Send primaryPreferred when connected to standalone servers (#799) 2021-11-18 16:28:02 -08:00
Shane Harvey
5b8b09ac4f
PYTHON-3020 Properly mark server unknown after "not master" errors without a code (#797)
Fix prefer-error-code SDAM test.
2021-11-17 18:18:41 -08:00
Julius Park
9cf88cfdc1
PYTHON-2773 Mockupdb test failures (#796) 2021-11-17 17:37:05 -08:00
Shane Harvey
12a6af7ab6
PYTHON-2981 Stop using MongoClient.address for hashing and equality (#795) 2021-11-17 12:31:59 -08:00
Shane Harvey
24cc4c42bf
PYTHON-3019 Fix doc test failures (#794)
Remove pymongo 2 to 3 migration guide.
Make raw_bson doc tests less flakey.
2021-11-16 17:14:33 -08:00
Shane Harvey
e655b0bb99
PYTHON-3001 Bump minimum pymongocrypt version to 1.2.0 (#793) 2021-11-16 16:35:31 -08:00
Julius Park
8fc6dc3c4f
PYTHON-1489 Merge ajdavis/pymongo-mockup-tests into pymongo (#787) 2021-11-16 16:26:18 -08:00
Shane Harvey
99aab1b0ba
PYTHON-3017 Properly check for closed KMS connections (#790) 2021-11-16 14:34:36 -08:00
Bernie Hackett
a655c576c9
PYTHON-3015 Document cipher mismatch issues (#791) 2021-11-16 14:23:55 -08:00
Shane Harvey
278a50d4b0
PYTHON-3005 Make maxConnecting configurable (#789) 2021-11-16 12:51:36 -08:00
Shane Harvey
a7fb3281ea
PYTHON-3004 Support kmip FLE KMS provider (#786)
Resync CSFLE spec tests.
2021-11-15 16:23:59 -08:00
Shane Harvey
754e52890f
PYTHON-2915 Skip large txn test on slow Windows hosts (#788) 2021-11-15 13:01:45 -08:00
Julius Park
6d1dd6d63a
PYTHON-3014 Update how events are added to entity map to match specification (#785) 2021-11-12 16:23:57 -08:00
Julius Park
e1884b44df
PYTHON-2512 Update Astrolabe's Workload Executor to use the unified test runner (#783) 2021-11-11 15:00:17 -08:00
Bernie Hackett
99a413f81b Update author and maintainer 2021-11-11 13:56:26 -08:00
Shane Harvey
370e1652ad
PYTHON-3003 Add kms_tls_options to configure options for KMS provider connections (#784) 2021-11-10 16:49:31 -08:00
Shane Harvey
c404150fe7
PYTHON-3011 Fix test_connections_are_only_returned_once (#781) 2021-11-08 17:00:42 -08:00
Julius Park
e80141ed1c
PYTHON-2992 Implement unified test format loop operation (#773) 2021-11-08 16:19:24 -08:00
Julius Park
b05ac0e7ba
PYTHON-2460 Client can create more than minPoolSize background connections (#782) 2021-11-08 16:12:45 -08:00
Julius Park
9a47c30699
PYTHON-2971 PossiblePrimary must not be checked for wire version compatibility of MaxStalenessSeconds (#778) 2021-11-08 14:30:58 -08:00
Shane Harvey
2f3acb6bc2
PYTHON-2941 Add a CMAP test that verifies the background thread hands over connections to threads doing checkout (#780) 2021-11-05 15:05:05 -07:00
Julius Park
420d74095d
PYTHON-2721 Reenable regex flags test on MongoDB 5.0+ (#779) 2021-11-05 13:07:07 -07:00
Shane Harvey
e27131546c
PYTHON-2998 Remove md5 checksums from gridfs and remove disable_md5 (#776)
Speed up gridfs tests (shaves off about 2 minutes on macOS).
2021-11-04 17:25:11 -07:00
Shane Harvey
89f41cfbd2
PYTHON-2999 Remove unused and internal only CRAM-MD5 auth mechanism (#777) 2021-11-04 14:12:12 -07:00
Shane Harvey
b342990934
PYTHON-2164 Add MongoClient.options, remove redundant properties (#772) 2021-11-03 11:21:33 -07:00
Shane Harvey
9f6c6a3061 PYTHON-2990 Use https:// instead of unauthenticated git:// for git clone 2021-11-01 18:23:08 -07:00
Shane Harvey
8b2eb24c35
PYTHON-2164 Remove client max_bson_size/max_message_size/max_write_batch_size (#766)
Use the hello command instead:
doc = client.admin.command('hello')
max_bson_size = doc['maxBsonObjectSize']
max_message_size = doc['maxMessageSizeBytes']
max_write_batch_size = doc['maxWriteBatchSize']

Also add documentation for TopologyDescription.apply_selector.
2021-11-01 14:26:47 -07:00
Matti Picus
695a90e75e
PYTHON-2987 Fix test unicode repr on PyPy 7.3.7 (#770) 2021-11-01 12:17:28 -07:00
Julius Park
42324c69cf
PYTHON-2973 Revert back to using quote_plus/unquote_plus (#767) 2021-10-29 16:30:55 -07:00
Shane Harvey
3c3a85d1bc
PYTHON-2817 Add .readthedocs.yaml config file (#769) 2021-10-28 17:12:30 -07:00
Julius Park
9844d3dc03
PYTHON-2972 Test Failure - test_srv_max_hosts_kwarg when dnspython is not installed (#768) 2021-10-28 16:05:32 -07:00
Julius Park
3235f96590
PYTHON-2911 Bump maxWireVersion to 14 for MongoDB 5.1 (#765) 2021-10-27 12:33:48 -07:00
Julius Park
ca46cb20bd
PYTHON-2948 Add prose test for SRV polling with a custom service name (#764) 2021-10-26 17:49:22 -07:00
Julius Park
bfa5aafb34
PYTHON-2832 Provide options to limit number of mongos servers used in connecting to sharded clusters (#754) 2021-10-26 14:47:51 -07:00
Julius Park
eabd2235ba
PYTHON-2859 Add BSON Binary subtype 7 (#763) 2021-10-26 14:24:27 -07:00
Julius Park
468427ddd4
PYTHON-2926 Unskip test_readConcern_available_with_out_stage on 5.1+ #762 2021-10-25 12:57:18 -07:00
Shane Harvey
f4eb8f93fd
PYTHON-2966 Make MongoClient.event_listeners work as expected (#761) 2021-10-22 14:43:20 -07:00
Julius Park
d77cb674b6
PYTHON-2717 Treat maxPoolSize=0 the same as maxPoolSize=None 2021-10-21 15:48:58 -07:00
Julius Park
11e6f9860a
PYTHON-1579 Update URI parser to adhere to new connection string spec (#755) 2021-10-20 13:39:32 -07:00
Julius Park
d77c20497b
PYTHON-2940 Fix spec tests that require DNSPython (#756) 2021-10-13 14:08:04 -07:00
Shane Harvey
a94916edf1
PYTHON-2923 Add Python 3.10 to release tasks (#758) 2021-10-13 13:58:04 -07:00
Shane Harvey
df6f6496a4
PYTHON-2927 PYTHON-2937 Skip failing tests on PyPy (#753)
Cleanup test clients more eagerly.
2021-10-13 10:29:38 -07:00
Julius Park
a4ccfa5b3f
PYTHON-2938 Fix race condition caused by MongoClient._process_periodic_tasks(client) (#752) 2021-10-08 17:44:15 -07:00
Julius Park
6bb8a1f411
PYTHON-2823 Allow custom service names with srvServiceName URI option (#749) 2021-10-08 11:23:21 -07:00
Shane Harvey
049daf9cf6
PYTHON-2935 Fix test_encryption.TestClientSimple.test_use_after_close (#751) 2021-10-06 16:35:46 -05:00
Julius Park
dd9206a1ae
PYTHON-2928 Fix mod_wsgi test failures (#750) 2021-10-06 11:56:44 -07:00
Julius Park
6e7b652d86
PYTHON-2914 MongoClient should raise an error when given multiple URIs (#747) 2021-10-05 14:00:39 -07:00
Shane Harvey
9cb64775c9 PYTHON-2926 Skip failing aggregate $out test on 5.1 2021-09-29 16:36:50 -07:00
Shane Harvey
7467aa634d
PYTHON-2915 Fix bug when starting a transaction with a large bulk write (#743) 2021-09-24 15:47:37 -07:00
Julius Park
a80169d1fa
PYTHON-2463 Do not allow a MongoClient to be reused after it is closed (#737) 2021-09-24 15:37:24 -07:00
Bernie Hackett
111552281d
PYTHON-2921 Fix eventlet detection with Python 3.10 (#744) 2021-09-24 14:16:29 -07:00
Julius Park
c38085269b
PYTHON-1337 Add __slots__ to commonly used bson classes (#739) 2021-09-24 13:54:40 -07:00
Bernie Hackett
4b447365d1
PYTHON-2902 Allow dnspython 2 in srv extra (#740) 2021-09-23 16:42:01 -07:00
Bernie Hackett
b0a26601d4 PYTHON-2803 Fix typos in auth tests 2021-09-23 16:22:13 -07:00
Shane Harvey
968ee7ba96
PYTHON-2868 Test Serverless behind a load balancer (#742) 2021-09-23 15:57:57 -07:00
Julius Park
c7d80802be
PYTHON-1853 Empty projections should return the entire document not just the _id (#738) 2021-09-23 14:46:44 -07:00
Julius Park
fcedc510e1
PYTHON-2501 Remove iteritems from son.SON (#731) 2021-09-22 12:18:19 -07:00
Bernie Hackett
f1d3f9ca2f PYTHON-2473 Delete Travis config file 2021-09-18 17:28:35 -07:00
Shane Harvey
5125bca2df
PYTHON-2899 Fix "no server" tests and cleanup docs (#736) 2021-09-17 14:20:51 -07:00
Shane Harvey
d559b28efb
PYTHON-2905 Fix CSFLE after UUID decoding changes (#732) 2021-09-16 17:50:22 -07:00
Shane Harvey
11752ed594
PYTHON-2899 Remove code for MongoDB <= 3.4 (#729)
Remove unneeded memoryview to bytes conversion.
2021-09-16 16:53:50 -07:00
Julius Park
88e744d506
PYTHON-808 Prevent use of Database and Collection in boolean expressions (#728) 2021-09-16 15:52:14 -07:00
Julius Park
fbd5599deb
PYTHON-2518 SON class should be compatible with Python 3's OrderedDict API (#730) 2021-09-16 15:21:40 -07:00
Julius Park
23fe13fcba
PYTHON-1965 The bson package should not depend on the pymongo package (#725) 2021-09-15 12:56:18 -07:00
Julius Park
4e086ba218
PYTHON-1915 Prohibit copying ClientSession objects (#726) 2021-09-15 12:05:09 -07:00
Julius Park
0fa86c8ee1
Removed directConnection workaround in SRV spec tests (#727) 2021-09-15 12:04:34 -07:00
Julius Park
e3771587c3
PYTHON-1949 CodecOptions and JSONOptions should have the same default value for tz_aware (#720) 2021-09-14 16:54:11 -07:00
Shane Harvey
fb20975a1f
PYTHON-2245 Change default uuidRepresentation to UNSPECIFIED (ie disable UUID encoding by default) (#724)
This change also stops decoding both 3 and 4 subtypes as UUIDs.
With standard, only subtype 4 is decoded to UUID and subtype 3 is decoded to Binary.
With legacy representations, only subtype 3 is decoded to UUID and subtype 4 is decoded to Binary.
2021-09-14 16:48:52 -07:00
Julius Park
3b8961a76e
PYTHON-2679 Auto discover replica sets by default (#716) 2021-09-14 14:00:13 -07:00
Bernie Hackett
b76c523a60 Make sure we use the correct pip 2021-09-14 13:15:35 -07:00
Bernie Hackett
f64c5aa940 PYTHON-2904 Further language modernization 2021-09-14 12:24:06 -07:00
Bernie Hackett
ad4315134c PYTHON-2803 Get rid of most uses of 'master'
This change also resolves PYTHON-2848 for MongoDB 4.0.
2021-09-13 12:50:49 -07:00
Bernie Hackett
146179db53 PYTHON-2803 Eliminate the use of 'slave' 2021-09-13 12:47:24 -07:00
Bernie Hackett
992761568d PYHON-2437 PYTHON-2873 venv improvements 2021-09-11 21:00:27 -07:00
Bernie Hackett
d8b6e01690 PYTHON-2833 MongoDB 3.6 is the minimum supported version
This change drops support for server versions older than
3.6. If you still need support for older server versions the
3.x branch of PyMongo will receive bug fixes for at least a year
after the release of PyMongo 4.0.
2021-09-10 12:05:46 -07:00
Bernie Hackett
64ae5c6544 PYTHON-2898 Update Max Staleness spec tests 2021-09-10 12:05:46 -07:00
Shane Harvey
afa3997bb2
PYTHON-2680 Breaking changes to DBRef BSON+JSON decoding (#722)
Implement DBRef spec version 1.0 tests.
2021-09-10 11:03:25 -07:00
Shane Harvey
90d4c6f19f
PYTHON-2820 Test serialization of BSON with embedded null bytes in strings (#723) 2021-09-10 10:23:27 -07:00
Julius Park
7a4b617b5d
PYTHON-2883 Regex decoding error tests in top.json have unexpected, invalid syntax (#721) 2021-09-09 18:32:53 -07:00
Shane Harvey
fb38fbe35e
PYTHON-2046 Change default JSONMode and dumps output from LEGACY to RELAXED (#711) 2021-09-08 11:33:41 -07:00
Shane Harvey
d9e5666336
PYTHON-2875 Require hint with min/max queries (#712) 2021-09-08 11:32:14 -07:00
Julius Park
88e86f6f5a
PYTHON-2057 Make 'name' a required argument for DriverInfo class (#718) 2021-09-08 11:24:10 -07:00
Shane Harvey
6913738b0a
PYTHON-2808 Use Invoke-WebRequest instead certifi to workaround FLE test issue (#714) 2021-09-01 13:44:58 -04:00
Shane Harvey
2eb0df812c
PYTHON-2879 Fix get_ssl_context for CSFLE and ocsptest.py (#713) 2021-08-24 13:36:37 -04:00
henrifroese
fa9531b4bf
PYTHON-2824 Make GridOut implement full io.IOBase spec (#677)
Make GridOut inherit from io.IOBase to be a fully "file-like" object (https://docs.python.org/3/glossary.html#term-file-like-object). Implement missing methods `readlines`, `writelines`,
`writable`, `fileno`, `flush`, `isatty`, `truncate`,
and property `closed`, following the spec
(https://docs.python.org/3/library/io.html#io.IOBase.writable).

Iterating over GridOut previously returned chunks, but IOBase specifies
that lines should be returned. Thus, the `GridOutIterator` returning chunks is removed
and GridOut simply uses the existing IOBase iterator implementation (returning `self`
in `__iter__` and using `readline` in `__next__`).

Additionally, iterating over GridOut previously did not move the "file pointer" along, i.e.
`next(iter(some_grid_out_object))` always gave the same result (the first chunk of the file)
as it would create a new iterator starting at the top of the file. This is now fixed as well, so
a first call to `next(iter(some_grid_out_object))` gives the first line, and subsequent calls return
the subsequent lines.
2021-08-23 11:45:34 -04:00
Prashant Mital
9055bb09e6
PYTHON-2702 Remove deprecated URI options (#710) 2021-08-20 10:17:06 -07:00
Prashant Mital
b3118e034e
PYTHON-2162 Remove support for ssl* URI options (#706) 2021-08-19 14:58:31 -07:00
Shane Harvey
f9bfd11290
PYTHON-2870 Add support for man/text/latex/etc.. docs output (#708)
Regenerate sphinx makefile with sphinx-quickstart 3.5.4.
Remove problematic mongodoc sphinx extension.
2021-08-19 13:31:46 -07:00
Shane Harvey
69c69a6bfb
PYTHON-2862 Remove versionchanged info for PyMongo <3.0 (#709) 2021-08-19 10:39:26 -07:00
Shane Harvey
09aef81b4a
DRIVERS-1864 Resync SDAM spec tests (#707) 2021-08-17 14:53:11 -07:00
Prashant Mital
3c8b78348d
PYTHON-2866 Setting tlsDisableOCSPEndpointCheck=false must enable OCSP endpoint check
(cherry picked from commit fe1d19dea4)
2021-08-16 12:18:12 -07:00
Shane Harvey
6a18027db8
PYTHON-2534 Avoid race in test_pool_paused_error_is_retryable (#704) 2021-08-16 10:27:37 -07:00
Shane Harvey
65aa7c86d5
PYTHON-2850 Remove map_reduce/inline_map_reduce (#703) 2021-08-12 09:44:52 -07:00
Shane Harvey
71a1656be0
PYTHON-2038 Remove pymongo.errors.CertificateError (#705) 2021-08-12 09:29:30 -07:00
Shane Harvey
10002fad1c
PYTHON-2857 Remove the socketKeepAlive option (#702) 2021-08-10 14:00:41 -07:00
Shane Harvey
e1b068d37a
PYTHON-2525 Remove Collection.count and Cursor.count (#700) 2021-08-10 13:52:29 -07:00
Shane Harvey
c663fb69cc
PYTHON-2856 Properly assert 0 events in snapshot reads tests (#697)
expectEvents must be non-empty if present.
2021-08-09 12:50:15 -07:00
Shane Harvey
e3a61b9ff7
PYTHON-1840 Remove waitQueueMultiple and ExceededMaxWaiters (#699) 2021-08-09 10:53:28 -07:00
Shane Harvey
be47e4ca14
PYTHON-2532 Remove modifiers option for find methods (#696) 2021-08-09 10:02:36 -07:00
Shane Harvey
5fd175c0d8
PYTHON-2529 Remove UUIDLegacy (#698) 2021-08-06 16:52:41 -07:00
Shane Harvey
369d175993
PYTHON-2430 Remove all helpers in the message module (#695) 2021-08-06 13:33:21 -07:00
Shane Harvey
9bc27c9c0b PYTHON-2797 Update docs for 5.0 support
Add changelog entries for 3.11.2, 3.11.3, and 3.12.0.
2021-08-06 13:29:11 -07:00
Shane Harvey
93a042f2e8
PYTHON-2235 Remove pymongo.GEOHAYSTACK (#694) 2021-08-06 13:13:23 -07:00
Shane Harvey
edda903b5b
PYTHON-2711 Remove profile command helpers (#693) 2021-08-06 12:54:52 -07:00
Shane Harvey
3e02957998 PYTHON-2288 Finish removing IsMaster from docs 2021-08-06 12:33:26 -07:00
Shane Harvey
69dee51b90
PYTHON-1318 Remove initialize_unordered_bulk_op and initialize_ordered_bulk_op (#692)
PYTHON-2436 Unskip test_large_inserts_ordered on MongoDB 5.0.
2021-08-05 17:58:15 -07:00
Shane Harvey
a28b05bf24 PYTHON-1410 Remove "safe" legacy messages 2021-08-04 11:29:16 -07:00
Shane Harvey
3513ab72b0 PYTHON-2528 Remove Database.current_op 2021-08-04 11:14:50 -07:00
Shane Harvey
568205135e PYTHON-2855 Update mock server filename for KMS testing 2021-08-04 10:35:37 -07:00
Shane Harvey
f541e7731c
PYTHON-2602 Test that pool paused errors are retryable (#681)
Allow client_knobs to be used as a decorator.
2021-07-30 17:56:01 -07:00
Shane Harvey
97a84e199e
PYTHON-2697 Fix races in various CMAP spec tests (#685) 2021-07-29 17:25:15 -07:00
Prashant Mital
f86b2c6bf8
PYTHON-2827 Versioned API migration example for ecosystem docs (#687) 2021-07-29 17:17:22 -07:00
Prashant Mital
f3486d7ad7
PYTHON-2842 Integration tests for observeSensitiveCommands field (#684) 2021-07-29 15:32:53 -07:00
Prashant Mital
3f8c104157
PYTHON-2288 Remove IsMaster (#690) 2021-07-29 10:32:51 -07:00
Prashant Mital
0209e4a4a4
PYTHON-2571 Remove NotMasterError (#688) 2021-07-28 16:01:32 -07:00
Prashant Mital
70a1fec9a2
PYTHON-1363 Remove unused retrieved parameter from CommandCursor (#689) 2021-07-28 15:55:21 -07:00
Shane Harvey
a949142480
PYTHON-2816 Generate pip < 20.3 compatible manylinux wheels (#679)
Split old/new manylinux wheel generation into two tasks.
2021-07-28 14:45:43 -07:00
Shane Harvey
775bf923c9
PYTHON-2699 Emit PoolReadyEvent before resuming the background thread (#683) 2021-07-28 11:31:07 -07:00
Shane Harvey
7acb58be81
PYTHON-2750 Don't mark arbiter pools ready unless directly connected (#682) 2021-07-28 11:30:16 -07:00
Prashant Mital
f07da34f97
PYTHON-2545 Test Atlas Serverless (#664) 2021-07-27 16:35:09 -07:00
Shane Harvey
9833ce0a03
PYTHON-2802 Link to create command docs in create_collection (#678)
PYTHON-2840 Document "let" support for aggregation.
2021-07-26 15:26:51 -07:00
Shane Harvey
c93194a2e6 PYTHON-2838 Skip getlasterror test on >=5.0 2021-07-23 12:24:55 -07:00
Shane Harvey
01e34cebdb
PYTHON-2769 Test redaction of replies to security-sensitive commands (#676)
Resync command monitoring and unified test format tests.
Redact entire hello response when the command started contained speculativeAuthenticate.
Make OP_REPLY cursor.cursor_id always be an Int64.
2021-07-15 14:12:11 -07:00
Shane Harvey
9a4c64f325 Revert "PYTHON-2809 Skip Jython serverless test"
This reverts commit 72206a07d1.
2021-07-13 09:47:51 -07:00
Shane Harvey
72206a07d1 PYTHON-2809 Skip Jython serverless test 2021-07-13 09:44:22 -07:00
Shane Harvey
da49bd88a2
PYTHON-2806 Fix test_aggregate_raw_transaction (#673) 2021-07-12 16:54:50 -07:00
Shane Harvey
6d1ebf4597
PYTHON-2798 Workaround windows cert issue with SSL_CERT_FILE (#670) 2021-07-12 14:17:01 -07:00
Prashant Mital
948ebb27f4
PYTHON-2800 Add Atlas connectivity tests for MongoDB Serverless (#669) 2021-07-12 11:04:29 -07:00
Shane Harvey
834500de56
PYTHON-2608 Test that KMS TLS connections verify peer certificates (#667)
Use bash for all evergreen scripts.
2021-07-09 13:24:09 -07:00
Shane Harvey
98b64ee76b
PYTHON-2096 Validate that mongocryptd is not spawned if bypassAutoEncryption=true (#668) 2021-07-09 11:01:54 -07:00
Bernie Hackett
c8d920a46b PYTHON-2795 Improve host parsing and error messages 2021-07-08 14:22:56 -07:00
Prashant Mital
00ed2321ba
PYTHON-2475 Implement Atlas Data Lake prose specification tests (#665)
* PYTHON-2475 Add prose specification tests for Atlas Data Lake

* add prose tests

* Update evergreen config to bootstrap ADL

* add sleep before connecting to ADL

* print buildinfo

* print buildInfo in conditional block

* refactor skiplogic

* remove sleep

* fix debugging code

* Ensure ADL tests run

* ensure suite fails if not connected

* fix test failure

* improve data_lake variable extraction

* review changes
2021-07-07 23:55:52 -07:00
Prashant Mital
8675dc0ea1
PYTHON-2799 Use namespace returned from initial command response for killCursors (#666) 2021-07-07 15:24:49 -07:00
Bernie Hackett
dde28d78cb PYTHON-2393 Document unicode error handler for MongoClient 2021-07-06 16:47:42 -07:00
Bernie Hackett
907bb7e3dc PYTHON-2794 Fix up dots and dollars spec tests 2021-07-06 13:43:14 -07:00
Shane Harvey
a142125640
PYTHON-2775 Add docs for snapshot reads (#662) 2021-07-06 11:58:30 -07:00
Shane Harvey
fd845654fb
PYTHON-2776 Disable writes and other unsupported operations in snapshot reads (#660)
Rely on the server to report an error for unsupported snapshot read
operations by sending readConcern with all commands, even writes.
2021-06-30 20:01:43 -07:00
Prashant Mital
0e0c4fd944
PYTHON-2389 Add session support to find_raw_batches and aggregate_raw_batches (#658) 2021-06-30 19:14:22 -07:00
Shane Harvey
b823b95de1
PYTHON-2791 Ignore erroneous serviceId field for non-LB connections (#663) 2021-06-30 18:31:00 -07:00
Bernie Hackett
853155dd6a PYTHON-2790 Fix doctest setup in raw_bson 2021-06-30 13:27:06 -07:00
Prashant Mital
b991185fd7
PYTHON-2715 Use hello command for monitoring when supported (#654) 2021-06-30 13:21:44 -07:00
Bernie Hackett
88480299b7 PYTHON-2766 Warn users away from cursor slices 2021-06-29 18:10:48 -07:00
Shane Harvey
4152600ae6
PYTHON-2777 Raise client side error for snapshot reads on <5.0 (#659) 2021-06-29 14:40:48 -07:00
Bernie Hackett
748b9ce7b9 PYTHON-2575 Set cargo path for cryptography builds 2021-06-28 17:50:18 -07:00
Shane Harvey
354c96a414
PYTHON-2779 Fix topologies field in snapshot reads test (#657) 2021-06-28 15:11:52 -07:00
Bernie Hackett
a94504bde9 PYTHON-2726 Document read preference quirks 2021-06-28 13:08:07 -07:00
Shane Harvey
67ebd5cab4 PYTHON-2762 Remove duplicate unified sessions test 2021-06-25 16:24:30 -07:00
Shane Harvey
b4b7a07b81
PYTHON-2762 Avoid duplicating unified test files for LB testing (#649)
Create new client for each cursor/session __del__ test.
Always close cursors in spec tests.
2021-06-25 16:20:21 -07:00
Shane Harvey
14160aed04
PYTHON-2767 Support snapshot reads on secondaries (#656)
Add the MongoClient.start_session snapshot option.
2021-06-25 16:12:12 -07:00
Shane Harvey
a7921604f1
PYTHON-2768 Add SDAM and server selection spec tests for load balancers (#655) 2021-06-24 12:32:52 -07:00
Shane Harvey
ef6b06ce1f
PYTHON-2765 Fix test_exhaust failure due to OP_MSG and __del__ changes (#653) 2021-06-23 12:31:20 -07:00
Bernie Hackett
f11be6cfa6 PYTHON-2586 Changes to support Python 3.10 2021-06-23 11:21:41 -07:00
Prashant Mital
00f7fe8ce3
PYTHON-2748 Fix error in UUID example (#650) 2021-06-23 11:05:57 -07:00
Shane Harvey
6bc5e088af
PYTHON-1272 Fix deadlock when garbage collecting pinned cursors and sessions (#642)
It's not safe to return the pinned connection to the pool from within
Cursor.del because the Pool's lock may be held by a python thread
while the cyclic garbage collector runs. Instead we send the cursor
cleanup request to the client's background thread. The thread will
send killCursors on the pinned socket and then return the socket to
the pool.
Also fixed a similar bug when garbage collecting a pinned session.
2021-06-22 17:29:26 -07:00
Shane Harvey
3ef01179a2
PYTHON-2764 Fix unified test coerce_result on unack writes (#652) 2021-06-22 17:25:05 -07:00
Prashant Mital
a32259037f
PYTHON-2724 Add FAQ to PyMongo documentation pointing users to PyMongoArrow (#651) 2021-06-22 16:25:17 -07:00
Shane Harvey
6bebaf9015
PYTHON-2757 PYTHON-2730 Resync command monitoring killCursors tests (#643) 2021-06-22 15:35:50 -07:00
Shane Harvey
07146ceba7
PYTHON-2761 Don't return a pinned connection to the pool multiple times (#645) 2021-06-22 15:31:33 -07:00
Prashant Mital
ff6ca53328
PYTHON-2572 Introduce NotPrimaryError and deprecate NotMasterError (#646) 2021-06-22 13:24:07 -07:00
Bernie Hackett
640fee9d5d PYTHON-2556 Disable dots and dollars validation 2021-06-22 11:49:48 -07:00
Shane Harvey
4c77d7c855
PYTHON-2677 Better wait queue timeout errors for load balanced clusters (#639)
Remove checkout argument in favor of SocketInfo.pin_txn/pin_cursor()
2021-06-21 18:29:36 -07:00
Prashant Mital
59dc6d8ca0
PYTHON-2718 Test redaction of security sensitive command monitoring events (#637) 2021-06-21 18:07:28 -07:00
Bernie Hackett
abb081a012 PYTHON-2741 Test aggregate let support 2021-06-21 11:57:33 -07:00
Shrikant Sharat Kandula
cfbc3a7995
Fix typo in list_collections docstring (collectons -> collections) (#644) 2021-06-21 10:20:07 -07:00
Bernie Hackett
3de63373aa PYTHON-2553 Test document validation error details 2021-06-16 19:05:58 -07:00
Bernie Hackett
83adc9af03 PYTHON-2740 Bump maxWireVersion for MongoDB 5.0 2021-06-16 15:49:32 -07:00
Bernie Hackett
fd9391df5c PYTHON-2557 Timeseries collection support
This change also resolves PYTHON-2604.
2021-06-16 14:34:12 -07:00
Shane Harvey
a906e57a7c
PYTHON-2731 Run load balancer test suite with all Python versions (#640) 2021-06-16 12:09:15 -07:00
Shane Harvey
bf78a9b2ef
PYTHON-2744 Run LB tests against non-LB clusters (#638)
Fix serviceId fallback to make spec test pass.
Fix socket leak when SocketInfo connection handshake fails.
2021-06-15 14:30:01 -07:00
Shane Harvey
c8f32a7a37 PYTHON-2673 Connection pinning behavior for load balanced clusters (#630)
Tweak spec test because pymongo unpins cursors eagerly after errors.
Tweak spec test for PoolClearedEvent ordering when MongoDB handshake fails (see DRIVERS-1785).
Only skip killCursors for some error codes.
Rely on SDAM error handling to close the connection after a state change error.
Add service_id to various events.
Retain reference to pinned sockets to prevent premptive closure by CPython's cyclic GC.
2021-06-15 14:14:56 -07:00
Shane Harvey
7a48831124 PYTHON-2673 Add load balancer connection pinning spec tests 2021-06-15 14:12:28 -07:00
Shane Harvey
112ee69de8
PYTHON-2674 Pool.reset only clears connections to the given serviceId (#628) 2021-06-15 09:52:30 -07:00
Tyler Willey
9c1ff6ad9d PYTHON-2743 Fix compatibility with gevent.Timeout (#633)
gevent.Timeout extends BaseException, not Exception.
2021-06-15 09:33:09 -07:00
Prashant Mital
b69d00d21b
PYTHON-2734 Document that find_raw_batches now sends user-specified R… (#634)
* PYTHON-2734 Document that find_raw_batches now sends user-specified ReadConcern to the server instead of raising ConfigurationError

* fix

* fix2

* fix 3
2021-06-08 14:13:43 -07:00
Prashant Mital
048f54ddde
PYTHON-2710 Version API connection examples for ecosystem docs (#636)
* PYTHON-2710 Version API connection examples for ecosystem docs

* fix

* more fixes
2021-06-08 14:07:53 -07:00
Prashant Mital
c36ec37281
PYTHON-2727 Test against MongoDB 5.0 in Evergreen (#631) 2021-06-07 12:12:49 -07:00
Prashant Mital
d26bf933ed
PYTHON-1636 Support exhaust cursors in OP_MSG (#629) 2021-05-27 17:16:50 -07:00
Shane Harvey
93ac5e0277
PYTHON-2676 Add load balancer tests in EVG (#625)
Add load balancer spec tests
Ensure LB supports retryable reads/writes
Add assertNumberConnectionsCheckedOut, createFindCursor, ignoreResultAndError
Add PoolClearedEvent.service_id and fix isClientError unified test assertion
2021-05-27 15:05:26 -07:00
Shane Harvey
21c92b13cf
PYTHON-2729 PYTHON-2721 PYTHON-2730 Make 5.0 tests green (#626)
Update explain response format parsing for 5.0.
Temporarily skip failing regex and killCursors tests on 5.0.
2021-05-24 10:03:43 -07:00
Prashant Mital
209d5009e6
PYTHON-1860 Use OP_MSG for find/aggregate_raw_batches when supported (#622) 2021-05-19 12:05:35 -07:00
Shane Harvey
5bf15c8e18
PYTHON-2672 SDAM, CMAP, and server selection changes for load balancers (#621)
Disable SRV Polling, SDAM compatibility check, logicalSessionTimeoutMinutes check.
server session pool pruning, server selection, and server monitoring.
A ServerType of LoadBalancer MUST be considered a data-bearing server.
"drivers MUST emit the following series of SDAM events" section.
Send loadBalanced:True with handshakes, validate serviceId.
Add topologyVersion fallback when serviceId is missing.
Don't mark load balancers unknown.
2021-05-18 14:12:49 -07:00
Shane Harvey
2a74601572
PYTHON-2676 Unified Test Runner changes in preparation for Load Balancer Support (#623)
Resync crud, change stream, SDAM, server_selection, transactions, uri-options, tests.
PYTHON-2348 Correctly express lack of event assertions in change stream tests.
2021-05-18 10:20:36 -07:00
Shane Harvey
e221b49dfc
PYTHON-2684 Send Versioned API options with getMore+txn commands (#618) 2021-05-17 15:26:50 -07:00
Prashant Mital
048ee81836
PYTHON-2719 RawBatchCursor must raise StopIteration instead of returning empty bytes when the cursor contains no results (#624) 2021-05-17 13:58:06 -07:00
Prashant Mital
ac61cf87a9
PYTHON-2662 Deprecate database profiler helpers (#617) 2021-05-10 16:47:28 -07:00
Shane Harvey
f64b563d9e
PYTHON-2629 Use hello command when API Version is declared (#610)
PYTHON-2697 Update CMAP runner to ignore extra events
2021-05-10 14:33:51 -07:00
Prashant Mital
6e1009e8b6
PYTHON-2396 Deprecate ssl_keyfile and ssl_certfile URI options (#616) 2021-05-05 15:50:01 -07:00
Shane Harvey
2c41c6fe95
PYTHON-2671 Support loadBalanced URI option (#614)
Add workaround in test_dns until PYTHON-2679 is completed.
2021-05-05 12:51:05 -07:00
Shane Harvey
0535f5d829
PYTHON-2678 Resync SRV spec tests (#613)
Add support for validating parsed_options and running non-TLS tests.
2021-05-04 10:51:58 -07:00
Shane Harvey
1390283a5d
PYTHON-2658 Remove NPS survey (#615) 2021-04-30 14:20:10 -07:00
Shane Harvey
acfa7b615c
PYTHON-2667 Fix SRV support when running with eventlet (#612) 2021-04-28 15:09:56 -07:00
Shane Harvey
14ac9a3fde
PYTHON-2547 Change estimated_document_count() to use $collStats instead of count on 4.9+ (#606)
Fix CRUD v1 aggregate $out change for
3f3a3c225d
PYTHON-2301 ValueError is an acceptable error for CRUD v2 error:true tests
2021-04-28 15:02:06 -07:00
Shane Harvey
61c6876872
PYTHON-2635 Unpin sessions after all abortTransaction attempts (#609)
Add unified test runner for transactions.
2021-04-28 12:38:13 -07:00
Shane Harvey
a44e719dca
PYTHON-2533 Add support for sample_rate and filter in set_profiling_level (#605) 2021-04-28 12:18:54 -07:00
Shane Harvey
6412fed059
PYTHON-2634 Skip arbiter tests when no server is running (#611) 2021-04-27 15:52:55 -07:00
Shane Harvey
7c85710208
PYTHON-2570 Resync unified tests version 1.1 or lower (#601) 2021-04-27 14:00:21 -07:00
Shane Harvey
0f8f9da2b8
PYTHON-2624 Increase serverSelectionTimeoutMS for mongocryptd connection (#604) 2021-04-27 12:54:38 -07:00
Shane Harvey
93046431df
PYTHON-2603 Standardize on ubuntu1804 zseries, power8, and arm64 (#600)
PYTHON-2647 Fix test_use_openssl_when_available when service_identity<18.1 is installed
2021-04-27 11:00:20 -07:00
Khanh Nguyen
61ab9caa6c
docs: Update link to sphinx website (#608) 2021-04-26 13:55:29 -07:00
Khanh Nguyen
5388fde214
PYTHON-2605: Improve mongodb+srv:// error message when dnspython is not installed (#602) 2021-04-26 08:18:51 -07:00
Shane Harvey
cd823c8ed1
PYTHON-2600 Resync spec tests for versioned api (#599)
Also resolves PYTHON-2599 and PYTHON-2641.
2021-04-23 15:11:35 -07:00
Janosh Riebesell
fac0372ba0
PYTHON-2364 Replace deprecated dns.resolver.query with dns.resolver.resolve (#598)
Fall back to dns.resolver.query for dns v1 compat.
2021-04-23 12:48:09 -07:00
Khanh Nguyen
1818553fc9
PYTHON-1880: Raise a warning when no_cursor_timeout is used with an implicit session (#594) 2021-04-23 10:58:25 -07:00
Prashant Mital
d06f3f3504
PYTHON-2234 Only rely on standard library in daemon.py (#597) 2021-04-21 15:51:41 -07:00
William Zhou
aaba51d927
PYTHON-2234: When mongocryptd spawn fails, the driver does not indicate what it tried to spawn (#591) 2021-04-21 12:20:53 -07:00
Shane Harvey
b978827414
PYTHON-2584 Use large localThresholdMS to fix test_load_balancing (#595) 2021-04-21 12:04:59 -07:00
William Zhou
85f9f7a8a1
PYTHON-2397: MongoClient(ssl=True, tls=False) fails with an AttributeError (#592) 2021-04-21 11:32:50 -07:00
Shane Harvey
4c7718eb5a
PYTHON-2634 Only update pools for data-bearing servers (#590)
Fixes a noisy OperationFailure: Authentication failed error.
Do not attempt to create unneeded connections to arbiters, ghosts,
hidden members, or unknown members.
2021-04-19 13:24:54 -07:00
Shane Harvey
cc029a1e62
PYTHON-2631 Add missing error message to InvalidBSON error (#589) 2021-04-02 10:17:04 -07:00
Shane Harvey
c0321ef2c5
PYTHON-2630 Statically initialize Py_buffer to avoid false positives in Coverity (#588) 2021-04-02 10:09:27 -07:00
Prashant Mital
1882e99f77
PYTHON-2536 Document versioned API usage (#584) 2021-03-31 11:31:06 -05:00
William Zhou
97bad5a653
PYTHON-2628: Fix 'encryption::create_data_key` docstring to use existing algorithm 2021-03-30 15:37:31 -07:00
William Zhou
0752280ada
PYTHON-2480: Add MongoClient helper to access the current TopologyDescription (#583) 2021-03-25 10:14:16 -07:00
William Zhou
94f4de1f2e
PYTHON-1690: Fix error message when insert_many is given a single RawBSONDocument instead of a list (#580) 2021-03-22 11:13:42 -07:00
Shane Harvey
80adc13195
PYTHON-2615 Reinstate TLS network timeout workaround due to eventlet (#581)
PYTHON-2616 Fix test_network_error_message when TLS is enabled.
2021-03-19 21:47:53 -07:00
William Zhou
8ef4524076
PYTHON-1359: Add Example for RawBSONDocument (#578)
Add doctest/example for inserting/retrieving RawBSONDocument
2021-03-17 16:15:22 -07:00
Shane Harvey
92a7433035
PYTHON-2580 Provide explicit guidance on handling command errors during the handshake (#571)
Command errors during the handshake MUST use SDAM error handling rules.
Mark server unknown after auth failures.
Test network timeout errors pre/post auth.
PoolClearedError MUST NOT mark the server Unknown.
Add "authEnabled" runOn requirement for SDAM integration tests.
2021-03-16 12:51:30 -07:00
Prashant Mital
ec6337e3a7
PYTHON-2583 Bump minimum required PyMongoCrypt version to 1.1.0 (#576) 2021-03-09 12:33:12 -08:00
Shane Harvey
de7c7b8be2
PYTHON-2544 Do not check error messages when an error code is present (#574)
Add 10058 as a "not master" error code to account for MongoDB<=3.2 errors.
2021-03-04 10:03:52 -08:00
Prashant Mital
77ad2737fa
PYTHON-2591 Use server toolchain Python on Ubuntu-16 with x86-64, arm64, power8 (#573)
PYTHON-2590 Use server toolchain RHEL 7.2 ZSeries (#573)
2021-03-04 09:23:37 -08:00
Shane Harvey
4364b7c43a
PYTHON-2596 Include host in error message when connection is closed (#575)
Use raise from syntax when re-raising exceptions in the pool.
2021-03-03 16:33:42 -08:00
Prashant Mital
4088c1cee0
Python 2548/add update description.truncated arrays field (#572) 2021-03-02 11:06:56 -08:00
Shane Harvey
20d5a9cf81
PYTHON-2543 Do not mark a server unknown from a "writeErrors" response (#570) 2021-03-01 14:09:27 -08:00
Prashant Mital
3e97712728
PYTHON-2472 add a metadataClient for CSFLE (#539) 2021-03-01 11:38:10 -08:00
Bernie Hackett
87e76bda5d PYTHON-2341 Migrate testing to Amazon1
Also fixes PYTHON-2008, testing mod_wsgi with newer Python versions.
Also adds PyPy 3.7 to the test matrix.
2021-02-25 15:26:02 -08:00
Shane Harvey
99a4f28450
PYTHON-2539 Test AWS temporary credentials via "sessionToken" for CSFLE (#569) 2021-02-18 08:52:36 -08:00
Shane Harvey
95974617bd
PYTHON-1314 Remove Database.authenticate and Database.logout (#568) 2021-02-17 14:16:07 -08:00
Shane Harvey
c15028a6c7
PYTHON-2578 Improve clarity of TLS settings for KMS requests (#567)
Note that cert_reqs=None and cert_reqs=CERT_REQUIRED are identical
so this does not change any behavior.
2021-02-11 16:00:48 -08:00
Bernie Hackett
913860334e PYTHON-2386 Drop support for Python 3.5 2021-02-03 16:33:36 -08:00
Shane Harvey
0217ba32bd
PYTHON-1974 Remove manylinux containers only needed for 3.4 (#566) 2021-02-03 16:01:31 -08:00
Shane Harvey
846e925280
PYTHON-2537 Fix benchmark when using Python 3 (#565) 2021-02-03 13:16:18 -08:00
Shane Harvey
7ca1efda43 PYTHON-2445 Use new setup script for MONGODB-AWS testing 2021-01-29 12:49:56 -08:00
Bernie Hackett
70b927a01d PYTHON-2508 Improve PyOpenSSL on Windows and macOS 2021-01-28 16:02:51 -08:00
Shane Harvey
6ff2883f82
PYTHON-2445 PYTHON-2530 Fix MONGODB-AWS auth tests (#562) 2021-01-27 13:08:44 -08:00
Bernie Hackett
96b75808d1 PYTHON-2133 Remove py2 support from extensions 2021-01-26 14:26:03 -08:00
Shane Harvey
2565b4d291
PYTHON-1312 Remove Database.add_user and Database.remove_user (#561) 2021-01-26 12:49:49 -08:00
Bernie Hackett
1cf8eb31b5 PYTHON-2505 Use match_hostname from the ssl module 2021-01-26 12:36:45 -08:00
Shane Harvey
ab35e0df7f
PYTHON-1326 Remove the "useCursor" aggregate option (#560) 2021-01-26 10:46:35 -08:00
Shane Harvey
ac4bacb66c
PYTHON-1323 Removed Collection.group (#559) 2021-01-25 17:07:48 -08:00
Shane Harvey
7c1060cfec
PYTHON-1307 Remove SONManipulator APIs (#557) 2021-01-25 16:22:00 -08:00
Bernie Hackett
cf877e95c7 PYTHON-2503 Always use time.monotonic
For monotonic time needs.
2021-01-25 12:48:31 -08:00
Shane Harvey
e01d9a37e7
PYTHON-1320 Remove legacy CRUD methods (#556)
Remove save, insert, update, remove, and find_and_modify.
Remove tools/benchmark.py
2021-01-22 17:11:15 -08:00
Bernie Hackett
1f1670cc35 PYTHON-1974 Drop support for Python 3.4 2021-01-22 15:54:26 -08:00
Bernie Hackett
521f7b9af4 PYTHON-2133 Fix up docs
And finish deleting python 2 specific code.
2021-01-21 15:49:23 -08:00
Shane Harvey
c65b89d8a1
PYTHON-1319 Remove Collection.ensure_index and reindex (#555) 2021-01-21 11:25:19 -08:00
Shane Harvey
454d77b783
PYTHON-1309 Remove helpers for getLastError (#554)
Remove Database.error, Database.last_status, Database.previous_error,
and Database.reset_error_history.
2021-01-20 16:38:07 -08:00
Bernie Hackett
e17299ab2e PYTHON-2133 Remove u prefixes from code 2021-01-20 16:10:23 -08:00
Shane Harvey
02abb6d584
PYTHON-2516 Fix coverage task and C extension check (#553) 2021-01-20 15:04:33 -08:00
Bernie Hackett
a72e8b8823 PYTHON-2133 Remove py2 support from test
Also delete bson/py3compat.py
2021-01-20 09:40:36 -08:00
Bernie Hackett
6c2d629006 PYTHON-2133 Remove Py2 compatibility from pymongo 2021-01-19 21:15:20 -08:00
Bernie Hackett
88bb1b4608 PYTHON-2133 Remove Py2 compatibility from gridfs 2021-01-19 21:08:27 -08:00
Shane Harvey
da620c7671 PYTHON-2506 Fix versioned API test for db.aggregate 2021-01-19 12:42:55 -08:00
Shane Harvey
0e250bef75
PYTHON-1301/PYTHON-1302/PYTHON-1588 Remove deprecated cursor manager APIs (#550)
Remove MongoClient.set_cursor_manager and pymongo.cursor_manager.
Remove MongoClient.kill_cursors and MongoClient.close_cursor.

Co-authored-by: kAldown <kaldownb@gmail.com>
2021-01-15 17:52:54 -08:00
Shane Harvey
56925fd97f
PYTHON-1321 Remove MongoReplicaSetClient (#552) 2021-01-15 17:11:15 -08:00
Shane Harvey
6e8c3708b8
PYTHON-1587 Remove MongoClient.database_names and Database.collection_names (#551) 2021-01-15 16:53:42 -08:00
Shane Harvey
773767900c
PYTHON-2502 Remove Python 2.7 from release scripts (#548)
PYTHON-1300 Stop shipping .egg files.
PYTHON-2507 Future proof pip version upgrade.
2021-01-15 14:32:35 -08:00
Shane Harvey
3c899aeb89
PYTHON-1592 Remove Collection.parallel_scan (#547) 2021-01-15 14:01:45 -08:00
Shane Harvey
387bfa0bfa
PYTHON-2310 Remove MongoClient.fsync, unlock, and is_locked (#546) 2021-01-15 11:29:23 -08:00
Bernie Hackett
c70071df1d PYTHON-2133 Remove Py2 compatibility from bson 2021-01-14 14:57:20 -08:00
Shane Harvey
112812928b
PYTHON-2482 Test Versioned API with a server started with acceptAPIVersion2 (#545) 2021-01-14 14:08:58 -08:00
Bernie Hackett
dea4b90193 PYTHON-2133 Drop install support for Python 2 2021-01-14 09:53:24 -08:00
Bernie Hackett
fb4c20adfa PYTHON-2133 - Stop testing Python 2.7 on Evergreen 2021-01-13 16:30:21 -08:00
Shane Harvey
06924cb00b
PYTHON-2489 Fix "no server" test suite, fix unified test runCommand (#543) 2021-01-13 14:29:58 -08:00
Alexander Golin
dad9813b1d
PYTHON-2455 Change DOCS to DOCSP and replace example link accordingly (#544) 2021-01-12 13:12:50 -08:00
Shane Harvey
b3c26a7f99
PYTHON-1316 Remove eval, system_js, and SystemJS (#542) 2021-01-11 18:41:36 -08:00
Shane Harvey
55eef0e3be
PYTHON-2455 Add DOCS ticket step to release checklist (#541) 2021-01-11 18:35:02 -08:00
Shane Harvey
ac2f506ba2
PYTHON-2453 Add MongoDB Versioned API (#536)
Add pymongo.server_api.ServerApi and the MongoClient server_api option.
Support Unified Test Format version 1.1 (serverParameters in
runOnRequirements)
Skip dropRole tests due to SERVER-53499.
2021-01-11 18:16:00 -08:00
Shane Harvey
c96c5a9453
PYTHON-2388 Begin PyMongo 4.0 migration guide (#540) 2021-01-11 18:12:13 -08:00
Shane Harvey
86b40c195d
PYTHON-2462 Avoid connection storms: implement pool PAUSED state (#531)
Mark server unknown and clear the pool when background connections fail.
Eagerly evict threads from the wait queue when pool is paused. Evicted
threads will raise the following error:
AutoReconnect('localhost:27017: connection pool paused')
Introduce PoolClearedEvent and ConnectionPoolListener.pool_ready.

CMAP spec test changes:
- CMAP unit tests should not use real monitors
- Assert that CMAP threads complete all scheduled operations
2021-01-06 15:15:37 -08:00
Shane Harvey
a9d668c3b9
PYTHON-1878 Add mongodb+srv URIs to Atlas Connectivity tests (#538)
Enable xtrace with silent:false to make test failures easier to diagnose.
2021-01-06 12:50:36 -08:00
Prashant Mital
6b0123594a
PYTHON-2033 Unified Test Format (#519) 2020-12-21 19:22:29 -08:00
Shane Harvey
2eecf525d9
PYTHON-2474 Fix non-disabled client_knobs bug in Data Lake tests (#537) 2020-12-21 15:54:02 -10:00
Prashant Mital
c673d8b3ce
PYTHON-2318 Atlas Data Lake testing (#500) 2020-12-17 13:58:03 -08:00
Pascal Corpet
733ab2527b
PYTHON-2466 Make pymongo client, database and collection objects hashable. (#533) 2020-12-16 19:44:56 -08:00
Shane Harvey
eb5bd9c858 PYTHON-2441 Reduce false positives in test_continuous_network_errors 2020-12-16 17:08:34 -10:00
Shane Harvey
3ecd9479d4
PYTHON-2366 Test OCSP+FLE with Python 3.9 (#534)
PYTHON-2449 Move all pypy cryptography/pyopenssl testing to Debian 9.2 with OpenSSL 1.1.0f
PYTHON-2449 Fix Windows cryptography installation by upgrading pip and using --prefer-binary
2020-12-16 15:32:25 -10:00
Prashant Mital
f458473925
PYTHON-2452 Ensure command-responses with RetryableWriteError label are retried on MongoDB 4.4+ (#530) 2020-12-14 19:03:19 -08:00
Shane Harvey
61232b7f21
PYTHON-2457 Test that clients wait 500ms between failed heartbeat checks (#524) 2020-12-08 09:37:36 -10:00
Shane Harvey
e95d2187b6
PYTHON-2395 Consider connection pool health during server selection (#515)
Change the driver to maintain a count of in-progress operations to each
server (per client). When selecting a mongos server, the driver now picks
2 suitable servers at random and selects the server with fewer in-progress
operations. Previously, the driver selected a mongos server at random.
The new behavior is intended to route operations away from unhealthy or
slow servers in highly concurrent single client workloads.

PYTHON-2460 Only reset Pool.active_sockets to 0 after a fork()
2020-12-07 10:41:39 -10:00
Shane Harvey
ac07e0f4e2
PYTHON-2447 Fix race in CMAP maxConnecting test (#529) 2020-12-07 08:59:33 -10:00
Shane Harvey
5625860688
PYTHON-2443 Fix TypeError when pyOpenSSL socket has timeout of None (#527) 2020-12-01 07:57:30 -10:00
Prashant Mital
4119d35d04
PYTHON-2440 Workaround namedtuple._asdict() bug on Python 3.4 (#525) 2020-11-24 12:11:22 -08:00
Shane Harvey
807ab5ac9c
PYTHON-2363 Skip CMAP test when failCommand is not supported (#523) 2020-11-23 18:46:58 -08:00
Shane Harvey
d1fd3f7e98
PYTHON-2363 Rate limit new connection creations via maxConnecting (#511)
At most 2 connections can be in the pending state per connection pool.
The pending state covers all the work required to setup a new connection
including TCP, TLS, and MongoDB authentication. For example, if two
threads are currently creating connections, a third thread will wait for
either an existing connection to be checked back into the pool or for
one of the two threads to finish creating a connection.

The change reduces the likelihood of connection storms and improves the
driver's ability to reuse existing connections.
2020-11-23 15:55:54 -08:00
Pascal Corpet
86d58113e5
PYTHON-2438 Fix str representation of BulkWriteError (#522) 2020-11-23 09:46:33 -08:00
Shane Harvey
92aed33694 PYTHON-2433 Skip test_continuous_network_errors on Jython 2020-11-20 22:20:09 -08:00
Shane Harvey
22a7e8085c
PYTHON-2431 Fix MONGODB-AWS auth tests on macOS (#521) 2020-11-20 21:45:42 -08:00
Shane Harvey
6c92e6c67e
PYTHON-2433 Fix Python 3 ServerDescription/Exception memory leak (#520)
When the SDAM monitor check fails, a ServerDescription is created from
the exception. This exception is kept alive via the
ServerDescription.error field. Unfortunately, the exception's traceback
contains a reference to the previous ServerDescription. Altogether this
means that each consecutively failing check leaks memory by building an
ever growing chain of ServerDescription -> Exception -> Traceback ->
Frame -> ServerDescription -> ... objects.

This change breaks the chain and prevents the memory leak by clearing
the Exception's __traceback__, __context__, and __cause__ fields.
2020-11-20 18:58:47 -08:00
Shane Harvey
4928b9088d PYTHON-2436 Skip failing bulk insert test on 4.8+ 2020-11-20 12:14:11 -08:00
Shane Harvey
ce40d1191e BUMP 4.0.dev0 2020-11-20 10:32:08 -08:00
Prashant Mital
1d651b9be8
BUMP 3.11.1 (#516) 2020-11-16 16:01:14 -08:00
Shane Harvey
17dca5c504 Revert "PYTHON-1915: Prohibit copying ClientSession objects (#480)"
This reverts commit 959039b213.
2020-11-16 15:09:31 -08:00
Shane Harvey
30523d282c
PYTHON-2415 Fix pickle support for BulkWriteError exceptions (#514) 2020-11-12 11:04:55 -08:00
Shane Harvey
f1f8cad86d
PYTHON-2403 Add macOS Python 3.9 release automation (#513) 2020-11-10 12:21:36 -08:00
Shane Harvey
98205b8384
PYTHON-2421 Stop testing geoSearch/geoHaystack on MongoDB 4.5+ (#512) 2020-11-05 16:22:23 -08:00
Chris Cho
c92e5520b5
DOP-1671: update GTM code (#507) 2020-11-04 14:00:57 -08:00
Prashant Mital
b009ad7b20
PYTHON-2416 Properly close client in test_encryption.TestDataKeyDoubleEncryption (#510) 2020-11-04 10:04:30 -08:00
Prashant Mital
1e2a52fe8b
PYTHON-2404 Update CSFLE spec tests for KMS providers 'azure' and 'gcp' (#509) 2020-11-04 07:59:54 -08:00
Prashant Mital
e49c418264
PYTHON-2371 Add Azure and GCP support for CSFLE (#506) 2020-10-29 13:44:04 -07:00
Prashant Mital
a7710210a7
PYTHON-1960 Use a virtualenv to run encryption tests (#508) 2020-10-28 20:20:48 -07:00
Shane Harvey
c8be79f4a8
PYTHON-2367 Add release automation for Python 3.9 (#505)
PYTHON-2375 Reinstate macos system python workaround for missing wheel package
Increase task timeout because the manylinux build task takes >30 minutes.
2020-10-21 13:27:00 -07:00
Shane Harvey
e340428f24 PYTHON-2402 Update suse12-test to suse12-sp5-small 2020-10-21 12:29:12 -07:00
Shane Harvey
b210bffc75
PYTHON-2344 Update TLS examples to use unified TLS URI options (#504) 2020-10-19 15:22:28 -07:00
Martin Uhrin
7f1644c6db
Added the mincePy ODM library to documented tools (#502) 2020-10-16 15:16:52 -07:00
Shane Harvey
87e1d4b967
Revert "PYTHON-2362 Use dnspython<2.0 to avoid timeouts (#484)" (#501)
This reverts commit c549740677.
2020-10-14 16:08:43 -07:00
Nick Loadholtes
1002938a8e
Fix maxIdleTimeMS typo in docs (#503) 2020-10-14 09:48:06 -07:00
Shane Harvey
2818a32855
PYTHON-2392 Implicit sessions should always be discarded after connection errors (#498)
PYTHON-2075 Add more sessions tests with more read and write commands
2020-10-12 12:21:45 -07:00
Shane Harvey
d3e66a6702
PYTHON-2308 Test that we exclusively depend on existence of logicalSessionsTimeoutMinutes for sessions support (#499) 2020-10-08 10:13:42 -07:00
Shane Harvey
337a08c43d
PYTHON-2360 Ensure ConnectionCreatedEvents are emitted before ConnectionReadyEvents (#493)
Connections created in the background (for minPoolSize) are authenticated.
2020-10-06 11:37:27 -07:00
Prashant Mital
594b211ff1
PYTHON-2382 Destroy codec options struct in _cbson._element_to_dict (#496) 2020-10-06 11:01:11 -07:00
Shane Harvey
1c2651be58
PYTHON-2357 Specify error label in retryable writes test (#494)
PYTHON-2356 Add errorLabelsContain/errorLabelsOmit support to retryable writes tests
2020-10-02 12:56:33 -07:00
Shane Harvey
b2fba416e9
PYTHON-2342 Prefer checking error codes over error messages (#492) 2020-10-02 11:30:39 -07:00
Prashant Mital
65699332c4
PYTHON-2376 Fix change stream test failures due to new updateDescription.truncatedArrays field in changeEvent documents (#489) 2020-09-28 15:55:07 -07:00
Shane Harvey
8afbc645a7
PYTHON-2375 Remove macos system python workaround for missing wheel package (#491) 2020-09-28 15:00:40 -07:00
Shane Harvey
cccf37f556
PYTHON-1631 Document new release process (#488) 2020-09-22 10:39:01 -07:00
Shane Harvey
8e7026a83f
PYTHON-2345 Ensure release files can be installed (#487) 2020-09-17 14:00:05 -07:00
Shane Harvey
e1915fc89b
PYTHON-2372 Build macOS releases in Evergreen (#486) 2020-09-15 09:06:19 -07:00
Shane Harvey
1b97eddfbd
PYTHON-2262 Test Python 3.9 in Evergreen (#485) 2020-09-14 11:45:36 -07:00
Shane Harvey
c549740677
PYTHON-2362 Use dnspython<2.0 to avoid timeouts (#484) 2020-09-11 11:35:31 -07:00
Prashant Mital
dc94ca628e
PYTHON-2361 Support parsing as extended JSON representation for subtype 4 binary (#483) 2020-09-09 17:24:29 -07:00
Prashant Mital
963759af33
PYTHON-2354 Add support for JSONOptions.with_options (#482) 2020-09-09 14:15:21 -07:00
Shane Harvey
4a12caae0a
PYTHON-2351 Update sdam monitoring tests with directConnection uri option (#481) 2020-08-28 10:56:15 -07:00
ishmum123
959039b213
PYTHON-1915: Prohibit copying ClientSession objects (#480) 2020-08-21 11:10:40 -07:00
Shane Harvey
031492aefe
PYTHON-2339 Build manylinux2014_aarch64/ppc64le/s390x releases (#478) 2020-08-14 16:41:27 -07:00
Shane Harvey
7903a1c4e1
PYTHON-2332 Skip threaded SDAM tests when cdecimal is monkey patched (#477)
Add 60 second timeout for joining threads in SDAM tests.
2020-08-12 14:55:19 -07:00
Shane Harvey
add995feb4 BUMP 3.11.1.dev1 2020-07-30 14:04:10 -07:00
Shane Harvey
31949fb7e5 BUMP 3.11 (with proper changelog title) 2020-07-30 13:45:25 -07:00
Shane Harvey
316830d7b5 BUMP 3.11.1.dev0 2020-07-30 13:27:09 -07:00
Shane Harvey
9fa94db01a
BUMP 3.11 (#476) 2020-07-30 13:24:44 -07:00
Shane Harvey
c99254fe97
PYTHON-2334 Add regression test for gevent.Timeout compatibility (#475)
Use with statement in Semaphore.release.
2020-07-29 18:05:18 -07:00
TylerWilley
83578dc35f
PYTHON-2334: Fix gevent.Timeout race condition (#472)
If gevent raises a Timeout during self.lock acquisition, a _socket_semaphore count will be lost.
Using "with" will release the condition even on exception being raised.
2020-07-29 16:17:38 -07:00
Prashant Mital
ff327b3e31
PYTHON-2252 Add examples and documentation for new UUID behavior (#467) 2020-07-29 14:46:48 -07:00
Prashant Mital
de1e29305c
PYTHON-2219 Document hidden index option (#474) 2020-07-29 11:26:50 -07:00
Shane Harvey
c92150d177
PYTHON-1631 Automate release wheels for Windows and manylinux (#473) 2020-07-27 17:20:43 -07:00
Shane Harvey
b04e3343cb
PYTHON-2328 Reset the connection pool in Topology.on_change (#470)
PYTHON-2304 Ensure _RttMonitor closes socket on when the client is closed
2020-07-27 13:27:05 -07:00
Shane Harvey
c16b5b95a1
PYTHON-2331 Fix set_memory_error complier warning (#469)
bson/buffer.c:36:13: warning: function declaration isn’t a prototype [-Wstrict-prototypes]
   36 | static void set_memory_error() {
      |             ^~~~~~~~~~~~~~~~
2020-07-27 11:27:08 -07:00
Shane Harvey
7a539f227a
PYTHON-2294 Resync SDAM spec tests to workaround slow elections Windows and macOS (#468)
PYTHON-2296 Test behavior of connectTimeoutMS=0 with streaming protocol
PYTHON-2311 Workaround inherent race in flaky streaming protocol test
2020-07-22 11:49:57 -07:00
Prashant Mital
98f8470b5b
PYTHON-2306 Test that change streams don't resume from ElectionInProgress (#465) 2020-07-16 18:18:19 -07:00
Prashant Mital
9b69338ef4
BUMP 3.11.0rc1.dev0 2020-07-15 11:07:23 -07:00
Prashant Mital
63574b9360
BUMP 3.11.0rc0 2020-07-15 11:03:59 -07:00
Shane Harvey
b6bf4f0157
PYTHON-2320 Use select instead of poll on Jython (#466) 2020-07-15 08:55:42 -07:00
Prashant Mital
05267fb465
PYTHON-2315 Special case resuming change streams from CursorNotFound errors (#463) 2020-07-13 11:03:29 -07:00
Prashant Mital
f24e165336
PYTHON-2263 Respect UuidRepresentation.UNSPECIFIED when parsing $uuid fields in extended JSON (#464) 2020-07-13 11:03:02 -07:00
Julius Park
f80c82453b
PYTHON-2076: Add example event loggers (#449)
Added example event loggers and documentation for them to make it easier for users to start using listeners in their code.
JIRA ticket: https://jira.mongodb.org/browse/PYTHON-2076
2020-07-09 21:32:25 -04:00
Shane Harvey
64f77068e1
PYTHON-1438 Mark a server unknown when connection handshake fails with a network timeout error (#461) 2020-07-08 17:46:07 -07:00
Shane Harvey
3c1dd61ae9
PYTHON-2256 Document that a ClientSession cannot be used for multiple operations concurrently (#460) 2020-07-08 17:40:02 -07:00
Shane Harvey
e3f40c30ad
PYTHON-2165 Deprecate MongoClient is_locked, fsync, and unlock helpers (#459) 2020-07-08 17:18:02 -07:00
Prashant Mital
426f5fdef7
PYTHON-2292 Fix failing doctest due to UuidRepresentation (#458)
PYTHON-2277 Remove UuidRepresentation DeprecationWarning
2020-07-08 15:45:25 -07:00
Prashant Mital
065001ef2e
PYTHON-2305 Cache postBatchResumeToken when an aggregate command returns an empty firstBatch (#456) 2020-07-08 14:51:17 -07:00
Shane Harvey
1c29c1a65e
PYTHON-2299 Add the "awaited" field to heartbeat events (#457) 2020-07-08 14:02:34 -07:00
Shane Harvey
5d92b2f552
PYTHON-2243 Raise informative error message when attempting a GridFS operation in a transaction (#454) 2020-07-07 18:55:17 -07:00
Shane Harvey
7e2790cc44
PYTHON-2220 Mention Atlas Search in documentation (#455) 2020-07-07 16:16:21 -07:00
Shane Harvey
a1de506b7e
PYTHON-2282 Resync maxStalenessSeconds spec tests (#452) 2020-07-07 15:17:23 -07:00
Shane Harvey
c2d6343110
PYTHON-2163 Suppress ragged EOFs when using pyOpenSSL to match the stdlib (#453)
Wrap pyOpenSSL connection errors with AutoReconnect.
2020-07-02 14:17:20 -07:00
Julius Park
a075eb798f
PYTHON-1787: fix NotMasterError no attribute error (#450) 2020-07-02 13:53:08 -04:00
Shane Harvey
4457714d1b
PYTHON-2082 Unpin session after RetryableWriteErrors from commitTransaction (#451)
PYTHON-2154 PYTHON-2189 Remove 4.5 transaction test workarounds
2020-07-01 18:32:58 -07:00
Prashant Mital
26913ea8e1
PYTHON-2143 Use an allow-list to determine resumable change stream errors (#445) 2020-07-01 18:12:05 -07:00
Prashant Mital
04926c6ccd
fix monitor failure 2020-07-01 17:52:35 -07:00
Prashant Mital
e23d019f9e
remove unnecessary changes 2020-07-01 17:24:41 -07:00
Prashant Mital
d97a43ea9b
cleanup 2020-07-01 16:58:56 -07:00
Prashant Mital
8e3fd0040e
cruft removal 2 2020-07-01 16:49:36 -07:00
Prashant Mital
dd23624100
handle None case 2020-07-01 16:47:36 -07:00
Prashant Mital
14cecab393
cleanup cruft 2020-07-01 16:47:36 -07:00
Prashant Mital
956ce3d4b0
Incorporate review changes 2020-07-01 16:47:33 -07:00
Prashant Mital
9fc7ed1e11
PYTHON-2143 Use an allow-list to determine resumable change stream errors 2020-07-01 16:43:27 -07:00
Shane Harvey
1f4123e4bf PYTHON-2123 Streaming heartbeat protocol
MongoClient now requires 2 connections and 2 threads to each MongoDB 4.4+ server.
With one connection, the server streams (or pushes) updated heartbeat info.
With the other connection, the client periodically pings the server to
establish an accurate round-trip time (RTT). This change optimizes the
discovery of server state changes such as replica set elections.

Additional changes:
- Mark server Unknown before retrying isMaster check.
- Always reset the pool _after_ marking the server unknown.
- Configure fail point before creating the client in test SpecRunner.
- Unfreeze with replSetFreeze:0 to ensure a speedy elections in test suite.
2020-07-01 14:49:46 -07:00
Prashant Mital
0b375a2604
PYTHON-2295 MongoClient with multiple hosts directConnection=True should raise an error (#446) 2020-07-01 10:53:52 -07:00
Shane Harvey
bfd297f1ea PYTHON-2271 Add MongoDB 4.0, 4.2, 4.4 to perf benchmark 2020-07-01 10:48:45 -07:00
Julius Park
67a23429ba
PYTHON-1787: add details to OperationFailure exception and NotMasterError (#448)
PYTHON-1787-add details to OperationFailure and NotMasterError by adding a __repr__ function

https://jira.mongodb.org/browse/PYTHON-1787
2020-06-30 12:30:28 -04:00
Shane Harvey
58aaede0fe PYTHON-2281 Properly reduce keep alive time on Windows 2020-06-25 15:31:33 -07:00
Julius Park
815c924bc3
PYTHON-2136: added more diagnostic information for ServerSelectionTimeoutError (#444)
* PYTHON-2136: added more diagnostic information for ServerSelectionTimeoutError

* made error message more human readable

* fixed tests

* fixed remaining testcase

* fixed formatting

* more formatting fixes
2020-06-25 17:04:04 -04:00
Bernie Hackett
e608ff4166 PYTHON-2192 - Use krb5's canonicalization algorithm 2020-06-25 11:26:14 -07:00
Shane Harvey
a90f80436c PYTHON-2103 Test that GridFS supports indexes created in the shell 2020-06-24 11:34:27 -07:00
Shane Harvey
e07366a4ad PYTHON-2255 Reduce default keepalive time to 120 seconds to align with Azure defaults 2020-06-24 10:59:34 -07:00
Shane Harvey
18de676657
PYTHON-2297 Close connection to avoid resource warning when auth fails (#443) 2020-06-24 09:56:56 -07:00
Shane Harvey
84fd04ec6d
PYTHON-1852 Use TLS option names in test suite ClientContext (#442) 2020-06-18 18:24:08 -07:00
Prashant Mital
74202455aa
PYTHON-2278 Fix Jython SDAM test failures 2020-06-16 15:55:21 -07:00
Shane Harvey
70fb1cce95 PYTHON-2293 Fix OCSP test script for Windows 2020-06-16 15:39:06 -07:00
Prashant Mital
69dde9ebfe
PYTHON-2285 Only start kill cursors background thread if/when the client connects to the MongoDB deployment 2020-06-16 15:14:31 -07:00
Shane Harvey
aeb0bd74de BUMP 3.11.0b2.dev0 2020-06-09 10:04:03 -07:00
Shane Harvey
8fdda6857f BUMP 3.11.0b1 2020-06-09 09:42:03 -07:00
Shane Harvey
6d2f2b516e PYTHON-2144 Test OCSP on macOS and Windows
Add ECDSA testing on Ubuntu.
ECDSA certs are not supported on macOS/Windows, only test RSA.
Log error message when OCSP HTTP request fails.
Remove nohup which does not work on macOS.
2020-06-09 09:31:17 -07:00
Shane Harvey
4c56ead955 PYTHON-2149 Test PyOpenSSL with all MongoDB versions 2020-06-08 20:07:01 -07:00
Shane Harvey
f058508751 PYTHON-2266 Test MONGODB-AWS and OCSP with 4.4
Remove debian71 and ubuntu-12.04 which no longer exist in Evergreen
2020-06-08 20:06:04 -07:00
Prashant Mital
6932d25639
PYTHON-2253 raise client-side error when allowDiskUse is specified with MongoDB <= 3.2 2020-06-08 18:25:19 -07:00
Prashant Mital
0743c0b222
PYTHON-2121 add directConnection URI option 2020-06-08 15:11:55 -07:00
Shane Harvey
9a9f42bb99 PYTHON-2236 Reset the server pool only after marking the server Unknown 2020-06-08 11:48:44 -07:00
Shane Harvey
fbafa9c847 PYTHON-2138 Fix NameError: name 'AwsSaslContext' is not defined 2020-06-05 16:23:29 -07:00
Shane Harvey
903643b3d0 PYTHON-2138 Use pymongo-auth-aws for MONGODB-AWS support 2020-06-05 15:50:26 -07:00
Shane Harvey
719b025d11 PYTHON-2254 Fix Cursor.clone with various options
This change adds support for cloning cursors with: "empty", "show_record_id",
"return_key", "allow_disk_use", "snapshot", and "exhaust".
2020-06-05 12:17:53 -07:00
Prashant Mital
4be82828f9
PYTHON-2208 Revise issues and help sections of documentation 2020-06-05 11:04:18 -07:00
Shane Harvey
4966d934a5 PYTHON-2182 Use namespace returned from find command in getMore 2020-06-04 19:47:04 -07:00
Shane Harvey
5b49557c59 PYTHON-2268 Close clients in test suite 2020-06-03 17:05:59 -07:00
Prashant Mital
4760d07815
PYTHON-2152 Expand native UUID handling support; Implement UUID specification 2020-06-01 17:45:08 -07:00
Shane Harvey
29960237dc PYTHON-2260 Include Python.h before any standard headers 2020-05-27 15:07:31 -07:00
Shane Harvey
0eace78cf4 PYTHON-2158 Support speculative authentication attempts in connection handshake 2020-05-19 11:20:23 -07:00
Shane Harvey
45a7963aac PYTHON-2082 Retryable writes use the RetryableWriteError label
Use retryable write logic for transaction commit/abort.
Do not assign the TransientTransactionError label to errors outside a
transaction.
2020-05-19 10:49:28 -07:00
Shane Harvey
48df9b088f PYTHON-2109 Avoid 30 second stalls in TestSocketError
Reduce run time of test_timeout_does_not_mark_member_down.
2020-05-13 17:36:52 -07:00
Shane Harvey
2c631faa6c PYTHON-2239 Avoid 30 second stalls in TestMongoClientFailover 2020-05-13 16:53:34 -07:00
Shane Harvey
33c93223b1 PYTHON-1651 Publish CommandFailedEvent when bulk write fails with a network error 2020-05-12 14:42:27 -07:00
Shane Harvey
fb7533e888 PYTHON-2099 Make ExceededTimeLimit a retryable writes error
Reinstate DuplicateKey code assertions.
2020-05-12 14:41:11 -07:00
Shane Harvey
a4f38d7d6e PYTHON-2168 Ensure that the WriteConcernError "errInfo" object is propagated 2020-05-12 11:59:03 -07:00
Shane Harvey
9f8468f309 PYTHON-2037 Test operations omit default write concern 2020-05-08 17:48:07 -07:00
Shane Harvey
5d8e814e58 PYTHON-2237 Use sort when verifying contents of outcome collections 2020-05-08 14:24:20 -07:00
Shane Harvey
5efdcb88e2 PYTHON-2185 Deprecate geoHaystack in create_index(es) 2020-05-08 10:09:21 -07:00
Shane Harvey
6e39ae04c3 PYTHON-2170 Add support for 4.4 hedged reads 2020-05-07 17:26:00 -07:00
Shane Harvey
8747837dbd PYTHON-2032 listIndexes no longer includes "ns" as of MongoDB 4.4 2020-05-06 11:49:10 -07:00
Shane Harvey
ae5c03df17 PYTHON-2173 Update comment in with_transaction example for the docs manual 2020-05-06 11:38:53 -07:00
Shane Harvey
1c2a575950 PYTHON-2221 Resync SDAM error handling spec tests 2020-05-04 15:03:16 -07:00
Shane Harvey
d8342367a9 PYTHON-2214 Tolerate StaleConfig errors in test_create_collection 2020-04-29 11:43:10 -07:00
Shane Harvey
07c834ea3e PYTHON-2218 Fix race in test_last_write_date 2020-04-29 11:43:07 -07:00
Shane Harvey
7099e1be8b PYTHON-2199 Reduce race conditions in SDAM error handling
Use Pool.generation and topologyVersion to reduce race conditions
SDAM error handling.
Implement SDAM error handling spec tests.
2020-04-28 16:47:13 -07:00
Shane Harvey
4c727fd9c0 PYTHON-2158 Support mechanism negotiation on the connection handshake 2020-04-28 16:43:48 -07:00
Shane Harvey
71d1227932 PYTHON-2115 Remove threading.Lock() from SocketChecker 2020-04-28 16:41:56 -07:00
Shane Harvey
9cc3652ec3 PYTHON-2186 create_indexes raises an error with commitQuorum on <4.4 2020-04-28 13:33:24 -07:00
Shane Harvey
58317a4c09 PYTHON-2215 Fix failing partialFilterExpression test on 4.5-latest 2020-04-27 15:47:26 -07:00
Wan Bachtiar
7809376a46
PYTHON-2208 Update community links to be more specific (#441) 2020-04-27 11:54:02 -07:00
Shane Harvey
250364f608 PYTHON-2116 Sort servers by address in topology repr 2020-04-23 16:11:28 -07:00
Prashant Mital
4398b4b7da
PYTHON-2201 Deprecate the Collection.reindex method 2020-04-21 18:23:51 -07:00
Shane Harvey
463d759ddc PYTHON-2116 Add __repr__ to monitoring events and description classes 2020-04-20 16:13:14 -07:00
Pavel Alimpiev
8256af6ed9
Update Documentation link in the readme (#440) 2020-04-20 09:48:47 -07:00
Shane Harvey
ef2ecc4eac PYTHON-2207 Do not use the admin database for the key vault in FLE tests
Admin collections cannot be dropped in sharded clusters in 4.5+.
2020-04-17 16:19:39 -07:00
Shane Harvey
b7f4faeeab PYTHON-2189 Ignore StaleConfig transaction errors on 4.5+ mongos 2020-04-17 16:19:39 -07:00
Prashant Mital
8d41a387f3
PYTHON-2179 Raise client-side error if an index hint is specified for an unacknowledged operation 2020-04-17 14:00:52 -07:00
Shane Harvey
ced7d52d98 PYTHON-2205 Don't add stale connections to the pool 2020-04-16 16:31:20 -07:00
Shane Harvey
350ada10d5 PYTHON-2206 Rename pool_id to generation to better match CMAP spec 2020-04-16 11:46:54 -07:00
Shane Harvey
5efe0b10b3 PYTHON-2112 Change api.mongodb.com to pymongo.readthedocs.io 2020-04-14 14:47:58 -07:00
Shane Harvey
923e83cd1a BUMP 3.11.0b1.dev0 2020-04-10 09:46:39 -07:00
Shane Harvey
5ec01ca610 BUMP 3.11.0b0 2020-04-10 09:39:05 -07:00
Prashant Mital
0c5d24ce48
PYTHON-2181 Raise an informative error including the entire command response when operationTime is missing from aggregate command response 2020-04-09 16:40:12 -07:00
Shane Harvey
914d206434 PYTHON-2193 Update install dependencies for OCSP tests 2020-04-09 13:18:27 -07:00
Shane Harvey
3463f060e9 PYTHON-2191 Fix buffer leak added in 021adc53e8 2020-04-09 12:56:58 -07:00
Shane Harvey
643e64880e PYTHON-2188 Raise ValueError instead of MemoryError when encoding exceeds 2GiB 2020-04-08 15:07:41 -07:00
Shane Harvey
021adc53e8 PYTHON-2191 Fix double free when realloc fails in buffer_grow 2020-04-08 12:57:31 -07:00
Shane Harvey
24e8aebf12 PYTHON-2188 Always raise an error when bson encoding exceeds 2GiB
Remove unused buffer_write_at_position.
2020-04-08 12:56:38 -07:00
Shane Harvey
c96220df0f Update docs for 3.11.0b0 2020-04-06 17:42:51 -07:00
Shane Harvey
d42c5105cd PYTHON-2183 Test that readPreferenceTags are always interpreted as an array
Also resolves PYTHON-2085.
2020-04-06 13:40:41 -07:00
Shane Harvey
fd64f4dd64 PYTHON-2030 Support collection and index creation in multi-doc transactions 2020-04-02 12:20:50 -07:00
Shane Harvey
c282cc18dd PYTHON-2153 Final workaround for hanging createIndexes wtimeout test 2020-03-31 18:17:12 -07:00
Prashant Mital
bf6af9fd77
PYTHON-1975 Bump max wire version to 9 (MongoDB 4.4) 2020-03-26 18:35:20 -07:00
Prashant Mital
b65fdf3f51
PYTHON-2142 Add index hinting support to delete operations 2020-03-26 16:01:33 -07:00
Shane Harvey
016f8de965 PYTHON-2155 Add MongoDB 4.4 to testing matrix 2020-03-17 15:12:02 -07:00
Shane Harvey
42aafd74d7 PYTHON-2034 Validate EC2/Lambda auth tests do not contain URI credentials 2020-03-17 12:44:34 -07:00
Shane Harvey
93cf0dd176 PYTHON-2102 Migrate testing to Windows 10
Add 32-bit Python testing on Windows.
2020-03-16 16:35:37 -07:00
Chris Cho
e5ef8f4dfa
DOCSP-9413 Replace references to google groups with community forums (#437) 2020-03-16 16:13:36 -07:00
Prashant Mital
0609fea012
PYTHON-2132 cache OCSP responses 2020-03-13 11:11:38 -07:00
Prashant Mital
47a6718352
PYTHON-2161 add support for tlsDisableOcspEndpointCheck URI option 2020-03-11 18:35:11 -07:00
Shane Harvey
af1dcc5143 PYTHON-2144 Properly require TLS for test_connect_with_ca_bundle 2020-03-10 18:25:25 -07:00
Shane Harvey
84f1a8c5f9 PYTHON-2144 Handle the case where the peer omits the self-signed issuer cert 2020-03-10 16:44:49 -07:00
Shane Harvey
c04a43396c PYTHON-2130 Note that $where does not support Code with scope in MongoDB 4.4+ 2020-03-09 20:27:40 -07:00
Shane Harvey
5f45a69f70 PYTHON-2150 Fix test_timestamp_values on Jython 2020-03-09 16:35:29 -07:00
Shane Harvey
da778c5017 PYTHON-2150 Fix ObjectId test on 32-bit platforms 2020-03-06 10:36:27 -08:00
Shane Harvey
04c3a48366 PYTHON-2153 Skip failing createIndexes wtimeout test on 4.3+
PYTHON-2154 Skip failing transactions test on 4.5+
2020-03-06 09:11:01 -08:00
Shane Harvey
bb272b1d54 PYTHON-2139 Test MONGODB-AWS auth on macOS and Windows
Replace jq with python as macOS does not have jq.
Use sys.stdout.write instead of print to avoid trailing newlines.
2020-03-05 13:48:07 -08:00
Prashant Mital
ce601190cf
PYTHON-2097 Deprecate oplogReplay find command option 2020-03-05 11:24:46 -08:00
Shane Harvey
2157dc58ea PYTHON-2148 Test PyOpenSSL support on Windows 2020-03-03 14:46:07 -08:00
Prashant Mital
e485c07109
PYTHON-2036 Update documentation and changelog to reflect expanded support for index hinting 2020-03-03 13:32:58 -08:00
Shane Harvey
043c8e822b PYTHON-2140 Test PyOpenSSL on macOS
Handle the case where the peer omits the self-signed issuer cert and
OCSP is not requested by delaying issuer check.
Properly set PYMONGO_MUST_CONNECT in PyOpenSSL tests.
Properly set PYTHON_BINARY in OCSP test.
2020-03-03 10:27:54 -08:00
Shane Harvey
e26dc96e31 PYTHON-2034 Support MONGODB-AWS authentication mechanism
Use botocore to perform the manual Signature Version 4 Signing Process.
Test MONGODB-AWS in Evergreen.
Properly unquote URI option values in authMechanismProperties and
readPreferenceTags.
2020-03-03 09:43:48 -08:00
Shane Harvey
a43e73dd20 PYTHON-2113 An empty authSource URI option is not valid
Update spec test runner for PYTHON-1846.
2020-02-27 12:18:28 -08:00
Prashant Mital
651aa6aa98
PYTHON-2035: support for allowDiskUse in find() commands 2020-02-25 19:24:10 -08:00
Prashant Mital
1323ef15cb
PYTHON-2036 Expand CRUD API support for index hinting (also PYTHON-2015, PYTHON-2104, PYTHON-2134) 2020-02-25 19:22:25 -08:00
Shane Harvey
a460725f6b PYTHON-2019 Add support for validate command "background" option 2020-02-25 18:31:44 -08:00
Shane Harvey
d7128c130c PYTHON-2024 Skip publishing SDAM events for "equivalent" ServerDescriptions 2020-02-24 16:32:09 -08:00
Shane Harvey
e989be53c1 PYTHON-2088 Define how multiple phases should be handled in SDAM spec runner 2020-02-24 16:32:09 -08:00
Bernie Hackett
d46bd1671c PYTHON-2093 Documentation for OCSP 2020-02-21 13:04:11 -08:00
Bernie Hackett
8e5dbc9f0a PYTHON-2128 Fix test_ssl_pem_passphrase 2020-02-21 09:20:35 -08:00
Shane Harvey
6ee80cecfa PYTHON-2124 Assert no gc.garbage at test suite teardown and enable debug output 2020-02-20 15:04:31 -08:00
Bernie Hackett
a06a0e7aa6 PYTHON-2093 OCSP Support 2020-02-20 14:44:24 -08:00
Shane Harvey
dc692e4d82 PYTHON-2130 Skip failing $where test on 4.4 2020-02-19 10:56:51 -08:00
Shane Harvey
90cb160595 PYTHON-2129 Use error code to check for NamespaceNotFound errors 2020-02-19 10:56:51 -08:00
Shane Harvey
0b24e1e0b7 PYTHON-2126 Refactor monitor to create PeriodicExecutor in one place 2020-02-14 13:11:34 -08:00
Shane Harvey
6609cc5714 PYTHON-2098 Publish server/topology events when reseting a server due to an application error 2020-02-11 11:50:45 -08:00
Shane Harvey
c4b8aef1e8 PYTHON-2119 Fix doc tests caused by 4.4 mapReduce change 2020-02-11 09:37:53 -08:00
Shane Harvey
d481363fd5 PYTHON-2029 Support shorter SCRAM conversation 2020-02-10 16:24:43 -08:00
Shane Harvey
5a1cbd8f20 PYTHON-2073 Add NPS Survey to documentation 2020-02-10 14:23:27 -08:00
Shane Harvey
9079596bf0 PYTHON-2120 Skip failing ChangeStream tests on 4.4 2020-02-10 12:49:45 -08:00
Shane Harvey
5ccdf1af44 PYTHON-2118 Adjust impossible writeConcern tests for 4.4 2020-02-10 10:41:41 -08:00
Bernie Hackett
c69ea64220 PYTHON-2117 Only use env markers when setuptools is new enough 2020-02-07 16:07:51 -08:00
Bernie Hackett
5df94d08f0 PYTHON-2040 PyOpenSSL support 2020-02-06 18:03:21 -08:00
Shane Harvey
e08ad6e8f7 PYTHON-2068 Wait for w=0 operations to complete when dropping test database 2020-01-24 17:33:51 -08:00
Prashant Mital
d5b0790da1
PYTHON-2101 Fix SSL failures on MacOS-10.14 2020-01-24 14:10:15 -08:00
Prashant Mital
6c27e3e9d7
PYTHON-2094 Migrate macOS evergreen builds to macOS-1014 2020-01-15 13:34:06 -08:00
Shane Harvey
2d836ecb51 BUMP 3.11.0.dev1 2020-01-07 16:39:06 -08:00
Shane Harvey
d7d94b2776 BUMP 3.10.1 2020-01-07 16:36:17 -08:00
Shane Harvey
30667d1e00 PYTHON-2092 Avoid creating new connections during MongoClient.close 2020-01-02 16:30:26 -08:00
Shane Harvey
5c02f8bec4 PYTHON-2072 Fix tests now that "counts" is not reported in map_reduce 2019-12-26 13:49:16 -05:00
Kevin Albertson
fc26881f01 Fix typo in client side encryption examples (#435) 2019-12-23 16:38:33 -05:00
Shane Harvey
eed8e29bbb PYTHON-2089 Call close_socket with a reason
Add tests for PYTHON-1954.
2019-12-23 11:18:03 -05:00
Shane Harvey
4c18d09eff BUMP 3.11.0.dev0 2019-12-10 10:52:38 -08:00
Shane Harvey
25a9b98cb3 BUMP 3.10.0 2019-12-10 10:51:31 -08:00
Tim Gates
2e36161e38 Fix simple typo: overidden -> overridden (#432) 2019-12-10 10:08:54 -08:00
Mark Benvenuto
1d71968c76 PYTHON-2064 Collect crash dumps from mongo-orchestration (#431) 2019-12-10 10:05:51 -08:00
Shane Harvey
a7c3738785 Update changelog for 3.10 release 2019-12-05 14:00:32 -08:00
Prashant Mital
04a51ed57a
PYTHON-2074 Correctly mock the MonitorBase API 2019-12-05 10:01:53 +05:30
Prashant Mital
ed4204f237
PYTHON-1954 Stop holding the topology lock while creating new connections 2019-12-05 09:58:58 +05:30
Shane Harvey
228f716570 PYTHON-2059 Do not send readPreference with OP_MSG getMore commands 2019-12-03 12:29:01 -08:00
Shane Harvey
895b66272e PYTHON-2070 Migrate MongoDB 4.3+ Windows testing to Windows 2016+
MongoDB 4.4 requires a minimum of Windows 10 / Server 2016.
2019-12-03 12:27:11 -08:00
Shane Harvey
23a62433b6 PYTHON-1660 Clear MongoClient session pool after a fork
Note that a MongoClient instance is still not fork-safe. This change
avoids "Cannot start transaction X on session <SID> because a newer
transaction Y has already started" errors and other incorrect command
results caused by duplicate sessions in the child process.
2019-12-03 11:51:13 -08:00
Shane Harvey
94cb6acc09 PYTHON-1966 Test with custom default encoding on Python 2 2019-12-02 12:32:37 -08:00
Shane Harvey
eda4fbb159 PYTHON-2043 Spawn mongocryptd as a daemon process and silence resource warnings 2019-11-22 16:13:54 -08:00
Shane Harvey
e627321c2e PYTHON-1966 Fix unicode(PyMongoError) on Python 2 2019-11-22 15:17:56 -08:00
paul fisher
6c4e1c9371 PYTHON-2061 bson: check for negative entry size in decode_file_iter (#429)
Raise InvalidBSON instead of ValueError when decode_file_iter reads an invalid
BSON object size.
2019-11-22 14:57:00 -08:00
Prashant Mital
b8ce14dfd2
PYTHON-2063 Fix faulty command construction in failpoint context manager 2019-11-21 16:24:19 -08:00
Shane Harvey
ec4b02052d PYTHON-1993 Use dochub for stable CSFLE documentation links 2019-11-21 12:15:12 -08:00
Prashant Mital
e31a0ef95f
PYTHON-1911 Implement missing changeStream prose tests 2019-11-20 19:46:07 -08:00
Shane Harvey
d0423d2d53 PYTHON-1993 Add client-side field level encryption documentation examples
Specify pymongocrypt<2.0.0 in setup.py for compatibility.
2019-11-20 15:42:32 -08:00
Bernie Hackett
849a415356 PYTHON-2002 Re-enable dns/srv tests 2019-11-18 17:41:42 -08:00
Shane Harvey
083c2474da PYTHON-2055 Subtract message header from compressed bulk OP_MSG
This change prevents pymongo from generating a bulk OP_COMPRESSED/OP_MSG
with an uncompressed message larger than the server's limit of
maxMessageSizeBytes - 16.
2019-11-14 16:24:08 -08:00
Prashant Mital
1fdfb9864b
PYTHON-2054 Remove unused example TestTransactionExamples.test_transactions_beta 2019-11-14 13:29:45 -08:00
Bernie Hackett
d37540ae15 PYTHON-2053 Test with pypy3.6 2019-11-13 14:17:50 -08:00
Bernie Hackett
bfdf48edfa PYTHON-2009 Add Python 3.8 to trove classifiers 2019-11-13 08:21:45 -08:00
Bernie Hackett
4cbbd85c4c PYTHON-2009 Test with Python 3.8 in Evergreen 2019-11-13 08:17:18 -08:00
Shane Harvey
a3556c4447 PYTHON-2012 Update FLE to support commands larger than 6MiB
Bulk write command are batched at 2MiB when auto encryption is enabled.
2019-11-12 15:24:09 -08:00
Prashant Mital
c65367b8f0
PYTHON-1972 Add example usage for withTransaction API 2019-11-11 16:06:57 -08:00
Shane Harvey
9cf0fbd785
PYTHON-2001 Fix warnings emitted by Python 3.8 (#428)
Fix DeprecationWarning: PY_SSIZE_T_CLEAN will be required for '#' formats
Fix DeprecationWarning: isAlive() is deprecated, use is_alive() instead
Fix SyntaxWarning: invalid escape sequence
Test Python 3.8 on Travis
2019-11-08 11:48:15 -08:00
Shane Harvey
bbf55d6da5 PYTHON-2039 Avoid shadowing dns module in srv tests 2019-11-06 10:42:45 -08:00
Shane Harvey
55f8df2141 PYTHON-2002 Skip failing dnspython seedlist tests on Python 2 2019-11-05 16:54:00 -08:00
Shane Harvey
13d559b6d4 PYTHON-2002 Skip failing dnspython SRV polling tests on Python 2 2019-11-05 16:24:08 -08:00
Shane Harvey
b572600821
PYTHON-2012 FLE GA changes (#427)
Silence mongocryptd output, users should provide logging options via mongocryptd_spawn_args instead.
Document 'endpoint' support in create_data_key.
Document that create_data_key returns a Binary with UUID subtype.
Add custom endpoint prose test.
Resync encryption spec tests.
Check command started events in Data key and double encryption prose test.
2019-11-05 14:45:30 -08:00
Prashant Mital
f62c53f472
PYTHON-2020 Make ClientSession._in_transaction a public property 2019-11-01 16:58:38 -07:00
Shane Harvey
9a882245b1 PYTHON-2025 Remove unused tox and appveyor configs 2019-11-01 13:09:34 -07:00
Maciej "RooTer" Urbański
08e839070b Test against Python 3.7 on Travis (#426) 2019-11-01 11:38:24 -07:00
Shane Harvey
c25a83aee4 PYTHON-2007 Fix pymongocrypt install error message 2019-10-31 16:14:57 -07:00
Shane Harvey
ad0e87c0e0 PYTHON-2022 Fix potential UnboundLocalError in gridfs test 2019-10-28 14:53:52 -07:00
Shane Harvey
560415666a PYTHON-2023 Use $merge to non-admin db to fix db.aggregate write concern test 2019-10-25 15:56:47 -07:00
Anders Kaseorg
bb18da769c PYTHON-2001 Fix Python 3.8 SyntaxWarning: "is not" with a literal (#425)
Fixes this warning from Python 3.8:
bson/json_util.py:702: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if doc['$minKey'] is not 1:
bson/json_util.py:711: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if doc['$maxKey'] is not 1:
2019-10-24 14:08:08 -05:00
Shane Harvey
502b59898e PYTHON-2006 Fix DuplicateKeyError in custom types test 2019-10-16 15:52:52 -07:00
Shane Harvey
3236994c81 SPEC-1464 Workaround for unordered JSON parsing in FLE test 2019-10-04 16:22:39 -07:00
Shane Harvey
bce43939c9 PYTHON-1996 Add require_test_commands tests that use failpoints 2019-10-04 14:59:41 -07:00
Shane Harvey
efb89583f3 PYTHON-1995 Resync encryption spec tests to 71518175e8bd5ee36fc35a7529b65f9d248b1c83 2019-10-04 14:47:12 -07:00
Shane Harvey
802de40e0d PYTHON-1918 Fix decoding perf test 2019-09-12 16:53:38 -07:00
Prashant Mital
ef3df1663c
PYTHON-1918 Stop using BSON.encode and BSON.decode functions 2019-09-09 18:06:46 -07:00
Prashant Mital
7d8ade1ff9
BUMP 3.10.0.dev0 2019-08-20 10:17:40 -07:00
Bernie Hackett
e152e9eafa BUMP 3.9.0 2019-08-13 18:05:10 -07:00
Bernie Hackett
5847b34f68 Claim support for MongoDB 4.2 2019-08-13 15:20:02 -07:00
Bernie Hackett
1a7502c08a Fix up changelog and docs for 3.9.0 release 2019-08-13 14:19:29 -07:00
Shane Harvey
55c8bdd346 PYTHON-1939 Add prose tests for BSON size limits and batch splitting 2019-08-13 13:35:55 -07:00
Shane Harvey
94e2b103f1 PYTHON-1959 Use read/writeConcern majority for key vault operations 2019-08-13 11:11:46 -07:00
Shane Harvey
af0f6fd264 PYTHON-1955 Uninstall pymongocrypt after test suite 2019-08-13 11:01:54 -07:00
Shane Harvey
ef8d1e2f21 PYTHON-1926 Raise an error for unsupported encryption operations 2019-08-13 09:36:32 -07:00
Shane Harvey
8d693e85de PYTHON-1921 Raise InvalidOperation when using a closed encrypted client 2019-08-13 09:35:04 -07:00
Shane Harvey
56bb5dd1f7 PYTHON-1944 Mark encryption as in beta 2019-08-13 09:07:42 -07:00
Shane Harvey
6f00a240c7 PYTHON-1955 Test encryption in evergreen
Only enable xtrace output for non-sensitive tasks.
2019-08-13 09:07:42 -07:00
Bernie Hackett
742555fd89 PYTHON-1951 Cap python 2 dnspython version at 1.16.x 2019-08-13 09:02:12 -07:00
Shane Harvey
8e43dee5df PYTHON-1957 Don't use unix sockets for mongocryptd client 2019-08-12 12:09:57 -07:00
Shane Harvey
aac8d6308b PYTHON-1935 Only create test crud v2 collection if there's data to insert 2019-08-12 10:54:25 -07:00
Shane Harvey
243307be16 PYTHON-1901 Avoid using readConcern snapshot in sharded txn tests 2019-08-12 10:20:12 -07:00
Prashant Mital
4800512c36
PYTHON-1839 Deprecate waitQueueMultiple option 2019-08-09 17:07:30 -07:00
Prashant Mital
62400e548d
PYTHON-1902 DNS resolution should honor connectTimeoutMS 2019-08-09 17:04:02 -07:00
Shane Harvey
aadd9c78b1 PYTHON-1952 Test ClientEncryption.close
Support using ClientEncryption in a with-statement.
2019-08-09 11:20:00 -07:00
Shane Harvey
fb86f654ee PYTHON-1950 Restrict key_id to Binary subtype 4 2019-08-09 10:55:00 -07:00
Shane Harvey
69ec553023 PYTHON-1946 Rename encryption.Algorithm enum members 2019-08-08 22:40:09 -07:00
Shane Harvey
5a293821e4 PYTHON-1947 Add codec_options to ClientEncryption 2019-08-08 22:36:00 -07:00
Prashant Mital
45da03afad
PYTHON-1914 MongoClient.is_locked should not raise DeprecationWarning 2019-08-08 21:27:43 -07:00
Shane Harvey
a9953d0e0e PYTHON-1940 Implement views are prohibited prose test 2019-08-08 20:52:28 -07:00
Shane Harvey
dc33a616b9 PYTHON-1941 Implement prose test for data key and double encryption 2019-08-08 20:52:28 -07:00
Shane Harvey
0a1d77751f PYTHON-1942 Implement prose tests for External Key Vault 2019-08-08 20:52:28 -07:00
Shane Harvey
72c777257a PYTHON-1899 Implement encryption corpus test
Validate type to decrypt is Binary subtype 6.
Skip tests for deprecated symbol and dbPointer types.
2019-08-08 20:52:28 -07:00
Shane Harvey
59e3bcb66a PYTHON-1883 Implement ClientEncryption class 2019-08-08 20:52:28 -07:00
Prashant Mital
a763461403
PYTHON-1885 Update ChangeStream documentation to use getResumeToken helper 2019-08-08 15:35:09 -07:00
Prashant Mital
78aa667f0f
PYTHON-1934 retryWrites=True with MMAPv1 storage engine should raise an actionable error 2019-08-08 13:24:46 -07:00
Shane Harvey
e6eecb06d1 PYTHON-1884 Implement auto encryption spec tests
Skip test for symbol type which pymongo converts to string.
Fix {} comparison with RawBSONDocument in command events.
Add support for $$type assertions.
Nicer message in check_events.
Support errorContains with empty string.
Move custom data files to custom/.
2019-08-06 16:17:39 -07:00
Shane Harvey
743042d843 PYTHON-1884 Add client encryption spec test files 2019-08-06 16:16:30 -07:00
Shane Harvey
7d76ee2276 PYTHON-1884 Support auto encryption in bulk write
Close KMS sockets.
Call pymongocrypt's init method.
2019-08-06 14:54:23 -07:00
Shane Harvey
58866319f9 PYTHON-1884 Support auto encryption in cursors 2019-08-06 14:54:23 -07:00
Shane Harvey
8888e977f8 PYTHON-1884 Support auto encryption in network.command
Add encryption I/O callbacks.
Add mongocryptd process management.
Add simple test for auto encryption round trip.
2019-08-06 14:54:23 -07:00
Prashant Mital
611c3f86b3
PYTHON-1677 Connections survive primary stepdown 2019-08-06 13:08:15 -07:00
Shane Harvey
57302846b7 PYTHON-1930 Fix pure python decoder support for memoryviews 2019-08-02 12:17:45 -07:00
Bernie Hackett
3bcdde34c9 PYTHON-1785 Add bson.encode and bson.decode 2019-07-30 11:52:03 -07:00
Bernie Hackett
57c7f8ccbb PYTHON-1785 Pure Python decoders support the buffer protocol 2019-07-30 11:51:24 -07:00
Bernie Hackett
de7c94cdac PYTHON-1785 C extension decoders support the buffer protocol 2019-07-30 11:51:00 -07:00
Shane Harvey
201c3d2208 PYTHON-1916 Don't decode RawBSONDocument during insert operations
This change improves the performance of inserting RawBSONDocuments with
insert_one, insert_many, and bulk_write.
2019-07-29 17:55:53 -07:00
Shane Harvey
6d8c1ced70 PYTHON-1882 Add AutoEncryptionOpts 2019-07-29 16:05:20 -07:00
Shane Harvey
7c13667727 PYTHON-1898 Close events executor faster after the topology is freed 2019-07-26 12:51:35 -07:00
Prashant Mital
ddac30d2ff
PYTHON-1742 add postBatchResumeToken support
PYTHON-1815 add tests for postBatchResumeToken support
PYTHON-1845 clarify resume token used in resuming and getResumeToken
2019-07-25 17:18:35 -07:00
Shane Harvey
010e8d429b PYTHON-1897 Don't open new threads/sockets when closing a client 2019-07-25 17:16:53 -07:00
Shane Harvey
6d5d36186a PYTHON-1909 Log tracebacks after a segfault 2019-07-19 14:15:26 -07:00
Bernie Hackett
e92e2b0efb PYTHON-1648 Binary buffer protocol support 2019-07-18 08:41:40 -07:00
Shane Harvey
77913c7d36 PYTHON-1900 Add "connectionError" as a valid ConnectionCheckOutFailedEvent reason 2019-07-17 14:15:55 -07:00
Bernie Hackett
3dfd03c9eb PYTHON-1906 Skip new SRV test if dnspython isn't available 2019-07-17 07:06:17 -07:00
Prashant Mital
886cf657bb
PYTHON-1905 Don't send fullDocument field by default with every
$changeStream pipeline stage
2019-07-16 19:13:57 -07:00
Bernie Hackett
7425153639 PYTHON-1665 Agg with $out always goes to primary 2019-07-16 14:20:50 -07:00
Bernie Hackett
a23ce28942 PYTHON-1761 Include fqdn or srv hosts in srv errors 2019-07-16 14:11:47 -07:00
Bernie Hackett
7888ff08f3 PYTHON-1863 Call out backward breaking ObjectId changes 2019-07-16 13:05:38 -07:00
Bernie Hackett
8f0ea1daec PYTHON-1797 PYTHON-1659 Update retryWrites tests 2019-07-15 17:33:51 -07:00
Bernie Hackett
c6e59832f1 PYTHON-1803 Document URI / keyword option precedence 2019-07-15 15:46:34 -07:00
Bernie Hackett
6b1a7f40c6 PYTHON-1858 Deprecate Database.current_op 2019-07-15 13:40:27 -07:00
Bernie Hackett
9e37872c0b PYTHON-1869 ARM testing for 4.2+ 2019-07-15 13:26:50 -07:00
Bernie Hackett
19b6f7b667 PYTHON-1890 runOn syntax in CRUD spec tests 2019-07-15 13:10:33 -07:00
Bernie Hackett
7cfe770da8 PYTHON-1847 - Update countDocuments docstring 2019-07-15 13:07:06 -07:00
Bernie Hackett
6ec594eef1 PYTHON-1738 GridFS length should be an int64 2019-07-15 13:05:16 -07:00
Bernie Hackett
826cc50055 PYTHON-1789 Update indexing docs for wildcard index options 2019-07-09 14:21:54 -07:00
Prashant Mital
26d25cd74e
PYTHON-1841 ChangeStream should not resume after errors with NonRetryableChangeStreamError label 2019-07-02 18:55:35 -07:00
Prashant Mital
f90ee2ae35
PYTHON-1887 Stop testing latest on Archlinux 2019-07-02 14:25:36 -07:00
Prashant Mital
3ba46a9911
PYTHON-1877 Fix result assertion in changeStream spec tests
PYTHON-1713 Resync change stream tests to test all new notification types
2019-07-02 13:26:21 -07:00
Shane Harvey
0f30d16554 PYTHON-1873 Remove flawed CMAP fairness test
Print debug info when a CMAP test fails.
2019-06-27 18:45:21 -07:00
Prashant Mital
b89609ab69
PYTHON-1876 Test server version 4.2.x in Evergreen 2019-06-27 17:37:42 -07:00
Shane Harvey
8855a510a8 PYTHON-1875 Fix parsing of json datetime without timezone or fractional seconds
{"$date": "2019-01-01T01:02:03"} is now parsed the same as
{"$date": "2019-01-01T01:02:03Z"},
{"$date": "2019-01-01T01:02:03.000"}, and
{"$date": "2019-01-01T01:02:03.000Z"}
2019-06-24 16:20:34 -07:00
Prashant Mital
fc37bf883b
PYTHON-1859 Stop testing 3.6 on Ubuntu 12 | Stop all testing on Ubuntu 14 2019-06-24 15:36:33 -07:00
Prashant Mital
960509e0ff
PYTHON-1872 Follow-on SrvMonitor testing work 2019-06-21 11:21:41 -04:00
Shane Harvey
d279758228 BUMP 3.9.0b2.dev0 2019-06-16 12:20:16 -04:00
Shane Harvey
1535a72b7f BUMP 3.9.0b1 2019-06-16 12:16:15 -04:00
Prashant Mital
b834e312a3
PYTHON-1872 Fix SrvMonitor related test failures 2019-06-14 16:34:06 -07:00
Shane Harvey
6e7e6a23e0 PYTHON-1774 Fix path to XML test output 2019-06-14 13:39:42 -07:00
Shane Harvey
6de82d2526 PYTHON-1874 Fix coll.aggregate() when result is missing the "ns" field 2019-06-14 10:57:27 -07:00
Prashant Mital
0b72f88363
PYTHON-1871 ChangeStreams must honor batchSize 2019-06-14 10:25:41 -07:00
Prashant Mital
aefd02a801
PYTHON-1798 Support pipelines in update commands 2019-06-13 20:26:02 -07:00
Prashant Mital
694a4a5d85
PYTHON-1866 Add support for $merge aggregation pipeline stage 2019-06-13 19:38:15 -07:00
Shane Harvey
0400949ba5 PYTHON-1873 Increase waitQueueTimeoutMS in CMAP fairness test 2019-06-13 16:51:04 -07:00
Shane Harvey
f588412b67 PYTHON-1842 Implement Connection Monitoring and Pooling spec 2019-06-13 15:50:49 -07:00
Arthur Darcet
876db9939e PYTHON-1867 Fix noisy AttributeError in Cursor.__del__ (#421) 2019-06-12 16:45:52 -07:00
Prashant Mital
81529713ba
PYTHON-1699 Add database level aggregate helper 2019-06-12 16:37:39 -07:00
Prashant Mital
f85a9f9450
PYTHON-1675 SRV polling for mongos discovery 2019-06-10 12:51:49 -07:00
Shane Harvey
afbf18b0ad PYTHON-1720 Add start_after parameter to watch() methods 2019-06-04 16:06:47 -07:00
Shane Harvey
4170d8ac7f PYTHON-1829 Support maxTimeMS for commitTransaction
Add max_commit_time_ms to TransactionOptions.
MaxTimeMSExpired errors on commit are labelled UnknownTransactionCommitResult.
with_transaction does not retry commit after MaxTimeMSExpired errors.
2019-06-04 15:44:32 -07:00
Shane Harvey
fc645a248e PYTHON-1838 Discard ServerSessions involved in network errors 2019-06-04 15:43:55 -07:00
Shane Harvey
b2c5c5f8b8 PYTHON-1843 Use public attribute to encode ObjectId in C 2019-06-04 15:40:08 -07:00
Shane Harvey
c6efb06e3b PYTHON-1849 Ignore patch_all return value added in gevent 1.4+ 2019-05-28 15:00:44 -07:00
Shane Harvey
d847e01df0 PYTHON-1851 Test inline mapReduce fails in a causally consistent session on 4.2 2019-05-28 13:54:51 -07:00
Prashant Mital
8dbf41a5ff
PYTHON-1827 Follow-on work for unifying URI options 2019-05-28 11:04:47 -07:00
Bernie Hackett
820d884ef7 PYTHON-1733 Regenerate test certificates with SHA256 signatures 2019-05-24 10:42:02 -07:00
Shane Harvey
9baadec0af PYTHON-1729 Add read preference to transaction retry example 2019-05-20 14:33:58 -07:00
Shane Harvey
2b57cbb980 PYTHON-1649 Bump max wire version to 8 (MongoDB 4.2) 2019-05-17 13:00:24 -07:00
Bernie Hackett
8facf001c0 PYTHON-1723 Support zstd wire compression 2019-05-09 14:59:34 -04:00
Shane Harvey
3e1149770f PYTHON-1830 Update to amazon linux 2018 for 4.2 support 2019-05-06 15:53:00 -07:00
Shane Harvey
ff689253f8 PYTHON-1831 Refactor CRUD v2 to use base SpecRunner class 2019-04-30 11:02:09 -07:00
Shane Harvey
086b600d62 PYTHON-1831 Fix spec test parsing of returnDocument argument 2019-04-29 15:55:26 -07:00
Shane Harvey
c29c21449e PYTHON-1828 Send recoveryToken on abortTransaction 2019-04-29 14:57:50 -07:00
Shane Harvey
87793a9058 Saner random byte generation 2019-04-29 12:12:25 -07:00
Shane Harvey
a15266083b PYTHON-1674 Support retryable reads
Add retryReads URI option that defaults to True.
Supported read operations will be retried once after transient
network, election, and shutdown errors on MongoDB 3.6+.
Supported operations are:
listCollections, listIndexes, and listDatabases
distinct
count, estimated_document_count, count_documents
aggregate (not including $out)
find (only for the initial find command, getMore commands are not
retried).
ChangeStreams: watch (initial aggregate command).
GridFS read APIs.

Test changes:
Add retryable reads spec test runner.
Disable retryable reads in network error tests.
2019-04-25 14:28:12 -07:00
Shane Harvey
0ef728acd1 PYTHON-1674 Add retryable reads spec test files 2019-04-25 14:27:41 -07:00
Shane Harvey
87951c33f8 PYTHON-1674 Refactor spec test runner for transactions
This enables us to reuse the transaction spec runner for tesing
retryable reads.
2019-04-25 14:27:41 -07:00
Shane Harvey
7f4c504560 PYTHON-1674 Refactor Cursor/CommandCursor.__send_message
Move exhaust getMore out of Cursor.
Move cursor command response decoding into Server so that all command
listener events can be published in the same location.
2019-04-25 14:27:41 -07:00
Shane Harvey
05a3825cc2 PYTHON-1816 Test writes in transactions are compatible with w=0 collection 2019-04-25 14:16:42 -07:00
Prashant Mital
54c9aff9d3
BUMP 3.8.0 2019-04-23 16:18:35 -07:00
Shane Harvey
6b6efd9b59 PYTHON-1664 Include type in InvalidDocument error 2019-04-19 16:51:04 -07:00
Shane Harvey
9cca2a7d2c PYTHON-1818 Support custom type encoding in watch pipelines 2019-04-19 15:53:31 -07:00
Prashant Mital
0ea5a1542e
PYTHON-1819 Documentation & examples for custom type encoding/decoding
functionality
2019-04-19 13:32:06 -07:00
Prashant Mital
3b29458015
PYTHON-1821 Preserve field ordering when iterating over RawBSONDocument
instances
2019-04-19 12:36:14 -07:00
Prashant Mital
2f2fe9db0d
PYTHON-1818 TypeCodec support for ChangeStreams 2019-04-18 18:02:12 -07:00
Shane Harvey
fbb56a2311 PYTHON-1820 Validate bson size in RawBSONDocument init
Also fixes a bug where an empty bson document could not be represented
by RawBSONDocument.
2019-04-18 15:15:10 -07:00
Shane Harvey
2cb34e4efc PYTHON-1814 Support custom type decoder with distinct
Fix pure python custom type decoding of bson arrays.
2019-04-17 15:44:51 -07:00
Bernie Hackett
2f06e8a441 PYTHON-1808 - Document uuidRepresentation 2019-04-16 16:26:09 -07:00
Prashant Mital
749116287a
PYTHON-1783 Decode user-facing documents but not internal driver-server
communications.
2019-04-16 15:01:42 -07:00
Shane Harvey
007aa6ba50 PYTHON-1491 Skip OP_KILL_CURSORS on old 3.6 versions 2019-04-16 14:33:21 -07:00
Shane Harvey
ea8941ef5d PYTHON-1811 Deprecate running min/max queries without hint
Starting in MongoDB 4.2 a hint will be required when using min/max.
2019-04-16 14:00:56 -07:00
Prashant Mital
4049b1493a
PYTHON-1783: disallow custom-encoding built-in types 2019-04-11 11:28:14 -07:00
Shane Harvey
f09d6fa052 PYTHON-1801 Update transactions count test for MongoDB >= 4.0.7 2019-04-08 11:43:04 -07:00
Shane Harvey
eb4a047278 PYTHON-1799 Don't iterate _ENCODERS dict when encoding bson 2019-04-02 16:48:34 -07:00
Shane Harvey
2bdc188163 PYTHON-1795 Workaround StaleDbVersion on distinct 2019-04-02 13:15:23 -07:00
Shane Harvey
9cccada41e PYTHON-1794 Add runOn support to transaction tests 2019-04-02 13:15:08 -07:00
Shane Harvey
244e7ffa12 PYTHON-1793 Use _id:1 in countDocuments to follow the updated CRUD spec 2019-04-01 11:32:19 -07:00
Jesse M. Holmes
66eb6da601 Update docs to use list_collection_names method (#401)
db.collection_names() is deprecated.
2019-03-28 16:08:08 -07:00
Terence D. Honles
481600b7fe PYTHON-1695 GridOut/GridIn more closely implement io.IOBase (#387)
Allows GridOut to be wrapped with zipfile.ZipFile from the stdlib.
2019-03-28 14:25:06 -07:00
jakirkham
5950abf323 Clarify that Binary expects data to be bytes (#399) 2019-03-28 11:51:28 -07:00
Shane Harvey
5ebd2938bd PYTHON-1792 More reliable tests for ChangeStream.try_next 2019-03-27 13:36:32 -07:00
Shane Harvey
cd787dbb2c PYTHON-1791 Fix reference counting leaks
Fix batched op_msg/op_query reference leak of overflow doc.
Fix theoretically possible (but practically impossible) reference leak of
$clusterTime in op_query.
Optimization: Don't encode document past the batch size in batched op_query.
2019-03-27 13:04:02 -07:00
Shane Harvey
92ddc09b7e PYTHON-1662 Add ChangeStream.try_next API 2019-03-26 11:14:21 -07:00
Shane Harvey
11967eb160 PYTHON-1784 Add filter support to list_collection_names
Adhere to enumerate collection spec for setting nameOnly when filter
is provided to allow filtering based on collection options.
2019-03-22 17:06:51 -07:00
Shane Harvey
4169a04821 PYTHON-1786 Send comment with Cursor.count and Cursor.distinct 2019-03-22 17:01:39 -07:00
Bernie Hackett
c55a66235d PYTHON-1685 - Renovate get_default_database 2019-03-22 16:49:37 -07:00
Prashant Mital
6bea39d7ca
PYTHON-1476 Add changelog entry for flexible BSON work 2019-03-22 13:03:39 -07:00
Prashant Mital
76ef2b473f
PYTHON-1782 Restore backwards compatibility of MongoClient initialization when passing a type_registry 2019-03-22 10:30:03 -07:00
Prashant Mital
1b0b17450a
PYTHON-1786 Skip test_cursor.TestCursor.test_comment until SERVER-40270 is resolved 2019-03-22 10:25:15 -07:00
Prashant Mital
599e2d7117
PYTHON-1782 Allow MongoClient to be initialized with type_registry 2019-03-21 15:30:16 -07:00
Prashant Mital
cda0b71b78
PYTHON-1696 Stop encouraging use of BSON.decode as a classmethod 2019-03-21 11:45:43 -07:00
Shane Harvey
704905844d PYTHON-1780 Test against Python 2.7 on linux-64-amzn 2019-03-21 10:10:49 -07:00
Prashant Mital
65f85f648c
PYTHON-1769 Re-define TypeCodecBase as an AbstractBaseClass 2019-03-19 18:00:30 -05:00
Bernie Hackett
fe307058c8 PYTHON-1656 explain() uses server default verbosity 2019-03-19 14:36:50 -07:00
Bernie Hackett
c0c7c05652 PYTHON-1762 Document that limit=0 means no limit 2019-03-19 11:26:07 -07:00
Bernie Hackett
bb83a26082 PYTHON-1726 Disable TLS renegotiation when possible 2019-03-19 11:19:50 -07:00
Prashant Mital
e01efc7073
PYTHON-1731 Implement callback for unencodable types 2019-03-18 11:43:51 -05:00
Shane Harvey
a1b04628b9 PYTHON-1600 Avoid race condition in test_last_write_date 2019-03-15 12:40:02 -07:00
Shane Harvey
923229de12 PYTHON-1757 Properly skip tests that require enableTestCommands 2019-03-14 16:24:36 -07:00
Shane Harvey
9f9b888111 PYTHON-1773 Test against clusters with enableTestCommands=0 2019-03-14 16:24:36 -07:00
Shane Harvey
357e3e3d68 PYTHON-1684 Bump required server version for testing sharded transactions 2019-03-13 17:41:17 -07:00
Bernie Hackett
9ca4800543 PYTHON-1740 - Fix up transaction tests 2019-03-13 16:10:03 -07:00
Shane Harvey
956fd92e82 PYTHON-1721 Improve GridFS file download performance (#413)
This change uses a cursor to download all the chunks in a GridFS file
instead of using individual find_one operations to read each chunk.
Detect truncated/missing/extra chunks in _GridOutChunkIterator.
Only detect extra chunks after reading the final chunk, not on every
call to read().
Retry once after CursorNotFound for backward compatibility.
2019-03-13 15:44:40 -07:00
Shane Harvey
da2ba8d7ed PYTHON-1709 Always use codec_options in Database.current_op 2019-03-13 11:51:25 -07:00
Shane Harvey
59c3a22115 PYTHON-1491 Enable OP_KILL_CURSORS test 2019-03-12 17:57:58 -07:00
Prashant Mital
83755b8739
PYTHON-1750 Support callbacks for simple types (#405) 2019-03-12 16:40:23 -07:00
Shane Harvey
fd34c1da2a PYTHON-1725 Fix TestThreadsAuth.test_auto_auth_login
Create the database upfront to avoid test failures on sharded clusters.
2019-03-12 16:26:50 -07:00
Shane Harvey
ddfa412064 PYTHON-1644 Only run doctests against standalone servers 2019-03-12 16:25:26 -07:00
Shane Harvey
343a0b9768 BUMP 3.9.0b1.dev0 2019-03-07 15:34:50 -08:00
Shane Harvey
97af797898 BUMP 3.9.0b0 2019-03-07 15:34:50 -08:00
Shane Harvey
ee1541c5b8
PYTHON-1772 Fix flakey mock timeout tests for with_transaction (#415) 2019-03-07 15:34:42 -08:00
Shane Harvey
82131c4448
PYTHON-1671 Add ClientSession.with_transaction API (#411) 2019-03-07 13:37:13 -08:00
Bernie Hackett
7409f844e6 PYTHON-1740 - retryWrites defaults to true 2019-03-06 16:32:53 -08:00
Shane Harvey
57a9b62e9d
PYTHON-1767 Ignore keyPattern/keyValue fields in doctest duplicate key error (#412) 2019-03-05 18:23:00 -08:00
Shane Harvey
a84f50b998
PYTHON-1766 Use insert_many to reduce test runtime (#410) 2019-03-04 18:25:05 -08:00
Shane Harvey
1d79cf8f2d Add changelog for 3.7.2 (#407) 2019-03-01 11:04:26 -08:00
Shane Harvey
e64945101b PYTHON-1684 Support sharded transactions recovery token (#406)
Transient errors inside transaction unpins the session.
Add brief docs about sharded transactions and add 3.9 changelog.
Tests changes:
Add spec tests for sharded transaction recoveryToken.
Speed up txn tests by reducing SDAM waiting time after a network error.
Remove outdated test workaround for killAllSessions.
2019-02-27 15:59:18 -08:00
Shane Harvey
f9fa34dcd8 PYTHON-1759 Find/getMore command failures reset servers's SDAM state (#406) 2019-02-27 15:59:18 -08:00
Prashant Mital
99dd840d82 SPEC 1153: Document change in aggregate command behavior (#404) 2019-02-27 15:59:18 -08:00
Prashant Mital
2b1fdb091d SPEC 1153: Adding readConcern support to aggregation with $out (#400) 2019-02-27 15:59:18 -08:00
Shane Harvey
3030a5a094 PYTHON-1730 Use w:majority when retrying commitTransaction (#393) 2019-02-27 15:56:48 -08:00
Prashant Mital
902f4f5479 PYTHON-1722 Fix spec-test failures for the compression URI options (#391) 2019-02-27 15:56:48 -08:00
Prashant Mital
927a97e39b PYTHON-1670: Implement Unified URI Options (#386) 2019-02-27 15:56:48 -08:00
Shane Harvey
ec79300d3f PYTHON-1701 Avoid false positives in unpinning prose test
Wait until both mongoses are discovered, increase localThresholdMS,
and increase iteration count.
2019-02-27 15:56:48 -08:00
Shane Harvey
6bab444bd7 PYTHON-1673 Mongos pinning for sharded transactions
In a sharded transaction, a session is pinned to the mongos server
selected for the initial command. All subsequent commands in the same
transaction are routed to the pinned mongos server.
2019-02-27 15:56:48 -08:00
Shane Harvey
9902d239b4 PYTHON-1751 Resync transaction spec tests for bulk write error reporting change (#402) 2019-02-20 11:14:28 -08:00
Shane Harvey
9dcd828a0f
PYTHON-1739 Skip failing change stream test on sharded clusters (#397) 2019-02-07 16:01:32 -08:00
Thomas Hisch
19827c41ec PYTHON-1467 Remove outdated code for old python versions (#395) 2019-02-06 13:23:43 -08:00
Shane Harvey
c77a0d8e1f PYTHON-1719 Stop testing getpreverror on MongoDB 4.1+ 2019-01-31 17:00:26 -08:00
Shane Harvey
e9d433982b PYTHON-1734 Skip failing index tests on MongoDB 4.1 2019-01-31 17:00:15 -08:00
Shane Harvey
a913d34380 PYTHON-1706 Fix issues found by coverity pt. 2
Remove unused code.
2018-12-14 14:52:18 -08:00
Marek Skalický
51119f09ee PYTHON-1706 Fix issues found by coverity pt. 1 (#377) 2018-12-14 14:51:34 -08:00
Shane Harvey
ff5f1ce8a4
PYTHON-1704 Close periodic task thread when client is closed (#389) 2018-12-13 12:04:03 -08:00
Shane Harvey
1d8c73954c PYTHON-1691 Fix transaction test runner to read the latest data from the primary 2018-11-30 13:30:17 -08:00
Shane Harvey
c200c2cd0e
PYTHON-1658 Test that transaction reads ignore db/collection readConcern (#384)
Fix: properly skip tests that include 'skipReason'.
Revendor transaction spec tests at commit 367842f1ee4b80f75664a05c6b9d5b2498cf856d
2018-11-14 11:47:53 -08:00
Prashant Mital
b1fc024143
PYTHON-1683 Remove _partition and _rpartition from uri_parser module (#383) 2018-11-14 10:52:31 -08:00
Shane Harvey
e7114087c7 PYTHON-1682 UTF-8 encode unicode error messages on Python 2 2018-11-13 17:43:57 -08:00
Jason R. Coombs
341b2b5964 Document find_one_and_update return value on no match. (#361)
Trim excess whitespace.
2018-10-30 11:40:14 -07:00
Dmitry Volodin
384796b3fa PYTHON-1663 LIFO connection pool policy (#380) 2018-10-26 10:16:30 -07:00
Tony Narlock
22f83c5a55 Remove unused import (#379) 2018-10-25 10:44:38 -07:00
Shane Harvey
d43ca118f9 PYTHON-1654 Ignore $clusterTime in test_command assertion 2018-10-09 15:55:10 -07:00
Pascal Corpet
9dae3d06a2 Fix equality comparison of WriteConcern objects. (#378) 2018-10-09 15:05:47 -07:00
Shane Harvey
d571ac022c PYTHON-1647 Fix memory leak in OP_MSG C extensions 2018-10-09 13:24:13 -07:00
Shane Harvey
6fe00109c1 PYTHON-1650 Always increment txnNumber before starting a retryable write 2018-10-08 11:42:02 -07:00
Bernie Hackett
dea14beb86 PYTHON-1633 - Test Python 3.7 on Windows 2018-09-24 16:08:03 -07:00
Shane Harvey
f064cd449e PYTHON-1645 Only test zSeries on RHEL 7.2 2018-09-24 11:53:42 -07:00
Petr Messner
7f1939ebcb PYTHON-1642 - Replace count() with count_documents({}) in docs (#376) 2018-09-13 16:34:35 -07:00
Prashant Mital
bc26c0db69
PYTHON-1577 Allow applications to register a custom server selector (#371)
PYTHON-1577 Allow applications to register a custom server selector
2018-08-30 17:33:03 -05:00
Prashant Mital
58851e1221
PYTHON-1619 Implement ObjectID Specification (#373)
PYTHON-1619 Implement ObjectID Specification
2018-08-29 12:24:28 -05:00
Prashant Mital
00b672653e
FIX: explicitly state read and write concern in causal consistency examples (#374)
PYTHON-1623 Causal Consistency Examples for the Manual
2018-08-28 15:54:21 -05:00
Felipe Rodrigues
6afcf14f4f Add class docstring to MongoClient (#372) 2018-08-24 10:09:17 -07:00
Bernie Hackett
554195e33b PYTHON-1625 - Fix perf tests 2018-08-13 11:48:20 -07:00
Shane Harvey
5bc0c7080f
PYTHON-1624 Fix failing $out test on MongoDB latest (#369) 2018-08-10 15:26:04 -07:00
Prashant Mital
9aa7adab0f
PYTHON-1621 Modify change stream output example for manual (#370) 2018-08-10 15:21:54 -07:00
Prashant Mital
88ab7ed4ea
DOC: add manual example for causal consistency (#368)
* DOC: add manual example for causal consistency
2018-08-10 15:11:34 -07:00
Shrey Batra
98ce687567 Add GEOSPHERE to geospatial docs (#364)
Add warning for deprecated geoNear command.
2018-08-10 12:42:49 -07:00
Shane Harvey
2a306ab526
Remove Travis workarounds (#366) 2018-08-09 14:30:38 -07:00
Didi Bar-Zev
ff958b7d67 PYTHON-1617 Fix database name check in index cache (#363) 2018-07-25 10:18:25 -07:00
A. Jesse Jiryu Davis
fdcf61cccb PYTHON-1615 Update Cursor.hint doc 2018-07-22 22:42:47 -04:00
Bernie Hackett
eabc8d90ae Add 3.7.1 changelog entry 2018-07-17 19:48:47 -07:00
Bernie Hackett
a22719853e PYTHON-1613 Invalidate cache on changed salt or iterations 2018-07-14 12:38:53 -07:00
Bernie Hackett
47b0d8ebfd PYTHON-1392 PYTHON-1535 - Fix EVG path issues 2018-07-12 20:40:32 -07:00
Shane Harvey
7ca04999e9
PYTHON-1603 Truncate large datetimes properly (#362) 2018-07-09 16:28:48 -07:00
Bernie Hackett
466fdde12a PYTHON-1609 - Fix authing the same user more than once 2018-07-09 14:59:53 -07:00
Bernie Hackett
f51723de52 PYTHON-1541 - Use setuptools python_requires
To enforce minimum Python requirements.
2018-07-03 12:44:40 -07:00
Bernie Hackett
cbc81ee793 PYTHON-1536 - PyMongo no longer supports PyPy3 < 3.5 2018-07-03 12:44:40 -07:00
Bernie Hackett
a24d3f6e23 PYTHON-1606 - Update Ubuntu 12 and Debian 7 testing 2018-07-03 12:44:40 -07:00
Bernie Hackett
356eed66f5 PYTHON-1607 - Stop testing eval and SystemJS with MongoDB 4.1+ 2018-07-03 12:44:40 -07:00
Bernie Hackett
587e448b69 PYTHON-1604 - Stop testing reindex with mongos and MongoDB 4.1+ 2018-07-03 12:44:30 -07:00
Prayash Mohapatra
a537a711d1 Update README.rst - Support for MongoDB 4.0 (#359) 2018-07-03 09:45:13 -07:00
Bernie Hackett
749c1a2f0b PYTHON-1467 - PyMongo no longer supports Python 2.6 2018-07-02 15:15:43 -07:00
Bernie Hackett
c2fde81d60 PYTHON-1605 - Update mod_wsgi test config 2018-07-02 14:46:07 -07:00
Bernie Hackett
bf8019e7bc Start work on 3.8 2018-07-02 14:41:31 -07:00
Shane Harvey
35391b7c2c BUMP 3.7.0 2018-06-26 14:08:42 -04:00
Shane Harvey
b57e6e281f PYTHON-1599 Fix unchecked return value in cmessagemodule 2018-06-26 13:59:02 -04:00
Prashant Mital
f82706c870 PYTHON-1597 Don't run Change Stream tests on MMAPv1 (#356) 2018-06-26 13:01:20 -04:00
Shane Harvey
4f3b6467ab PYTHON-1598 Fix transaction write concern inheritance 2018-06-26 12:07:12 -04:00
Bernie Hackett
bc5a6e0557 PYTHON-1548 - Add a simple Appveyor config 2018-06-26 10:37:35 -04:00
Bernie Hackett
ccbd857838 PYTHON-1506 - Add CodecOptions examples 2018-06-25 23:13:15 -04:00
Shane Harvey
98e77ba1d2 PYTHON-1483 Prohibit unack'ed writes with explicit sessions 2018-06-25 13:55:50 -05:00
Bernie Hackett
8573099c4b Move time consuming utf8 tests out of the main suite 2018-06-24 20:45:59 -07:00
stephan-hof
9b632c776c Refactor the the assert into a separate function. 2018-06-24 19:59:16 -07:00
stephan-hof
e113a338e9 Improve the check for legal utf8 in the bson module.
Now python and bson have the same understanding of legal utf8.
2018-06-24 19:59:16 -07:00
Bernie Hackett
cb34e31cb0 PYTHON-1560 - Update transaction documentation link 2018-06-24 14:55:35 -07:00
Shane Harvey
3b9e99015f PYTHON-1508 Only send readConcern on first command in a transaction 2018-06-24 11:39:23 -04:00
Bernie Hackett
1bf9b461b0 PYTHON-1595 - Document operator migrations for count_documents 2018-06-23 13:39:57 -07:00
Shane Harvey
05c7c65470 PYTHON-1329 OP_MSG with unacknowledged writes
Replace OP_INSERT/OP_UPDATE/OP_DELETE usage with OP_MSG with moreToCome
flag when the server is 3.6 or greater.
Unack'ed OP_MSG supports bypass_document_validation.
getLastError updatedExisting is always false on mongos after an OP_MSG
unack'ed update.
2018-06-23 11:46:50 -04:00
Bernie Hackett
4a9c65eb22 PYTHON-1329 - OP_MSG unacknowledged bulk writes 2018-06-22 22:00:07 -07:00
Bernie Hackett
f8883dfb1f PYTHON-1329 - Fix C extensions use for compression 2018-06-21 17:30:15 -07:00
Bernie Hackett
4d786fd0cd PYTHON-1329 - OP_MSG bulk writes 2018-06-21 16:03:20 -07:00
Shane Harvey
ea8cb6c209 PYTHON-1329 Send/receive commands as OP_MSG
Don't use $query with OP_MSG.
Support compression with OP_MSG.
2018-06-21 15:46:48 -07:00
Shane Harvey
994cf80c7c PYTHON-1545 Resume more getMore errors for ChangeStreams 2018-06-21 12:41:30 -07:00
Prashant Mital
96291c88b0
PYTHON-1565 Add helpers and options for Change Streams Follow-on Work (#355)
PYTHON-1565 Add helpers and options for Change Streams Follow-on Work (#355)

Add MongoClient.watch() and Database.watch().
Add start_at_operation_time to all watch() helpers.
2018-06-21 12:22:59 -07:00
Bernie Hackett
388339e187 PYTHON-1591 - Deprecate Collection.parallel_scan 2018-06-21 12:03:42 -07:00
Bernie Hackett
709b28467f PYTHON-1586 - Deprecate database_names and collection_names 2018-06-18 10:52:11 -07:00
Bernie Hackett
e6b0f3847d PYTHON-1581 - Deprecate Collection/Cursor count 2018-06-18 10:50:26 -07:00
Shane Harvey
9d8024d9ea PYTHON-1590 Avoid thread limit in tests 2018-06-15 13:17:37 -07:00
Shane Harvey
b5e9007af0 PYTHON-1508 PYTHON-1589 Expand where unknown commit label is raised
Remove has_label api.
Bump required server version for transactions.
2018-06-15 11:29:11 -07:00
Shane Harvey
622d33d0cb PYTHON-1545 Support for retryable writeConcernErrors
Return proper BulkWriteResult after a retryable write succeeds.
Reduce retryable writes test suite time from 90 to 30 seconds by
reducing the heartbeat interval.
2018-06-14 09:51:08 -07:00
Shane Harvey
96aaf2f527 PYTHON-1562 Add transaction examples for docs 2018-06-13 18:01:34 -07:00
Bernie Hackett
3d8155d87d Claim support for Python 3.7 2018-06-13 13:56:55 -07:00
Bernie Hackett
657b07828e Update changelog 2018-06-13 13:53:51 -07:00
Shane Harvey
4cce6d4cdb PYTHON-1555 Raise more specific errors when SSL handshake fails
Always raise CertificateError directly.
2018-06-12 16:37:58 -07:00
Shane Harvey
a423dc6b1b PYTHON-1583 Update ChangeStream tests for "drop" operationType 2018-06-12 11:01:10 -07:00
Shane Harvey
adbcc2d6d4 PYTHON-1582 Fix TestChangeStream.test_next_blocks 2018-06-12 11:01:10 -07:00
Shane Harvey
a15c8283dc PYTHON-1584 Skip maxScan tests on 4.1+ 2018-06-12 10:20:49 -07:00
Bernie Hackett
91c3793703 PYTHON-1580 - Implement new count API 2018-06-08 14:27:04 -07:00
Bernie Hackett
bb8130abd8 PYTHON-1273 - Cache SCRAM ClientKey and ServerKey 2018-06-08 14:24:05 -07:00
Bernie Hackett
fc4e8558d6 PYTHON-1574 Don't test TLS with Python26/Windows/MongoDB 4.0+
Python 2.6.6, the last version that shipped installers for
Windows, bundles OpenSSL 0.9.8, which doesn't support TLS 1.1+.
MongoDB 4.0+ requires TLS 1.1+ by default.
2018-06-07 19:23:01 -07:00
Shane Harvey
e4317d286b PYTHON-1508 Retryable commit/abort, has_error_label api
Retryable commitTransaction/abortTransaction.
Retry writes after certain writeConcernErrors.
Add has_error_label api.
Update unacknowledged write concern error messge.
Resync transaction tests and update test runner.
2018-06-07 14:39:52 -07:00
Shane Harvey
96aeb461f9 PYTHON-1545 Consider more errors retryable 2018-06-07 14:37:01 -07:00
Bernie Hackett
64cf053092 PYTHON-1524 - Fix Collection options handling 2018-06-07 07:11:26 -07:00
Bernie Hackett
548343c29e PYTHON-1551 - Deprecate MongoClient.close_cursor 2018-06-06 11:17:02 -07:00
A. Jesse Jiryu Davis
32d3f0e80b Spelling 2018-06-06 10:17:19 -04:00
Shane Harvey
6810b454d4 Don't use private slot names on class names with leading underscores 2018-06-05 10:05:39 -07:00
A. Jesse Jiryu Davis
7bd1fac5d6 Obsolete docstring for end_session 2018-06-04 21:54:12 -04:00
Bernie Hackett
577c167c88 PYTHON-1546 - Update various spec tests and adjust runners 2018-06-04 15:44:13 -07:00
Shane Harvey
022da1f5a7 PYTHON-1563 Init ClientContext before test
Increase connect timeout to reduce test flakes.
2018-06-04 14:44:23 -07:00
Bernie Hackett
7d278b2feb PYTHON-1534 - Catch NXDOMAIN for TXT lookups 2018-06-04 13:57:36 -07:00
Bernie Hackett
dbf386c18c PYTHON-1527 - Fix default writeConcern override 2018-06-04 13:56:06 -07:00
Bernie Hackett
8cc2f72e20 PYTHON-1471 - Reenable arbiter tests on 4.0 and latest 2018-06-04 13:54:38 -07:00
Bernie Hackett
3c36692f40 PYTHON-1532 - Clean up after test_lazy_connect_w0 2018-06-04 13:53:08 -07:00
Bernie Hackett
02191a91ea PYTHON-1544 - Resync SDAM tests 2018-06-03 08:19:06 -07:00
Bernie Hackett
b937130364 PYTHON-1537 - Remove test/high_availability 2018-06-03 08:12:45 -07:00
Bernie Hackett
cb85eb02a2 PYTHON-1563 - Avoid import deadlocks in the test suite 2018-06-03 07:34:26 -07:00
A. Jesse Jiryu Davis
c63c068611 PYTHON-1564 Add DriverInfo to handshake metadata
Allow drivers that wrap PyMongo to add their info to the handshake
metadata, using a "driver" option like:

  MongoClient(driver=DriverInfo("MyDriver", "1.2.3"))

The DriverInfo is appended to PyMongo's own metadata.
2018-06-03 10:04:45 -04:00
Bernie Hackett
981e39281f PYTHON-1529 - No implicit sessions with parallel_scan 2018-06-01 18:32:44 -07:00
Bernie Hackett
54b8058c66 PYTHON-1571 - Skip group tests with MongoDB 4.1+ 2018-06-01 18:29:30 -07:00
Bernie Hackett
83eb724aa2 PYTHON-1570 - Add MongoDB 4.0 to the Evergreen matrix 2018-06-01 18:29:30 -07:00
Shane Harvey
ca6a34f51d PYTHON-1508 SPEC-1097 Resync transaction tests
Database.command without a read_preference defaults to the
transaction's or Primary if the session is not in a transaction
Add runCommand transaction tests.
Update count tests.
2018-06-01 16:29:11 -07:00
Bernie Hackett
3fd6fd9784 PYTHON-1572 - Don't import hash functions until needed 2018-06-01 07:53:25 -07:00
Bernie Hackett
61850357a0 PYTHON-1521 - Use FNV-1a for ObjectId machine bytes 2018-05-31 12:26:53 -07:00
Shane Harvey
714577c83e PYTHON-1508 commitTransaction can be called multiple times
This change allows applications to check if their transaction was commited or
not by repeatedly calling commit until the transaction state is known.
If a session is used after a commit for any operation (not including
another commit), the operation is not part of a transaction and the session's
transaction state is reset.
2018-05-29 14:33:21 -07:00
Shane Harvey
5a9b3340d9 PYTHON-1508 Fix read preference regression in mapreduce 2018-05-24 13:53:22 -07:00
Shane Harvey
3c2432d641 PYTHON-1543 Write operations should raise WTimeoutError 2018-05-23 19:57:00 -07:00
Bernie Hackett
3e075b0a58 PYTHON-1278 - Fix Windows builds 2018-05-22 15:35:39 -07:00
Shane Harvey
5ff33a2a37 PYTHON-1554 Fix datetime decoding memory leak 2018-05-22 13:42:59 -07:00
Shane Harvey
cac0d5548f PYTHON-1508 Remove autoStartTransaction and resync tests
Also use the test file's database name and collection name.
2018-05-22 13:29:41 -07:00
Bernie Hackett
335cb97a34 PYTHON-1278, PYTHON-1553 - Support OP_COMPRESSED 2018-05-22 11:44:21 -07:00
Prashant Mital
505b6ebc37
PYTHON-1558 Use nameOnly option in list_collection_names and collection_names methods 2018-05-18 14:29:44 -07:00
Nikolai Matiushev
72cab9356d PYTHON-1556 Fix compatibility issues with Python >= 3.6 (#352)
Use raw strings to avoid invalid escape sequence warnings in Python >= 3.6
2018-05-15 15:20:03 -07:00
Shane Harvey
5a652be993 PYTHON-1508 Add read_preference to TransactionOptions
All read operations use the transaction's read preference.
Add transaction read preference spec tests.
Remove write test in test_read_preferences.
2018-05-08 11:38:28 -07:00
Shane Harvey
04693ae33a PYTHON-1513 Efficiently read data using memoryview and recv_into
On Python 2, preallocate a bytearray and use slice assignment instead of
using str +=.
On Python 3, preallocate a bytearray and use a memoryview with recv_into.
2018-05-08 11:28:12 -07:00
Shane Harvey
9dd16cefc4 PYTHON-1549 Pop time fields before comparing last error responses 2018-05-03 09:57:46 -07:00
Shane Harvey
7aeec7b56b PYTHON-1508 Remove stmtId from transaction commands
The statement identifier is no longer required by the server.
2018-04-25 16:04:13 -07:00
Shane Harvey
876fa50dbd PYTHON-1508 Transaction tests require 3.7.7 2018-04-25 16:04:05 -07:00
Bernie Hackett
984977ba9e PYTHON-1425 - Implement the auth spec and tests 2018-04-25 10:25:00 -07:00
Bernie Hackett
94c680c7da PYTHON-1436 - Test with only TLSv1.2 2018-04-25 09:04:26 -07:00
Bernie Hackett
6e340f889d Continue work on 3.7 2018-04-25 09:03:48 -07:00
Shane Harvey
537b033327 BUMP 3.7.0b0 2018-04-18 10:03:26 -07:00
Bernie Hackett
d8abb4b3f3 Improve Atlas and TLS documentation 2018-04-17 18:01:16 -07:00
Shane Harvey
958642f74f PYTHON-1508 Transaction beta examples for docs 2018-04-17 16:56:01 -07:00
Shane Harvey
ffcd66561f PYTHON-1508 Add has_label to temporary transaction errors 2018-04-17 16:56:01 -07:00
Shane Harvey
d1ee646d72 PYTHON-1508 Expand transaction documentation 2018-04-17 13:23:52 -07:00
Shane Harvey
a9b48a1242 PYTHON-1508 Remove obsolete transaction tests 2018-04-17 13:23:52 -07:00
Bernie Hackett
d37164e340 PYTHON-1436 - Test pypy3.2 connections to Atlas 2018-04-17 12:03:42 -07:00
Bernie Hackett
03f8d56d8a PYTHON-1436 - Test against Atlas with TLSv1.0 disabled 2018-04-17 12:02:07 -07:00
A. Jesse Jiryu Davis
e945190688 Sync transactions spec tests 2018-04-17 09:37:48 -04:00
A. Jesse Jiryu Davis
a9e643241d PYTHON-1508 Jython-compatible transaction tests 2018-04-17 09:37:47 -04:00
Bernie Hackett
84d0338d39 Update changelog for 3.7 work so far 2018-04-16 21:27:01 -07:00
Bernie Hackett
82c6bdbac1 PYTHON-1526 - Update SCRAM-SHA-256 for spec change 2018-04-16 21:05:10 -07:00
Shane Harvey
1e6b7f7eed PYTHON-1523 Do not send default writeConcern 2018-04-16 14:56:43 -07:00
A. Jesse Jiryu Davis
c194109c0f Test aggregate in transactions 2018-04-16 14:56:11 -07:00
A. Jesse Jiryu Davis
34ab244898 Obsolete workaround in test_transactions.py 2018-04-16 14:56:06 -07:00
A. Jesse Jiryu Davis
9eab96259f Kill sessions before starting transaction test 2018-04-16 09:57:45 -04:00
A. Jesse Jiryu Davis
95d8f783c0 Resync transactions spec tests 2018-04-16 09:57:45 -04:00
A. Jesse Jiryu Davis
3da3ab4d1a Update transactions test runner 2018-04-16 09:57:45 -04:00
A. Jesse Jiryu Davis
8d4626c623 Don't send writeConcern within transaction 2018-04-16 09:57:45 -04:00
A. Jesse Jiryu Davis
61b7d0f042 Configurable read concern with start_transaction 2018-04-16 09:57:45 -04:00
Shane Harvey
09891a4ff3 Bring autoStartTransaction up to spec 2018-04-16 09:57:45 -04:00
Shane Harvey
5bff89d932 Add TODO to omit writeConcern 2018-04-16 09:57:45 -04:00
Shane Harvey
ab73a7a164 Re-sync transactions tests 2018-04-16 09:57:45 -04:00
Shane Harvey
b4f153a811 Add and test default_transaction_options 2018-04-16 09:57:45 -04:00
Shane Harvey
e5f5fa229b Revert read_preference pinning 2018-04-16 09:57:45 -04:00
Shane Harvey
a2937aa8eb Revert "Pin transactions to a single server address"
This reverts commit 25bc0858ff566abfabadeca4a3fea177e9c2697c.
2018-04-16 09:57:45 -04:00
Shane Harvey
c6488c117d Ending a session always aborts the transaction 2018-04-16 09:57:45 -04:00
Shane Harvey
c66235176e Test find/getMore with stmtId in transactions 2018-04-16 09:57:45 -04:00
Shane Harvey
3b02e59b70 Add errorCodeName assertion to transaction tests 2018-04-16 09:57:45 -04:00
Shane Harvey
0967c7ed6c Add startTransaction:true to the start of all transactions
Also add autocommit:false to all commands in transactions.
2018-04-16 09:57:45 -04:00
A. Jesse Jiryu Davis
fca0058566 Ignore all server/network errs in abort_transaction 2018-04-16 09:57:45 -04:00
A. Jesse Jiryu Davis
4579cd1eb0 Test multi-deletes in transactions 2018-04-16 09:57:45 -04:00
Shane Harvey
f710664f9a Test abortTransaction ignores TransactionAborted errors 2018-04-16 09:57:45 -04:00
Shane Harvey
6f217ec3f2 Test incrementing txnNumber with retryable writes and transactions 2018-04-16 09:57:45 -04:00
Shane Harvey
6eb0e13393 Support causal consistency with transactions 2018-04-16 09:57:45 -04:00
Shane Harvey
712637ac8b Refactor transaction attributes into _Transaction class
Re-sync transaction spec tests.
2018-04-16 09:57:45 -04:00
Shane Harvey
015cdf1fb6 Session may be None in retryable write code path 2018-04-16 09:57:45 -04:00
Shane Harvey
673de92ec2 Transactions inherit writeConcern from client 2018-04-16 09:57:45 -04:00
Shane Harvey
49494c2548 Add support for start_transaction with-statement 2018-04-16 09:57:45 -04:00
Shane Harvey
656aa1e703 Pin transactions to a single server address 2018-04-16 09:57:45 -04:00
A. Jesse Jiryu Davis
116d2c278f Update _finish_transaction()
Check if the session is ended, and always increment txnNumber.
2018-04-16 09:57:45 -04:00
A. Jesse Jiryu Davis
6671ee242c Parse sessionOptions from tests, not transactionOptions 2018-04-16 09:57:45 -04:00
A. Jesse Jiryu Davis
b41c2af3a0 Enable session.abort_transaction() 2018-04-16 09:57:45 -04:00
A. Jesse Jiryu Davis
3177616f53 Re-sync spec tests from #e9791101 2018-04-16 09:57:45 -04:00
Shane Harvey
cd92850b36 Test changing transaction readPreference
Add original readPreference to getMores to simplify code check.
2018-04-16 09:57:45 -04:00
A. Jesse Jiryu Davis
17d94ea8af fix bulkWrite transaction test, import transactional write tests 2018-04-16 09:57:45 -04:00
A. Jesse Jiryu Davis
c305f14e18 cache Query/GetMore.as_command, send stmtId with commit/abortTransaction
fix comparison of insertedIds in test_transactions.py
2018-04-16 09:57:45 -04:00
A. Jesse Jiryu Davis
54ba1b34f3 rewrite how ClientSession handles _ServerSession 2018-04-16 09:57:45 -04:00
A. Jesse Jiryu Davis
00878a2f53 new logic for error scenarios 2018-04-16 09:57:45 -04:00
A. Jesse Jiryu Davis
9df87b6401 prototype transaction tests 2018-04-16 09:57:45 -04:00
Bernie Hackett
04de1697cb PYTHON-1436 - Automate Atlas connectivity tests 2018-04-09 17:04:15 -07:00
Mateusz Piotrowski
d672c40524 Stylize GitHub correctly (#351)
Fix a link to PyMongo GitHub source
2018-04-06 13:30:32 -07:00
Bernie Hackett
cb2c67eadd PYTHON-1515 - Add MongoDB 3.4 benchmarks 2018-04-06 13:26:20 -07:00
Bernie Hackett
73478106eb PYTHON-1463 - Implement read / write concern spec 2018-04-06 12:55:09 -07:00
Bernie Hackett
8f7aa361a5 PYTHON-1487 - Resync GriFS spec tests 2018-04-05 15:12:52 -07:00
Bernie Hackett
3cd6f32e7c PYTHON-1509 - Update auth docs for SCRAM-SHA-256 2018-03-30 19:17:35 -07:00
Bernie Hackett
6c09ce0a1e PYTHON-1454 - Document the status of MONGODB-CR in MongoDB 2018-03-30 19:05:14 -07:00
Bernie Hackett
1c7085d371 PYTHON-1458 - Make MD5 digest optional in GridFS 2018-03-30 18:59:19 -07:00
Bernie Hackett
0b72e369f3 PYTHON-1501 - Deprecate max_scan 2018-03-30 18:58:03 -07:00
Bernie Hackett
5423c5b0a0 PYTHON-1465 - Agg, cmd, and index examples for docs 2018-03-30 16:49:34 -07:00
Bernie Hackett
15f62db70c Remove SUSE 11 from CI testing
It ships OpenSSL 0.9.8, which doesn't support
TLS 1.2, making it impossible to install packages
from PyPI once all previous protocols are disabled.
2018-03-22 17:03:27 -07:00
Bernie Hackett
f847be3fcb PYTHON-1502 - Deprecate the snapshot cursor option 2018-03-22 08:47:34 -07:00
Shane Harvey
a30eb87db3 PYTHON-1495 Document PythonAnywhere incompatibility 2018-03-08 13:00:08 -08:00
Bernie Hackett
f3cec2b7b2 PYTHON-1496 - Support Sphinx 1.7 2018-03-06 20:30:11 -08:00
Bernie Hackett
5b9257644f PYTHON-1464 - Implement SCRAM-SHA-256 2018-03-06 17:54:40 -08:00
Bernie Hackett
00968e5bb1 PYTHON-1457 - Implement SASLprep 2018-03-06 17:54:40 -08:00
Bernie Hackett
3733971e35 PYTHON-1456 - Use SSLContext.check_hostname with Python 3.7+
Continue using our bundled match_hostname otherwise.
2018-03-06 17:25:49 -08:00
Bernie Hackett
e2332fb5f2 PYTHON-1494 - Test PyPy 3.5 in Evergreen 2018-03-06 15:52:58 -08:00
Bernie Hackett
fd68e161fe PYTHON-1461 - Test Python 3.7 in Evergreen 2018-03-06 15:52:58 -08:00
Bernie Hackett
1e9296abf2 Start work on 3.7 2018-03-06 15:52:08 -08:00
Shane Harvey
a9e2192919 BUMP 3.6.1 2018-02-28 19:00:09 -08:00
Shane Harvey
9cecbb2ae5 PYTHON-1491 Skip failing OP_KILL_CURSORS test 2018-02-28 13:05:05 -08:00
Shane Harvey
79a327b752 PYTHON-1474 Return cursor sessions as quickly as possible
Return implicit sessions to the pool as soon as the cursor is exhausted
instead of waiting for garbage collection.
2018-02-27 16:03:25 -08:00
Bernie Hackett
e7e4833112 PYTHON-1485 - Strongly encourage the use modern TLS protocols 2018-02-27 12:55:32 -08:00
Shane Harvey
3c6ffb895e PYTHON-1471 Disable failing arbiter tests on MongoDB latest 2018-02-27 09:45:56 -08:00
Shane Harvey
0e6b425870 PYTHON-1475 Create shallow copy of session pool before iteration 2018-02-26 16:04:02 -08:00
Shane Harvey
5f3f398ff1 PYTHON-1415 Fail CI when test suite cannot connect 2018-02-26 15:50:56 -08:00
Bernie Hackett
4fa72033dd PYTHON-1488 - Fix auth tests for MongoDB 3.7 2018-02-26 15:32:55 -08:00
Shane Harvey
0aefc6c19b PYTHON-1434 Update max cluster time even when heartbeats fail 2018-02-26 11:00:00 -08:00
Shane Harvey
1fa894d757 PYTHON-1434 Don't resend client metadata on the same socket 2018-02-26 11:00:00 -08:00
Bernie Hackett
2c932dfe77 PYTHON-1477 PYTHON-1478 PYTHON-1480 - Doc improvements 2018-02-22 17:14:28 -08:00
Shane Harvey
b86c1e6019 PYTHON-1482 Fix monotonic time import for Python 2
Add changelog for 3.6.1
2018-02-21 17:01:03 -08:00
Shane Harvey
251df6abd1 PYTHON-1482 Fix maxIdleTime reaper calculation 2018-02-21 17:01:03 -08:00
A. Jesse Jiryu Davis
37778bac3e PYTHON-1479 - Don't add projection to "find" cmd twice, 2 2018-02-21 17:59:06 -05:00
Shane Harvey
77804b1aed PYTHON-1422 Don't update a closed topology 2018-02-20 14:12:32 -08:00
Bernie Hackett
585d0fbd4f PYTHON-1470 - Fix test_create for 3.7+ mongos 2018-02-20 13:46:48 -08:00
Bernie Hackett
1736f702a0 PYTHON-1469 - Ignore unexpected error fields in tests 2018-02-20 13:46:48 -08:00
A. Jesse Jiryu Davis
2ad6117af2 PYTHON-1479 - Don't add projection to "find" cmd twice 2018-02-16 09:46:47 -05:00
Shane Harvey
0779443c9d PYTHON-1428 Respect maxPoolSize when minPoolSize is set 2018-02-13 16:37:26 -08:00
Bernie Hackett
cacc0ab877 PYTHON-1459 - Remove uses of the forceerror command 2018-02-13 09:59:23 -08:00
Bernie Hackett
d190b37d15 PYTHON-1440 - Use with in watch examples 2018-02-13 09:56:44 -08:00
Bernie Hackett
ba7c95a9df PYTHON-1462 - Import ABCs from collections.abc 2018-02-12 19:42:44 -08:00
Bernie Hackett
ad348a2e0b PYTHON-1277 - Port benchmark tests to Evergreen 2018-02-12 19:30:19 -08:00
aherlihy
6656b7c985 Add performance tests 2018-02-12 19:30:19 -08:00
Bernie Hackett
6391d0b499 PYTHON-1455 - Fix fsync test for Python 3.7+ 2018-02-12 19:24:09 -08:00
Bernie Hackett
be629bd884 PYTHON-1441 - Ignore batchSize in agg with $out stage 2018-02-12 19:20:26 -08:00
Bernie Hackett
8929080e7a PYTHON-1445 PYTHON-1446 PYTHON-1448 - More examples 2018-02-12 19:13:44 -08:00
rdb
077fb2041a Allow fields to be a set (#347)
Add test cases for set and tuple projection arguments.
2018-02-12 11:33:36 -08:00
Shane Harvey
1a784e1afb PYTHON-1466 Silence minor complaints from Coverity
Remove useless NULL check as GETSTATE cannot return NULL after
successful initialization.
2018-02-12 11:31:48 -08:00
Derek Frank
fde5b8685e Update tools documentation (#345)
Add testing driver, mongomock.
Add new ORM-like framework, uMongo.
Update no longer maintained ORM-like libraries, MongoKit, MongoAlchemy, 
minimongo, and Manga.
2018-02-12 11:31:41 -08:00
kalvdans
d08c2587f5 Use formatting operator to format error message (#348) 2018-02-12 08:23:22 -08:00
Bernie Hackett
bb24a96582 Start work on 3.6.1 2018-02-01 13:14:47 -08:00
Shane Harvey
5db2048df6 BUMP 3.6.0 2017-12-05 14:39:25 -08:00
nesdis
bc9df037e1 Djongo: A MongoDB connector for Django
Djongo is a connector for using Django with MongoDB as the database backend
2017-12-04 09:58:04 -08:00
nesdis
e1c7fb455f Djongo
A connector for using Django with MongoDB
2017-12-04 09:58:04 -08:00
nesdis
eedbb3ed01 Djongo connector for MongoDB
Djongo is a connector for using   Django with MongoDB as the database backend
2017-12-04 09:58:04 -08:00
nesdis
38fac8c3e3 Update tools.rst 2017-12-04 09:58:04 -08:00
Bernie Hackett
507f954ed4 Update copyright dates 2017-12-01 17:23:39 -08:00
Bernie Hackett
de801be529 Silence various complaints from Coverity 2017-11-30 15:02:20 -08:00
Shane Harvey
96b6f8d0d4 Update changelog and causal docs for 3.6. 2017-11-30 14:55:23 -08:00
Shane Harvey
2a05236f61 PYTHON-1332 Only gossip cluster time on >= 3.6.
Do not add readConcern to explain.
Test explain with collation.
2017-11-30 14:53:14 -08:00
Shane Harvey
36e585bdbf PYTHON-1427 Always initialize Cursor attributes used in __del__.
Prevents attribute errors during garbage collection.
2017-11-29 12:38:40 -08:00
Shane Harvey
b628fcbae2 Fully compare write results in check_result. 2017-11-29 11:15:38 -08:00
Bernie Hackett
e42897e79e PYTHON-1418 - More spec updates 2017-11-29 10:52:05 -08:00
Shane Harvey
e554d6116c PYTHON-1419 Call endSessions on MongoClient.close. 2017-11-28 14:26:25 -08:00
Shane Harvey
8416c73ca7 PYTHON-1421 Ensure Server monitor threads are (re)opened. 2017-11-28 11:56:13 -08:00
Shane Harvey
628cd2d5ef PYTHON-1420 Fix heartbeatFrequencyMS ConfigurationError. 2017-11-28 11:53:25 -08:00
Shane Harvey
9018525ac8 BUMP 3.6rc1.dev0. 2017-11-28 11:51:53 -08:00
Shane Harvey
36a31ff94a BUMP 3.6rc0. 2017-11-20 14:36:38 -08:00
Shane Harvey
47302096f9 PYTHON-1339 Retryable multi-statement writes.
MongoClient with retryWrites=true works when the cluster does not support retryable writes.
2017-11-20 12:18:00 -08:00
Shane Harvey
9d7b4c44ce PYTHON-1338 Update change stream documentation. 2017-11-17 16:17:06 -08:00
Bernie Hackett
a689aa63ca PYTHON-1418 - Update initial DNS seedlist implementation for spec changes 2017-11-17 15:35:21 -08:00
Shane Harvey
b669cd86dc PYTHON-1332 Session may only be used by the client that started it.
Centralize $clusterTime receiving.
2017-11-17 09:27:21 -08:00
Bernie Hackett
27d94755df PYTHON-1412 - Add 3.6 to Evergreen testing matrix 2017-11-16 20:10:09 -08:00
Bernie Hackett
99aefd6847 PYTHON-1413 - Restrict when we add readConcern 2017-11-16 19:12:23 -08:00
Shane Harvey
8c3c56218b PYTHON-1414 Jython takes a long time to connect.
Raise Jython memory limit for enterprise auth tests.
2017-11-16 13:42:47 -08:00
Bernie Hackett
86791d8e9b Update docs and changelog 2017-11-14 16:39:12 -08:00
ramiscoding
34d3dc7d86 Removing unused datetime module import 2017-11-14 15:58:54 -08:00
ramiscoding
e95a9ae478 Modifying the copyright date for reproducibility 2017-11-14 15:58:54 -08:00
ramiscoding
3ff3ce7937 Reproducibility-fix 2017-11-14 15:58:54 -08:00
Bernie Hackett
ae24c4c8b3 PYTHON-1406 - Fix causal test failures 2017-11-14 10:00:40 -08:00
Shane Harvey
47cab04f49 PYTHON-1407 Exclude non-data bearing servers when considering logicalSessionTimeoutMinutes 2017-11-14 09:35:05 -08:00
Bernie Hackett
b878ed60ca PYTHON-1409 - Improve server compatibility error messages 2017-11-13 15:03:47 -08:00
Shane Harvey
49cee292cc PYTHON-1408 Cursor iteration should complete when another thread closes the cursor.
Closing a cursor should not raise an error when killCursors fails.
2017-11-13 13:08:38 -08:00
Shane Harvey
28969a7f9e PYTHON-1407 Ignore non-readable servers' session timeout. 2017-11-13 11:50:19 -08:00
Shane Harvey
a4f58cce53 PYTHON-1404 Avoid copying RawBSONDocument.raw. 2017-11-10 15:45:04 -08:00
Bernie Hackett
6507d263b9 PYTHON-1398 - Raw batch methods do not support sessions 2017-11-10 10:02:29 -08:00
Shane Harvey
6c8f5a2fee PYTHON-1332 Remove session workaround for createUser.
parallel_scan does use implicit sessions.
2017-11-09 19:39:27 -08:00
Bernie Hackett
7ab179067b PYTHON-1299 - More test cleanup 2017-11-09 18:53:29 -08:00
Bernie Hackett
4eda4ffaec PYTHON-1340 - Implement causally consistent reads 2017-11-09 17:16:55 -08:00
Bernie Hackett
1e802b3108 PYTHON-1310, PYTHON-1311 - Deprecate add_user and remove_user
Also document what to use instead.
2017-11-09 16:58:39 -08:00
Bernie Hackett
1227f5544d PYTHON-1280 - Support maxTimeMS in index management methods 2017-11-09 15:57:50 -08:00
Bernie Hackett
036188a832 PYTHON-1385 - Publish command responses in _first_batch 2017-11-09 10:24:18 -08:00
Bernie Hackett
a6155c59c6 PYTHON-1380 - Port compatibility policy document to PyMongo 3 2017-11-08 18:04:14 -08:00
Shane Harvey
95d42a857b PYTHON-1405 Test ChangeStreams on mongos. 2017-11-08 16:05:52 -08:00
Shane Harvey
ba0c528380 PYTHON-1338 Add readConcern ChangeStream test. 2017-11-08 16:04:53 -08:00
Shane Harvey
cb52e93212 PYTHON-1401 Always test CRUD spec test "result".
aggregate $out cursors return no documents.
2017-11-08 12:59:45 -08:00
Bernie Hackett
25cb3481c5 PYTHON-1383 - Don't mention "connect=False" in fork warning 2017-11-08 11:40:03 -08:00
Brian Moss
89b3c4a508 PYTHON-1399 Update MongoDB connection URL for GSSAPI auth 2017-11-08 11:30:37 -08:00
Bernie Hackett
2719464837 PYTHON-1352 - Move BSON type map docs from bson.son.SON to bson 2017-11-08 11:24:28 -08:00
Bernie Hackett
b69a55c881 PYTHON-1400 - Use virtualenv when not using toolchain python 2017-11-08 11:18:58 -08:00
Shane Harvey
6a5856a608 PYTHON-1299 Remove unused MongoDB 2.4 bulk result code. 2017-11-08 10:59:36 -08:00
Shane Harvey
280efd2d72 PYTHON-1339 Generate a single message in _do_batched_write_command.
Ordered op_insert should check for errors on the last insert.
Use _Bulk API for Collection.insert.
Avoid sending acknowledged inserts as much as possible.
max_cmd_size already accounts for trailing null bytes.
2017-10-31 16:59:26 -04:00
Shane Harvey
8b1aa3aafa PYTHON-1339 Retryable single-statement writes.
Add retryWrites MongoClient and URI setting.
Retry once for supported single-statement write operations including:
insert_one, update_one, delete_one, find_one_and_update, find_one_and_replace,
find_one_and_delete, update and remove with multi=False, and find_and_modify.
2017-10-30 14:23:16 -04:00
Shane Harvey
5b5128c773 PYTHON-1394 Close ChangeStream cursor when the resume token is missing. 2017-10-30 10:28:46 -04:00
Shane Harvey
4d2825b0af PYTHON-1372 Avoid using RawBSONDocument in ChangeStream. 2017-10-30 10:28:46 -04:00
Jagrut
3d28006aba Add name to contributor list (#341) 2017-10-30 07:28:31 -07:00
Bernie Hackett
c5c29200c7 PYTHON-1393 - Change streams examples for docs 2017-10-27 19:35:49 -07:00
Bernie Hackett
af276ca7a4 PYTHON-1395 - Use rhel62-small instead of -test 2017-10-27 14:19:31 -07:00
Bernie Hackett
95c6513e18 PYTHON-1375 - Run mockup tests against PyMongo master 2017-10-27 13:50:58 -07:00
Bernie Hackett
73a6356385 PYTHON-1325 - Deprecate the aggregate useCursor option 2017-10-27 13:49:31 -07:00
Bernie Hackett
822ae0f6c6 PYTHON-1391 - Only use bare except: when re-raising 2017-10-27 13:45:25 -07:00
Bernie Hackett
cd97b5c5c0 PYTHON-1384 - Fix test_cert_ssl_validation_hostname_matching 2017-10-27 13:44:00 -07:00
Bernie Hackett
0af101d831 PYTHON-1390 - Migrate enterprise auth tests 2017-10-26 17:44:01 -07:00
Bernie Hackett
f107c08754 PYTHON-1355 - list_collections improvements 2017-10-26 16:50:19 -07:00
jagrut
8468dfdd41 PYTHON-1355 Implement Collections Enumeration spec. (#336)
New method Collection.list_collections.
2017-10-24 14:15:01 -07:00
Bernie Hackett
5d05ad2748 PYTHON-1379 - Implement Database Enumeration spec 2017-10-24 13:24:56 -07:00
Bernie Hackett
ffdcfd5809 PYTHON-1378 - Various fixes
- Don't use _escapify
- Always return str in python 3
- Further exception handling improvements
2017-10-24 13:21:42 -07:00
A. Jesse Jiryu Davis
dcd8f68994 PYTHON-1332 - send $clusterTime with isMaster 2017-10-23 18:01:59 -04:00
Bernie Hackett
5705b10d57 PYTHON-1378 - Fix DNS seedlist discovery with Eventlet
This change also adds Python 3 support for dnspython versions
back to 1.13.0, the first version to support Python 3.
2017-10-20 14:59:19 -07:00
Bernie Hackett
c84f73022b Fix mod_wsgi tests in Evergreen 2017-10-20 12:57:27 -07:00
Bernie Hackett
732b0f15df PYTHON-1378 - Implement DNS seedlist discovery 2017-10-19 13:53:02 -07:00
Shane Harvey
6721e0157b Revert "PYTHON-1299 Remove "safe" legacy messages."
This reverts commit da8fabc49a.
2017-10-12 12:14:33 -07:00
A. Jesse Jiryu Davis
df018e88e2 PYTHON-1332 - Gossip $clusterTime 2017-10-12 09:08:38 -04:00
Shane Harvey
f0b847adb8 PYTHON-1329 Refactor wire protocol message parsing.
Use _OpReply class instead of passing bytes around.
Remove unnecessary operation argument to receive message.
Move _first_batch to message.py to avoid circular import.
2017-10-09 15:11:50 -07:00
Bernie Hackett
1596c5d94d PYTHON-1390 - Switch CI OS to RHEL 6.2 2017-10-09 11:03:57 -07:00
TaoBeier
2847ef89f1 PYTHON-1388 fix docs example. (#338) 2017-10-06 10:27:14 -07:00
A. Jesse Jiryu Davis
dad61a058b PYTHON-1332 - Update session's last_use 2017-10-05 15:03:36 -04:00
Shane Harvey
d2f0ade371 PYTHON-1389 Fix aggregation doctests for MongoDB 3.5.13. 2017-10-04 10:22:40 -07:00
A. Jesse Jiryu Davis
889a36464f PYTHON-1332 - Sessions and multi-auth 2017-10-03 17:19:09 -04:00
A. Jesse Jiryu Davis
41096d5875 PYTHON-1332 - Check current user owns session 2017-10-02 12:05:11 -04:00
Bernie Hackett
410027c057 PYTHON-1387 - Improve detection of object_pairs_hook support 2017-09-30 09:28:09 -07:00
Shane Harvey
da8fabc49a PYTHON-1299 Remove "safe" legacy messages. 2017-09-29 12:09:24 -07:00
Shane Harvey
01bbf19462 PYTHON-1299 Remove fallback code from user and index management helpers. 2017-09-29 12:09:24 -07:00
Shane Harvey
3e778334e7 PYTHON-1299 Remove test logic for MongoDB <2.6. 2017-09-29 12:09:24 -07:00
Shane Harvey
7bae7fdd1c PYTHON-1299 Remove useCursor wire version check. 2017-09-29 12:09:24 -07:00
Shane Harvey
715cb0d27c PYTHON-1299 Remove acknowledged legacy writes.
Ordered unacknowledged bulk writes still use legacy writes and getLastError.
2017-09-29 12:09:24 -07:00
A. Jesse Jiryu Davis
3cba982db9 PYTHON-1332 - Test lsid with all commands 2017-09-29 14:52:26 -04:00
A. Jesse Jiryu Davis
fdf4436201 PYTHON-1332 - Send lsid with all commands 2017-09-29 14:52:26 -04:00
A. Jesse Jiryu Davis
6fa2e4047f PYTHON-1332 - Send lsid with all commands 2017-09-29 14:52:26 -04:00
A. Jesse Jiryu Davis
c1ec855060 PYTHON-1332 - Send lsid with all commands 2017-09-29 14:52:26 -04:00
gzcf
9051b65510 PYTHON-1299 fix Regex __eq__ method (#337) 2017-09-29 10:57:21 -07:00
A. Jesse Jiryu Davis
6c7d1aa408 Use w=1000 to test write concern errors 2017-09-18 13:35:51 -04:00
A. Jesse Jiryu Davis
200b699ba5 PYTHON-1332 - Prohibit using ended session 2017-09-14 23:21:43 -04:00
A. Jesse Jiryu Davis
25b00e43e8 PYTHON-1332 - Use SON for fsyncUnlock command
Ensures the command name remains the first key once lsid is added.
2017-09-14 09:00:31 -04:00
Shane Harvey
1ef21b7adc PYTHON-1370 Remove redundant auth/ssl testing. 2017-09-13 15:20:58 -07:00
A. Jesse Jiryu Davis
57b5a01b91 PYTHON-1332 - Use bytes in GridFS session test 2017-09-13 14:01:39 -04:00
A. Jesse Jiryu Davis
a4245ee649 Ensure TestGlobalListener cleans up
This test left unclean global state that broke sessions tests with auth
(PYTHON-1332).
2017-09-13 13:35:34 -04:00
A. Jesse Jiryu Davis
1a3962863d PYTHON-1332 - Refactor session + collection test 2017-09-12 22:19:08 -04:00
Shane Harvey
e775295ab5 PYTHON-1367 Ignore uuid_representation when decoding BSON binary subtype 4. 2017-09-12 17:20:14 -07:00
A. Jesse Jiryu Davis
e86742d27b PYTHON-1332 - Session param for GridFS methods
Also refactor session tests.
2017-09-12 16:27:54 -04:00
A. Jesse Jiryu Davis
ab3ab3fdaf PYTHON-1332 - Avoid fsync test on mongos 2017-09-12 11:09:11 -04:00
A. Jesse Jiryu Davis
cf23c113a4 PYTHON-1332 - Test user-admin commands + sessions 2017-09-11 17:50:55 -04:00
A. Jesse Jiryu Davis
9923be5509 Don't drop test user at end of tests 2017-09-11 17:50:07 -04:00
A. Jesse Jiryu Davis
afb6a931d7 PYTHON-1332 - Session param for client methods 2017-09-11 17:46:44 -04:00
A. Jesse Jiryu Davis
6ff5b78d72 PYTHON-1332 - Session for deref and profiling_info 2017-09-11 17:46:44 -04:00
A. Jesse Jiryu Davis
2487e9b71f PYTHON-1332 - Session param for Collection methods 2017-09-11 17:46:44 -04:00
A. Jesse Jiryu Davis
1057562df0 PYTHON-1332 - Update sessions tests for auth 2017-09-11 17:38:52 -04:00
A. Jesse Jiryu Davis
9327d0c5de PYTHON-1332 - Pass session to Database methods 2017-09-11 17:38:52 -04:00
A. Jesse Jiryu Davis
2bcddf96f6 PYTHON-1332 - db.command accepts session param 2017-09-11 17:38:52 -04:00
Shane Harvey
3d57cfecfe PYTHON-1342 Enable test_insert_large_batch. 2017-09-08 15:03:49 -07:00
Shane Harvey
14ce90906c PYTHON-1296 Support array_filters updates.
Sync crud tests.
2017-09-08 12:23:40 -07:00
caosiyang
db57f671dc PYTHON-1371 - The tailable cursor cannot get document through __getitem__(index) on MongoDB v3.4
Fix issue and add test case.
2017-09-08 11:45:11 -07:00
Shane Harvey
74605b73f6 PYTHON-1338 Support change stream API. 2017-09-07 17:12:45 -07:00
Shane Harvey
f0b18ccfc5 PYTHON-1364 Drop support for CPython 3.3. 2017-09-05 17:45:30 -07:00
Shane Harvey
35556acc29 PYTHON-1369 Reduce test frequency against Jython. 2017-09-05 17:45:30 -07:00
Shane Harvey
19928fc343 PYTHON-1368 Reduce test frequency against CPython 3.5. 2017-09-05 17:45:30 -07:00
Shane Harvey
eb13dacd52 PYTHON-1360 Reduce test frequency. 2017-09-05 17:45:30 -07:00
A. Jesse Jiryu Davis
d0da78ae54 PYTHON-1332 - Pool server sessions
Also check if the topology supports sessions, error otherwise.
2017-09-01 18:18:26 -04:00
A. Jesse Jiryu Davis
3c49e8a0f7 PYTHON-1362 - Useless check in aggregate_raw_batches
The method had checked whether any SON manipulators were configured, and
raised an error if so. But users should understand that SON manipulators
can't affect raw batches, and checking for them raises a deprecation
warning.
2017-09-01 16:20:36 -04:00
A. Jesse Jiryu Davis
14da1893ea PYTHON-1332 - Parse session timeout from ismaster
The field name isn't localLogicalSessionTImeoutMinutes, it's now
logicalSessionTimeoutMinutes.
2017-09-01 15:22:38 -04:00
A. Jesse Jiryu Davis
ac052ae86c PYTHON-1332 - Begin the Session API 2017-09-01 14:02:10 -04:00
Anthony Sottile
41be71f09f Trim trailing whitespace 2017-08-31 22:26:39 -07:00
Anthony Sottile
ff81fbb938 Ensure files end in a newline 2017-08-31 22:26:39 -07:00
A. Jesse Jiryu Davis
cfb30e91c0 PYTHON-1362 - Add find/aggregate_raw_batches()
Rename find_raw to find_raw_batches, and add aggregate_raw_batches.
Rename RawBSONCursor and RawBSONCommandCursor to RawBatchCursor and
RawBatchCommandCursor.
2017-08-25 15:26:16 -04:00
A. Jesse Jiryu Davis
4957589024 PYTHON-1362 - Add Collection.find_raw()
Instead of passing raw_batches=True to find(), make a separate method.
2017-08-25 15:24:46 -04:00
A. Jesse Jiryu Davis
a6183a5dc5 Style in test_cursor.py 2017-08-25 15:24:16 -04:00
A. Jesse Jiryu Davis
de54cafff5 Unused import 2017-08-25 15:24:16 -04:00
A. Jesse Jiryu Davis
0534596dc5 PYTHON-1362 - Add raw_batches option to find() 2017-08-25 15:24:16 -04:00
A. Jesse Jiryu Davis
b49f1000c1 PYTHON-1299 - Remove MongoDB 2.4 notes from docs 2017-08-24 15:33:12 -04:00
A. Jesse Jiryu Davis
b273d94358 PYTHON-1299 - Use new wire version in tests 2017-08-24 08:57:36 -04:00
A. Jesse Jiryu Davis
d99b026f8d PYTHON-1299 - Don't test MongoDB 2.4 in Evergreen 2017-08-24 08:14:36 -04:00
A. Jesse Jiryu Davis
aa03551725 PYTHON-1299 - Drop MongoDB 2.4
Bump minimum supported wire version to 2 and sync SDAM tests from specs
repo. Don't remove actual wire protocol code yet or remove 2.4 version
checks from test code.
2017-08-24 08:14:36 -04:00
A. Jesse Jiryu Davis
bf22fa4ff7 Fix UTF-8 hosts test 2017-08-23 22:45:20 -04:00
A. Jesse Jiryu Davis
278d2fb907 Start work on 3.6 2017-08-23 22:11:18 -04:00
A. Jesse Jiryu Davis
ece1321dbb Resync JSON tests from specs repo 2017-08-23 21:55:46 -04:00
A. Jesse Jiryu Davis
cbe3e3b9ab PYTHON-1349 - Read session timeout from isMaster 2017-08-23 21:55:46 -04:00
A. Jesse Jiryu Davis
4ee8b0aade Resync SDAM test files 2017-08-23 21:55:46 -04:00
A. Jesse Jiryu Davis
13364a28fb Sync "secondary with mismatched me" spec test 2017-08-23 21:55:46 -04:00
Shane Harvey
ca57ecea4a BUMP 3.5.1 2017-08-23 16:24:15 -07:00
Bernie Hackett
69d2250311 PYTHON-1358 - Switch to Jira Release Notes links
Jira server no longer allows anonymous users to view
the "roadmap" page for a project release. This broke most of the
"Issues Resolved" links in the changelog. The Jira Release Notes
pages are still viewable by anonymous users.

This change also adds the release notes for 2.9.5 and 3.3.1, which
never made it into master.
2017-08-21 15:57:58 -07:00
Bernie Hackett
dbd39d9ac8 PYTHON-1354 - Work around WinKerberos deprecations
The user, domain, and password arguments to authGSSClientInit
are deprecated. The principal argument works as of 0.5.0. Use
it instead.
2017-08-17 16:48:11 -07:00
Shane Harvey
61ad5b223a PYTHON-1353 Fix failing CommandCursor test on 2.4. 2017-08-17 14:23:57 -07:00
Bernie Hackett
4c03b321f2 PYTHON-1347 - Replace usage of Sphinx Directive
sphinx.util.compat.Directive is deprecated. Use
docutils.parsers.rst.Directive instead.
2017-08-16 17:46:06 -07:00
Bernie Hackett
eb65239f1a Minor README update 2017-08-16 10:23:27 -07:00
Bernie Hackett
1bc20d78ab Update changelog 2017-08-16 10:08:38 -07:00
Bernie Hackett
728ee59f27 PYTHON-1350 - Work around getsockopt issue on NetBSD
NetBSD doesn't support testing TCP_KEEPIDLE and friends,
only setting them.
2017-08-16 09:59:26 -07:00
Shane Harvey
b00584b892 PYTHON-1353 Kill cursors synchronously in CommandCursor.close. 2017-08-15 14:58:44 -07:00
Bernie Hackett
7051faace8 Start work on 3.5.1 2017-08-15 11:21:31 -07:00
Shane Harvey
0b0f045d56 BUMP 3.5.0 2017-08-08 09:48:06 -07:00
Shane Harvey
b7893b7ec4 3.5 changelog and documentation fixes. 2017-08-08 09:32:09 -07:00
Shane Harvey
6e022e0636 PYTHON-1297 Improve documentation for Extended JSON. 2017-08-07 17:14:34 -07:00
Shane Harvey
82c610a9f5 PYTHON-1346 Stop using platform.linux_distribution on Python >= 3.5. 2017-08-07 14:07:06 -07:00
Shane Harvey
fadb8161b4 PYTHON-1317 Fix race condition in w=0 bulk tests. 2017-08-07 11:07:39 -07:00
Shane Harvey
e89ed11113 PYTHON-1317 Deprecate legacy bulk write api.
Use Collection.bulk_write() in documentation examples.
Move deprecated bulk tests to test_legacy_api.
2017-08-04 21:41:29 -07:00
Shane Harvey
bb7db3d19a PYTHON-1331 Enable mongodb-latest sharded cluster testing.
PYTHON-1342 Skip test_insert_large_batch.
2017-08-04 14:53:09 -07:00
Shane Harvey
47ab8c3187 PYTHON-1343 Use unsigned long to encode Timestamps.
The time and increment portions of a Timestamp are unsigned 32-bit integers
which are not guaranteed to fit inside a long.
2017-08-04 11:33:49 -07:00
Shane Harvey
8eb1aefeff PYTHON-1336 Add collation support to Collection.bulk_write. 2017-08-03 15:21:04 -07:00
Shane Harvey
9468c119a3 PYTHON-1335 Improve __slots__ usage.
__slots__ must be defined in all classes in the hierarchy to avoid __dict__
and __weakref__ overhead.
2017-08-03 14:57:43 -07:00
Shane Harvey
054a01aaff PYTHON-1297 Implement Extended JSON Spec 2.0
Add JSONOptions.json_mode to control encoding Relaxed and Canonical
Extended JSON.
Add json_util.LEGACY_JSON_OPTIONS to encode PyMongo 3.4's default JSON output.
Deprecate json_util.STRICT_JSON_OPTIONS.
Move Decimal128 spec tests to bson_corpus runner.
2017-08-03 10:30:24 -07:00
A. Jesse Jiryu Davis
473e25b2f6 PYTHON-1327 - Handle null username or password 2017-08-02 16:06:23 -04:00
Kay Kim
aa7a40c1b8 docs: add google tag (#331)
Update copyright for docs.
2017-08-01 14:59:25 -07:00
A. Jesse Jiryu Davis
0d1424ae31 PYTHON-1313 - Fix replset tests 2017-08-01 17:57:07 -04:00
A. Jesse Jiryu Davis
72e61277b2 Deprecate db.authenticate and db.eval
PYTHON-1313, and PYTHON-1315.
2017-08-01 16:30:42 -04:00
A. Jesse Jiryu Davis
9ca77901ab PYTHON-1308 - Don't deprecate "manipulate" param
Can't raise DeprecationWarning if "find(manipulate=True)" since it's the
default.
2017-08-01 16:29:11 -04:00
Shane Harvey
312408e041 PYTHON-1279 Deprecate socketKeepAlive and default to true.
Wherever possible set:
- keep-alive idle time to a maximum of 300 seconds.
- keep-alive interval time to a maximum of 10 seconds.
- keep-alive count to a maximum of 9 probes.
2017-08-01 12:34:42 -07:00
A. Jesse Jiryu Davis
85e80bcc8b PYTHON-1308 - Finish deprecating SON manipulators 2017-08-01 10:19:48 -04:00
Shane Harvey
a4a2e4dfc9 PYTHON-1333 Reduce test frequency against zSeries, ARM64, and POWER8. 2017-07-31 15:55:59 -07:00
Shane Harvey
6a11888a9c PYTHON-1330 Decode JSON binary type 0 to Python 3 bytes. 2017-07-31 13:16:46 -07:00
A. Jesse Jiryu Davis
75b2b1fc41 PYTHON-1327 - No credentials in repr(client) 2017-07-28 21:38:59 -04:00
A. Jesse Jiryu Davis
031559ebc5 PYTHON-1327 - Username and password kwargs
MongoClient now accepts username and password parameters. Before, the
only way to pass them was in the URI.
2017-07-28 15:20:23 -04:00
Michael Elovskikh
9f07ff35a1 PYTHON-1334 Don't change readpreference value at uri parsing (#325) 2017-07-25 17:43:51 -07:00
Shane Harvey
9388281795 PYTHON-1306 Deprecate MongoClient.get_default_database.
PYTHON-1304 Make name optional for MongoClient.get_database.
2017-07-25 17:16:34 -07:00
Shane Harvey
7c43b9665b PYTHON-1328 Make list_indexes consistent across server versions. 2017-07-25 16:57:55 -07:00
A. Jesse Jiryu Davis
7b1cbace17 PYTHON-1217 - Deprecate the "modifiers" find option 2017-07-24 12:40:15 -04:00
Shane Harvey
a9e84edb79 PYTHON-1270 Skip test_interrupt_signal with gevent and eventlet. 2017-07-24 09:13:17 -07:00
Xiao Tan
46532890c1 Fix bug: SON object and list can not be compared (#330) 2017-07-21 18:26:50 -07:00
Shane Harvey
2c6557e90e PYTHON-1331 Disable mongodb-latest sharded cluster testing. 2017-07-21 18:07:55 -07:00
Bernie Hackett
53bd24bfc3 PYTHON-1260 - Deprecate the group helper 2017-07-18 10:54:33 -07:00
Shane Harvey
857a4d9ee9 PYTHON-1295 Use nameOnly option for listDatabases. 2017-07-11 11:17:58 -07:00
A. Jesse Jiryu Davis
7306834f91 Sphinx 1.6 compatibility 2017-07-01 12:14:27 -04:00
A. Jesse Jiryu Davis
217f90bab6 PYTHON-1284 Don't copy CodecOptions in RawBSONDocument 2017-07-01 09:07:58 -04:00
Shane Harvey
edc3dad823 PYTHON-1293 Evergreen - disable Solaris testing. 2017-06-30 15:04:47 -07:00
Tzach
24a6d00952 Slightly faster Cursor.next() (#323) 2017-06-29 13:00:54 -07:00
Shane Harvey
a6eed38e54 PYTHON-1291 Skip *_with_invalid_keys tests against >= 3.5.8. 2017-06-28 18:04:00 -07:00
Shane Harvey
138255609e PYTHON-1281 Use pool checkin time for socket idle time calculation. 2017-06-26 13:31:08 -07:00
Bernie Hackett
ee4788796d PYTHON-1285 - Switch Evergreen OSX distro to 1012 2017-06-22 16:44:47 -07:00
A. Jesse Jiryu Davis
7c41ef566c PYTHON-1282 Update docs and errors for new URI Spec 2017-06-16 22:48:22 -04:00
A. Jesse Jiryu Davis
c72ee15b52 PYTHON-1282 Username/password must be URI-escaped
Not just "%", "@", and ":" must be escaped, all delimiters from RFC 3986
must be percent-encoded. Therefore, since "/" must be escaped in
username and password, we can split the URI at the first "/" instead of
the last.
2017-06-16 18:33:32 -04:00
Guillaume Gelin
803c83d342 Fix multiline exceptions (#328) 2017-06-16 15:06:07 -07:00
A. Jesse Jiryu Davis
e9eb3079bc Update connection pool FAQ. 2017-06-09 16:27:28 -04:00
Bernie Hackett
1c7f5f80e5 Claim support for Python 3.6 2017-05-25 17:02:59 -07:00
Bernie Hackett
988fd450b4 Fix test_comment for MongoDB 3.5 2017-05-25 16:44:43 -07:00
Bernie Hackett
04059f82c3 Fix Travis for pypy3-2.4 2017-05-25 14:33:11 -07:00
Shane Harvey
ca735ca10d PYTHON-1234 Evergreen - add CPython coverage reporting. 2017-05-11 10:31:24 -04:00
Shane Harvey
6aaa1f71aa PYTHON-1269 Kill cursors synchronously in Cursor.close and MongoClient.close. 2017-05-08 13:23:50 -04:00
Bernie Hackett
3359f85019 Simplify and cleanup evergreen config 2017-04-26 13:28:16 -07:00
Bernie Hackett
6b724c67b8 PYTHON-1255 - Test with mod_wsgi 2.8 2017-04-25 23:08:14 -07:00
Bernie Hackett
e5c18fe09b Migrate CI testing to Ubuntu 12.04 2017-04-25 23:05:33 -07:00
Bernie Hackett
4140118b85 PYTHON-1261 - Test with no server running 2017-04-21 12:38:21 -07:00
Bernie Hackett
f453d30fed PYTHON-1264 - Test for successful C extension builds 2017-04-21 12:37:34 -07:00
Bernie Hackett
6c9ea81b2e Update Travis config 2017-04-20 13:06:16 -07:00
Bernie Hackett
02e606608e PYTHON-1213 - Make decimal128 work with cdecimal 2017-04-04 17:01:50 -07:00
Bernie Hackett
a426aef599 PYTHON-1250 - Fix replace_one test 2017-04-03 14:58:05 -07:00
Bernie Hackett
9193e577f2 PYTHON-1266 - Make test_continue_on_error more reliable 2017-04-03 14:47:00 -07:00
Bernie Hackett
9693170982 PYTHON-1265 - More reliable gridfs replica tests 2017-04-03 14:46:30 -07:00
A. Jesse Jiryu Davis
520cf31409 PYTHON-1204 - More reliable test_client_disconnect 2017-04-03 14:51:29 -04:00
A. Jesse Jiryu Davis
93fd58aa10 PYTHON-2014 - Topology.close fixes
Ensure a monitor thread is restarted by Topology.open if it exited with
an exception, set Topology._opened = False in Topology.close, and extend
the timeout in test_client_disconnect.
2017-04-02 20:35:01 -04:00
Bernie Hackett
5fb2544c29 PYTHON-1263 - Fix test_insert_manipulate_false
The server no longer includes process id when generating
ObjectIds so we can't actually test that the _id value
was generated by the server instead of the driver.
2017-03-29 13:54:08 -07:00
Bernie Hackett
d1225bcbe5 PYTHON-1218 - Fix result field testing 2017-03-28 17:32:42 -07:00
Bernie Hackett
e8e77f5a2c PYTHON-1227 - Don't use select.POLLNVAL
It causes problems with Jython and seems unnecessary
since we know the fd represents an open socket.
2017-03-27 17:16:37 -07:00
Bernie Hackett
ca42250102 PYTHON-1218 - Update CRUD spec tests to latest 2017-03-27 16:40:50 -07:00
Bernie Hackett
018afe4b80 PYTHON-1258 - Fix test_command for MongoDB 3.5+ 2017-03-25 13:08:00 -07:00
Bernie Hackett
6d0a6ba795 PYTHON-1250 - Create examples for sample shell commands 2017-03-25 11:29:05 -07:00
Bernie Hackett
71108f54d3 PYTHON-1256 - Fix test_standalone_error 2017-03-23 18:51:05 -07:00
Bernie Hackett
43cf6be1c8 PYTHON-1196 - Fix test_max_await_time_ms 2017-03-23 18:49:39 -07:00
Bernie Hackett
1108a3a8e0 PYTHON-1222 - Attempt to fix pooling test on zSeries 2017-03-18 15:57:50 -07:00
Bernie Hackett
15bae00c83 PYTHON-1246 - Attempt to fix test_insert_large_batch
...with sharded MongoDB 2.4.
2017-03-16 15:01:33 -07:00
Bernie Hackett
14df77835a Various CI script fixes 2017-03-16 14:59:22 -07:00
Bernie Hackett
e4843986ea PYTHON-1249 - Run doctests in evergreen 2017-03-14 13:23:04 -07:00
Bernie Hackett
93933c9dc3 PYTHON-1243 - MockupDB tests 2017-03-14 13:17:34 -07:00
Bernie Hackett
f880111754 PYTHON-1240 - Test mod_wsgi in Evergreen 2017-03-14 13:12:29 -07:00
Bernie Hackett
2d27fcb990 PYTHON-1201 - Test GSSAPI and PLAIN authentication 2017-03-14 13:02:31 -07:00
Bernie Hackett
dc3048c79b PYTHON-1254 - Fix test_find_and_get_more for 3.5+ 2017-03-14 12:58:16 -07:00
Bernie Hackett
010d42b507 PYTHON-1253 - reIndex doesn't support writeConcern 2017-03-14 12:56:57 -07:00
Luke Lovett
73770db06f Link to createIndexes command from create_indexes documentation.
Fix markup for Collation class in IndexModel documentation.
2017-03-09 16:25:31 -08:00
Bernie Hackett
0373c3d9f7 Update ez_setup.py to latest 2017-03-06 15:49:34 -08:00
Bernie Hackett
2fe8d7cf69 PYTHON-1244 - Fix signed/unsigned comparison 2017-02-27 16:14:47 -08:00
Shane Harvey
90878ecf79 Evergreen - enable Windows SSL tests 2017-02-27 10:52:01 -08:00
Bernie Hackett
b631761568 PYTHON-1200 - Test CPython 2.6 and 2.7 on Windows 2017-02-27 09:24:10 -08:00
Shane Harvey
86a60f415b PYTHON-1232 Add Jenkins storage engines test matrix 2017-02-23 13:36:33 -08:00
Luke Lovett
50c6d23cbb Fix test failures related to BSON corpus tests with extended JSON. 2017-02-22 18:14:07 -08:00
Luke Lovett
74c0d55314 PYTHON-1214 - Implement the extended JSON specification. 2017-02-22 10:32:29 -08:00
Shane Harvey
a1ff056933 Add MongoClient properties to documentation 2017-02-21 13:26:55 -08:00
Bernie Hackett
b1ca528836 PYTHON-1230 - Use PROTOCOL_TLS_CLIENT when available 2017-02-17 15:18:46 -08:00
Bernie Hackett
320f21b71f PYTHON-1239 - Test explicitly without C extensions 2017-02-17 13:55:50 -08:00
Bernie Hackett
5e1907f5cc PYTHON-1233 - Evergreen green framework testing 2017-02-17 13:55:50 -08:00
Bernie Hackett
c36f3ab644 Test C extensions on Windows - Python 3.3 - 3.6 2017-02-17 13:55:50 -08:00
Bernie Hackett
ff019ccbd4 Disable evergreen "upload working dir" task
It's unnecessary and causes CI timeouts.
2017-02-17 13:55:50 -08:00
Bernie Hackett
ba62a400ff PYTHON-1236 - Always publish tuples for connection_id 2017-02-17 13:55:50 -08:00
Bernie Hackett
aa5249068a PYTHON-1235 - Fix auto reconnect test under Jython 2017-02-17 13:55:50 -08:00
Shane Harvey
033dcf1b08 PYTHON-498 Disable Jython SSL tests on Evergreen 2017-02-17 13:55:50 -08:00
Bernie Hackett
b90295d806 PYTHON-1221 - Skip test_ipv6 with TLS and no ipaddress module 2017-02-17 13:55:50 -08:00
Bernie Hackett
e3b3d88928 PYTHON-1229 - Set max MongoDB version to 3.5.0 2017-02-17 13:55:50 -08:00
Bernie Hackett
9379a01277 PYTHON-1221 PYTHON-1208 - TLS test fixes
This change updates server.pem and crl.pem, and updates the test suite
expectations accordingly. It also works around the inability of python
2.6 to parse SANs properly.
2017-02-17 13:55:50 -08:00
Shane Harvey
b7801d4e5b Finish removing unused "Release Archive Creator" variant 2017-02-17 13:55:50 -08:00
Shane Harvey
a3208a2fc0 Use PyMongo's test certificates on Evergreen
Add 'server' and 'hostname_not_in_cert' hostnames.
2017-02-17 13:55:50 -08:00
Shane Harvey
aab73fec2f Fix "install dependencies" function definition 2017-02-17 13:55:50 -08:00
Shane Harvey
dec5007b45 Disable unused "Release Archive Creator" variant 2017-02-17 13:55:50 -08:00
Bernie Hackett
cd078c8300 PYTHON-1196 - Disable test_max_await_time_ms 2017-02-17 13:55:50 -08:00
Bernie Hackett
b530755cfc PYTHON-1229 - Update another agg test for MongoDB 3.5+ 2017-02-17 13:55:50 -08:00
Shane Harvey
d32d2ff7a5 PYTHON-1227 Disable various pool tests on Jython 2017-02-17 13:55:50 -08:00
Shane Harvey
bb43928f14 PYTHON-1225 Test Python toolchain against Ubuntu 16.04 (x86_64)
MongoDB versions < 3.2 do not come with SSL support on Ubuntu 16.04 (x86_64).
2017-02-17 13:55:50 -08:00
Shane Harvey
2ea2c68dc8 Update drivers-evergreen-tools .evergreen/ to 7d4b15d2864b617d122fd2caaa86b54e370dfa77 2017-02-17 13:55:50 -08:00
Bernie Hackett
e3998ff7ce PYTHON-1209 - Fix test_write_error_text_handling weirdness
For some reason we hit this weirdness on Solaris 11:
https://bugs.python.org/issue14847
2017-02-17 13:55:50 -08:00
Bernie Hackett
9a6fdc1f8f PYTHON-1229 - Update aggregate tests for MongoDB 3.5+
The aggregate command now requires either the 'cursor' or 'explain'
option.
2017-02-17 13:55:50 -08:00
Bernie Hackett
1995d8082b PYTHON-1206 - Fix race in test_operation_failure 2017-02-17 13:55:50 -08:00
Bernie Hackett
f677556f0d PYTHON-1203 - Fix TestReplicaSetClient.test_ipv6 2017-02-17 13:55:50 -08:00
Bernie Hackett
788debfdd6 PYTHON-1228 - Fix BSON test failures with Jython 2.7
The 'replace' and 'ignore' handlers for Jython generate output that
differs from CPython / PyPy.

Jython doesn't properly handle NaN with payload from struct.(un)pack.
2017-02-17 13:55:50 -08:00
Shane Harvey
14a68ee9e6 PYTHON-1205 Use SIGALRM instead of interrupt_main on non-Windows 2017-02-17 13:55:50 -08:00
Bernie Hackett
21b6a47ce9 PYTHON-1202 - Fix time64 compilation with -std=c99
Python 2.6 on Solaris 11 is built with -std=c99. That causes
build issues for our time64 code, which needs localtime_r and
tzset. Including Python.h in time64.c provides the necessary magic.
2017-02-17 13:55:50 -08:00
Shane Harvey
6142f761e7 PYTHON-1216 Tests should pass without MongoDB running 2017-02-17 13:55:50 -08:00
Shane Harvey
6f4336efd4 PYTHON-1222 Disable test_max_pool_size_with_connection_failure 2017-02-17 13:55:50 -08:00
Shane Harvey
2abaa3d07a PYTHON-1205 Disable test_interrupt_signal 2017-02-17 13:55:50 -08:00
Shane Harvey
e25a8d51fb PYTHON-1206 Disable test_operation_failure 2017-02-17 13:55:50 -08:00
Shane Harvey
19160c9e76 PYTHON-1221 Disable test_client.test_ipv6 2017-02-17 13:55:50 -08:00
Shane Harvey
0a2961b4c4 PYTHON-1203 Disable test_replica_set_client.test_ipv6 2017-02-17 13:55:50 -08:00
Shane Harvey
92a9d401b7 PYTHON-1208 Disable test_cert_ssl_validation_hostname_matching 2017-02-17 13:55:50 -08:00
Shane Harvey
f167252148 PYTHON-1204 Disable test_client_disconnect 2017-02-17 13:55:50 -08:00
Shane Harvey
7024a50ab2 PYTHON-1209 Disable test_write_error_text_handling 2017-02-17 13:55:50 -08:00
Shane Harvey
a3b05a0066 PYTHON-1207 Skip test_unix_socket when SSL is enabled 2017-02-17 13:55:50 -08:00
Shane Harvey
6f05b2f9ff Do not use PROJECT_DIRECTORY in attach results 2017-02-17 13:55:50 -08:00
Shane Harvey
39321f472f PYTHON-1215 Update .evergreen/config.yml
Update drivers-evergreen-tools .evergreen/ to dda68d4aea4dc9725557b49bcf983c006c0c23ae
Attach test results after MongoDB setup results.
2017-02-17 13:55:50 -08:00
Shane Harvey
5892eb0192 Kick-start Evergreen testing 2017-02-17 13:55:50 -08:00
Shane Harvey
4195f77a79 PYTHON-1197 Test PyMongo on Evergreen with the default system Python
- Add XUnit xml reporting using unittest-xml-reporting
- Clamp unittest2 version at 0.8.0 for Solaris
- Remove environmental variables to work around EVG-1331
2017-02-17 13:55:50 -08:00
Shane Harvey
dc547c96c9 Add drivers-evergreen-tools .evergreen/ at 919725adcf67be8ef0a9cd336f238044894f0961 2017-02-17 13:55:50 -08:00
Bernie Hackett
76df4f2d33 Start work on 3.5 2017-02-17 13:53:04 -08:00
A. Jesse Jiryu Davis
7b0cc446cc Correct the docstring for find_one. 2017-01-07 17:58:59 -05:00
A. Jesse Jiryu Davis
361443ffe8 Correct the docstring for create_indexes. 2017-01-07 16:18:43 -05:00
Bernie Hackett
f2aff0fd14 BUMP 3.4.0 2016-11-29 09:37:50 -08:00
Bernie Hackett
3d43b0352a Link to PyMODM on pypi 2016-11-29 09:33:47 -08:00
Bernie Hackett
afa14fb3a2 Link to python-bsonjs on pypi 2016-11-29 09:31:27 -08:00
Shane Harvey
0abcb7a683 Advertise python-bsonjs in json_util and FAQ documentation 2016-11-28 17:36:40 -08:00
Luke Lovett
c58f5e4435 Add PyMODM to the list of ORM-like layers on the tools documentation page. 2016-11-28 11:17:13 -08:00
Bernie Hackett
b12d6b72e7 PYTHON-1180 - Wait for killCursors success 2016-11-25 22:27:48 -05:00
Bernie Hackett
677b9c8130 Remove test_client.TestClient.test_fork
PyMongo no longer supports the behavior that was tested. This
test was often causing deadlocks in CI.
2016-11-25 12:19:43 -05:00
A. Jesse Jiryu Davis
726921a034 Revert "PYTHON-1163 update topology from handshake reply"
23d3c2ee86
2016-11-23 11:43:23 -05:00
A. Jesse Jiryu Davis
23d3c2ee86 PYTHON-1163 update topology from handshake reply 2016-11-22 16:36:32 -05:00
Bernie Hackett
20baefae6d PYTHON-1180 - Easier debugging of command monitoring tests 2016-11-22 15:36:26 -05:00
A. Jesse Jiryu Davis
91f2f973af PYTHON-1192 - Minimum maxStalenessSeconds is 90.
Revert code to parse "idleWritePeriodMillis" from ismaster, and revert
changes that allowed maxStalenessSeconds to be a float.
2016-11-22 13:19:34 -05:00
A. Jesse Jiryu Davis
14f626cb26 Factor Max Staleness and Server Selection tests 2016-11-21 12:48:15 -05:00
Bernie Hackett
306e990850 PYTHON-1174 - Clarify usage with multiprocessing 2016-11-18 17:14:12 -08:00
Shane Harvey
8156688854 PYTHON-1189 Fix race condition in poll.poll
Each Pool guards its poll.poll with a mutex to prevent concurrent calls.
poll and select are retried if they are interrupted with EINTR. Also fixes
PYTHON-1179.
2016-11-18 16:15:41 -08:00
A. Jesse Jiryu Davis
f7dc88ca7f PYTHON-1188 - Skip test if no replset. 2016-11-17 16:47:20 +00:00
Bernie Hackett
1600059015 PYTHON-1184 - Don't require X.509 user with MongoDB 3.4 2016-11-16 14:31:14 -08:00
Luke Lovett
807f719405 PYTHON-1178 - Fix race in test_local_threshold test. 2016-11-16 10:07:31 -08:00
Bernie Hackett
9128866f58 PYTHON-1176 - Resync CRUD spec tests 2016-11-15 15:41:46 -08:00
Bernie Hackett
ba6ef88d10 PYTHON-1026 - Single member replica set testing 2016-11-15 15:25:04 -08:00
Bernie Hackett
139176b254 PYTHON-1183 - Update BSON corpus test files 2016-11-14 11:26:59 -08:00
A. Jesse Jiryu Davis
8e1024be73 PYTHON-1185 - Update ShortHeartbeatShortMaxStaleness2.json. 2016-11-09 16:55:49 -05:00
A. Jesse Jiryu Davis
1d1e4895ff PYTHON-1185 - Update max staleness tests. 2016-11-09 07:56:07 -05:00
A. Jesse Jiryu Davis
e43011bf45 PYTHON-1185 - Changelog for max staleness updates. 2016-11-08 21:52:04 -05:00
A. Jesse Jiryu Davis
066237d18c PYTHON-1185 - More maxStalenessSeconds tests. 2016-11-08 21:52:04 -05:00
A. Jesse Jiryu Davis
87708a2f96 PYTHON-1169 - Default maxStalenessSeconds is -1. 2016-11-08 21:52:04 -05:00
A. Jesse Jiryu Davis
873dc22f64 PYTHON-1185 - maxStalenessSeconds can be a float.
PyMongo had cast to int before sending to mongos.
2016-11-08 21:52:04 -05:00
A. Jesse Jiryu Davis
5735cf49b1 PYTHON-1104 - Fix lastWriteDate parsing. 2016-11-08 21:52:04 -05:00
A. Jesse Jiryu Davis
497e316d34 PYTHON-1104 - Support idleWritePeriodMS. 2016-11-08 21:52:04 -05:00
A. Jesse Jiryu Davis
f4922da97c PYTHON-1104 - maxStalenessMS -> maxStalenessSeconds. 2016-11-08 21:52:04 -05:00
Shane Harvey
6bc48727de PYTHON-1177 Fix race condition in PeriodicExecutor 2016-11-04 14:06:33 -07:00
A. Jesse Jiryu Davis
42c5df83fb GridFS docs fixes. 2016-10-30 20:59:58 -04:00
A. Jesse Jiryu Davis
cdb40fb747 GridFSBucket docs whitespace fixes. 2016-10-30 18:16:51 -04:00
Bernie Hackett
e82aa77168 PYTHON-1181 - Skip parallel_scan tests when connected to mongos 2016-10-27 11:02:11 -07:00
Bernie Hackett
c1a7bdfd4e PYTHON-1026 - Make test suite resilient against elections 2016-10-27 10:42:44 -07:00
Bernie Hackett
8ae717d0df Always check for errors after calling PyLong/Int_AsLong 2016-10-26 16:48:24 -07:00
Petr Messner
8712009f5a Fix ref count management when building _element_to_dict result tuple 2016-10-20 15:46:00 -07:00
elitan
097e7e7b55 added import for MongoClient 2016-10-20 10:15:05 -07:00
Bernie Hackett
0edd1cdf72 PYTHON-1156 - Note 3.0 MongoClient constructor change 2016-10-20 10:13:15 -07:00
Bernie Hackett
f2dafb6f2a PYTHON-1151 - Add third party notices file 2016-10-17 15:59:51 -07:00
Bernie Hackett
11f32deb9f PYTHON-1166 - Various fixes for Sphinx doc builds 2016-10-17 15:57:33 -07:00
Shane Harvey
1f30c3ba99 PYTHON-1152 Update common.MAX_SUPPORTED_WIRE_VERSION for MongoDB 3.4 2016-10-13 11:29:32 -07:00
Bernie Hackett
141dda84c0 Fix error message formatting 2016-10-13 09:10:55 -07:00
Bernie Hackett
c11c6a28e1 PYTHON-1161 - Add Unix domain socket examples 2016-10-12 17:36:09 -07:00
Bernie Hackett
25fd33b089 PYTHON-1160 - Fix __repr__ for Unix domain sockets 2016-10-03 07:06:29 -07:00
Bernie Hackett
ba1144932e Merge PyMongo 2.9.4 changelog changes to master 2016-10-03 06:32:53 -07:00
Bernie Hackett
ed59b574c3 Update tox and travis configs
I'm removing python2.6 from travis for the time being. It
requires unittest2 and it's not clear how to install that
for just 2.6 in travis.
2016-10-01 22:40:49 -07:00
Bernie Hackett
c3be08afe0 Update ez_setup.py to latest
The latest versions of setuptools support the same
versions of Python we do.
2016-10-01 19:37:48 -07:00
Bernie Hackett
4f3f9f3544 PYTHON-1154 - Various doc and doctest fixes
- Make the doctests pass against MongoDB 2.6 - master (3.3)
- Make the doctests pass under python 2.6 - python 3.5
2016-09-28 16:46:02 -07:00
Shane Harvey
5905a86785 PYTHON-1075 Support running the entire test suite with SSL/TLS
SSL connections are configurable via the environment variables
"CLIENT_PEM", "CA_PEM", and "CERT_REQS".
2016-09-28 16:34:14 -07:00
Shane Harvey
bb6cd59525 PYTHON-1157 SSL timeouts should raise NetworkTimeout, not AutoReconnect 2016-09-27 16:28:09 -07:00
A. Jesse Jiryu Davis
b3b8114779 Update SDAM tests from Specs repo. 2016-09-27 13:59:44 -04:00
Bernie Hackett
c0767a551a PYTHON-1153 - Make docs build and test under python 3 2016-09-26 15:49:59 -07:00
Bernie Hackett
e89ba4bcd0 PYTHON-1026 - Remove test assumption about primary host 2016-09-21 11:15:43 -07:00
Bernie Hackett
100a069a63 Continue work on 3.4 2016-09-21 11:15:01 -07:00
Bernie Hackett
17e3683384 BUMP 3.4rc0 2016-09-19 18:02:03 -07:00
Bernie Hackett
b37e828422 Fix handling of maxStalenessMS default 2016-09-19 14:00:28 -07:00
Bernie Hackett
747d6dcb4d Minor README change 2016-09-19 11:18:32 -07:00
Bernie Hackett
5f16e33a6d PYTHON-1150 - Add maxStalenessMS to $readPreference 2016-09-19 11:09:41 -07:00
Bernie Hackett
1a45a0fa08 Changelog for PyMongo 3.4 2016-09-16 14:31:20 -07:00
Luke Lovett
d513eb785d Lower the minimum version required for running collation index name test. 2016-09-16 11:45:33 -07:00
Bernie Hackett
dedaea0d4d PYTHON-1114 - Fix high availability examples 2016-09-15 14:16:13 -07:00
Bernie Hackett
d614fa286f PYTHON-1147 - Make sockets non-inheritable if possible
This change attempts to set the close-on-exec flag on
sockets when possible. If socket.SOCK_CLOEXEC is defined
we attempt to use it, otherwise we fall back to fcntl. If
fcntl isn't available (Windows and various other platforms)
there isn't anything we can do.

Note that using fcntl is *not* atomic. It's possible that a socket
can be created and fork + execv can happen before the call to
fcntl, leaking the file descriptor anyway. CPython 3.4 implements
PEP 446, making all newly created file descriptors non-inheritable
by default. If your application needs the behavior this change
attempts to provide you should really use CPython 3.4+.

Note also, this change *does not* make PyMongo fork safe.
2016-09-14 17:12:40 -07:00
Bernie Hackett
9a1d52a33c PYTHON-1144 - Add Atlas usage guide 2016-09-14 11:53:05 -07:00
Luke Lovett
8e4a4f33c3 PYTHON-1143 - Add example docs for collation. 2016-09-13 14:04:25 -07:00
Shane Harvey
888d0fab1f PYTHON-1135 Replace JSONOptions.strict_date with JSONOptions.datetime_representation 2016-09-12 11:11:30 -07:00
Luke Lovett
d37bb4aabf Merge branch 'patch-1' of https://github.com/cjgibson/mongo-python-driver into 34dev 2016-09-09 15:07:59 -07:00
Christian Gibson
bca7e3b994 Updating class reference in comment. 2016-09-09 17:55:20 -04:00
Bernie Hackett
26a4ae2c2f PYTHON-1113 - Fix _first_batch helper 2016-09-07 16:17:21 -07:00
Bernie Hackett
708a85657d PYTHON-1113 - Small doc fixes 2016-09-07 15:32:10 -07:00
Luke Lovett
0fbdf85f53 PYTHON-1113 - Index collation documentation into API docs. 2016-09-07 15:15:15 -07:00
Luke Lovett
8fdb581c6a PYTHON-1113 - Support collation per operation.
This commit add the pymongo.collation.Collation class and associated enums.  A
collation may be sent with individual write operations when connected to MongoDB
3.4+. Unlike read and write concern, a collation may not be attached to a
database or collection instance.
2016-09-07 13:45:41 -07:00
Bernie Hackett
851728d5a7 PYTHON-1140 - Expand handshake metadata OS information 2016-09-06 17:33:55 -07:00
Bernie Hackett
9a76d827ad Update supported MongoDB versions in README 2016-09-02 16:33:08 -07:00
Bernie Hackett
cf8e168f7d PYTHON-1136 - Report python implementation in metadata 2016-09-02 16:19:27 -07:00
Bernie Hackett
81b93a251d PYTHON-1141 - Always publish failed event when heartbeats fail 2016-09-02 15:35:56 -07:00
Luke Lovett
f9aecf139a PYTHON-1139 - Document that PyMongo is not fork-safe. 2016-09-02 12:35:06 -07:00
Bernie Hackett
eb7f2e625a PYTHON-1138 - Improve SDAM monitoring documentation 2016-09-01 17:49:30 -07:00
Bernie Hackett
1d8f12fa60 Fix pool docstring. 2016-09-01 14:24:36 -07:00
Bernie Hackett
f570f322c3 PYTHON-1142 - Add topology_type_name and server_type_name 2016-09-01 13:23:32 -07:00
Bernie Hackett
0fd60e63fd PYTHON-1137 - Add IsMaster.document 2016-08-31 13:46:47 -07:00
Bernie Hackett
f6e84fdff8 PYTHON-1117 - Add TopologyDescription.has_readable/writable_server 2016-08-31 13:43:15 -07:00
Bernie Hackett
1355c5af1d PYTHON-1068 - Update tests to latest
And update the test runner to support them.
2016-08-29 15:07:07 -07:00
Bernie Hackett
b320f82457 PYTHON-1068 - Update FAQ entry for Decimal 2016-08-29 15:07:07 -07:00
Bernie Hackett
7933d5a95f PYTHON-1068 - Update Decimal128 for latest spec changes 2016-08-29 15:07:07 -07:00
Bernie Hackett
e5984d367c PYTHON-1068 - Update tests to latest 2016-08-29 15:07:07 -07:00
Bernie Hackett
82db71e1e8 PYTHON-1068 - Support for BSON Decimal128 2016-08-29 15:07:07 -07:00
Luke Lovett
e43952d2a5 Fix pypy test failures related to the BSON corpus spec tests. 2016-08-26 16:20:47 -07:00
Bernie Hackett
f8aa26c549 Change solution to max recursion depth test issue
Changing max recursion depth to work around the CPython
issue seems to cause random failures in previous
python versions.
2016-08-26 13:52:22 -07:00
Bernie Hackett
c4cb350fde PYTHON-1132 - Send SNI hostname when SNI is available 2016-08-26 13:11:46 -07:00
Bernie Hackett
29196b6566 PYTHON-1129 - Support IP addresses in match_hostname 2016-08-25 16:28:19 -07:00
Bernie Hackett
47dee57f6c PYTHON-1133 - Explicitly disable TLS compression when possible 2016-08-25 16:09:38 -07:00
Shane Harvey
b341474ef7 Fix failing datetime test
UTC ISO-8601 datetimes are now represented with 'Z' rather than '+0000'.
2016-08-24 15:25:37 -07:00
Luke Lovett
b6c74cf33d PYTHON-1106 - Implement BSON corpus test suite. 2016-08-24 11:01:45 -07:00
Shane Harvey
d8ab05628c PYTHON-1125 More helpful error message for invalid ssl_certfiles 2016-08-23 17:13:23 -07:00
Luke Lovett
6692e8877a PYTHON-1131 - Fix inconsistent handling of scope, unicode support for Code. 2016-08-19 15:22:19 -07:00
Luke Lovett
4dad1b5f61 Skip test with $out in aggregation pipeline if the MongoDB version < 2.6. 2016-08-18 15:05:34 -07:00
tylderen
784b254083 resolve unicode decode error when creating indexes 2016-08-17 10:47:36 -07:00
tylderen
d5a3f35982 resolve unicode decode error when creating index 2016-08-17 10:47:21 -07:00
Luke Lovett
6a7fd7339b Resync server selection and max staleness tests from the specifications repository.
Convert milliseconds to seconds properly in test runner for server selection.
2016-08-11 16:27:17 -07:00
Luke Lovett
b36a4345fd PYTHON-1101 - Support sending writeConcern for commands that write. 2016-08-11 14:02:22 -07:00
Shane Harvey
b057cd47e8 PYTHON-1075 Support running the entire test suite with TLS 2016-08-02 17:15:02 -07:00
Luke Lovett
dff826b7e3 PYTHON-1123 - Ensure topology is still opened after default value for 'connect' option was changed. 2016-08-01 12:48:24 -07:00
Luke Lovett
eb13a6d7d3 Merge pull request #310 from oxymor0n/master
PYTHON-1123 - Ensure all properties of MongoClient.codec_options are customizable.
2016-08-01 12:46:24 -07:00
oxymor0n
36885e0aa1 address @llvtt comments
allow `connect` to be specified via URI parameters
import in alphabetical order
2016-08-01 14:43:35 -04:00
oxymor0n
74e7983edc ensure all test values are different than the default ones 2016-08-01 14:43:35 -04:00
oxymor0n
63059ef5b2 tz_aware parameter in URI should take precedent over default kwargs if present 2016-08-01 14:43:35 -04:00
oxymor0n
5eb1981976 add test for MongoClient.codec_options 2016-08-01 14:43:35 -04:00
oxymor0n
c073b920b0 add validators for unicode_decode_error_handler and tzinfo 2016-08-01 14:43:18 -04:00
Shane Harvey
6e2ecc1817 PYTHON-1111 JSONOptions.document_class requires simplejson in Python2.6 2016-08-01 10:05:16 -07:00
A. Jesse Jiryu Davis
78c8a4522d PYTHON-1119 - Monitor sends metadata when reconnecting. 2016-08-01 02:51:40 -04:00
A. Jesse Jiryu Davis
537b9d5a5c PYTHON-1119 - Add 'appname' to monitor handshake metadata. 2016-08-01 02:51:13 -04:00
Shane Harvey
bc6da8333d PYTHON-1122 Fix test_bad_encode on OS X Python 2.6 2016-07-28 11:08:25 -07:00
Shane Harvey
57d1ccde2f PYTHON-1111 Add JSONOptions for dumps and loads
PYTHON-767 Support JSON strict mode $date output
PYTHON-1039 Support JSON strict mode $numberLong output
PYTHON-1103 Support JSON strict mode UUID output
PYTHON-1111 Support custom document class in loads
PYTHON-1111 Support tz_aware and tzinfo in loads
Refactor milliseconds to datetime conversions
2016-07-27 11:32:59 -07:00
Luke Lovett
84875ed38f PYTHON-1119 - Ensure that the command name is first when issuing 'ismaster' command. 2016-07-27 09:58:35 -07:00
Luke Lovett
c9bbfa7ace PYTHON-1119 - Implement the client metadata capture specification. 2016-07-26 10:35:55 -07:00
Shane Harvey
5afd19922a PYTHON-1111 Add JSONOptions for dumps and loads 2016-07-22 12:10:29 -07:00
A. Jesse Jiryu Davis
5933730588 PYTHON-1104 Implement maxStalenessMS. 2016-07-22 14:12:40 -04:00
Bernie Hackett
f25df9799e PYTHON-1066 - Add parallel_scan support for arbitrary keyword args 2016-07-19 17:45:14 -07:00
Bernie Hackett
c44add7c90 Start work on 3.4 2016-07-19 16:34:20 -07:00
Luke Lovett
21550d352c BUMP 3.3.0 2016-07-12 14:21:29 -07:00
Andrey Gavrilin
f402c53348 Fix up shutdown for periodic executors 2016-07-11 13:08:36 -07:00
A. Jesse Jiryu Davis
9ab7036db9 PYTHON-1105 More reliable heartbeatFrequencyMS test. 2016-07-08 21:07:38 -04:00
A. Jesse Jiryu Davis
a04d391db7 PYTHON-1105 News entry for heartbeatFrequencyMS. 2016-07-08 16:34:48 -04:00
A. Jesse Jiryu Davis
a2f97f92a4 PYTHON-1105 Configurable heartbeatFrequencyMS. 2016-07-08 16:30:56 -04:00
Bernie Hackett
7d81a01a81 Fix syntax highlighting in README 2016-07-07 11:00:06 -07:00
Bernie Hackett
bce5f95d7b Don't promote the use of ssl.CERT_OPTIONAL 2016-07-06 11:47:46 -07:00
Bernie Hackett
aef97ae222 PyMongo 3.3 changelog 2016-07-05 16:30:25 -07:00
Bernie Hackett
6e4b54e322 PYTHON-1109 - Custom type examples are deprecated 2016-07-05 14:56:44 -07:00
Bernie Hackett
7a64cfc6e7 PYTHON-1110 - Multihomed and round robin DNS addresses are not supported 2016-07-05 14:37:39 -07:00
Bernie Hackett
c4e8d22544 PYTHON-1025 - C extensions big endian support 2016-06-24 17:54:24 -07:00
Bernie Hackett
1ee5e27f9a Fix testing with no server 2016-06-24 10:28:18 -07:00
A. Jesse Jiryu Davis
7eb4568d28 Revert "Max staleness tests."
This reverts commit ef4798b257.
2016-06-20 16:34:36 -07:00
A. Jesse Jiryu Davis
553f887ef7 PYTHON-1104 Change server-selector signature.
Preparation for maxStalenessMS implementation: selectors now take a
TopologyDescription, not a list of ServerDescriptions.
2016-06-20 15:27:17 -07:00
A. Jesse Jiryu Davis
893f2805ff Race in test_getters. 2016-06-20 15:27:17 -07:00
A. Jesse Jiryu Davis
2964f53423 Test failures with capitalized hostname. 2016-06-20 15:27:17 -07:00
A. Jesse Jiryu Davis
ef4798b257 Max staleness tests. 2016-06-20 15:27:17 -07:00
aherlihy
d931f2ddd0 Replaced sleep with wait_util in maxIdleTime/minPoolSize tests 2016-06-20 18:31:04 +02:00
Bernie Hackett
12bd4ac5ea PYTHON-1097 - Support GridFS custom file_id methods 2016-06-17 19:06:47 -07:00
Bernie Hackett
e1850d8abe PYTHON-988 - Deprecate cursor managers and kill_cursors 2016-06-17 10:08:14 -07:00
Bernie Hackett
057429cfca PYTHON-1023 - Explicitly drop support for MongoDB 2.2
We haven't tested against anything older than MongoDB 2.2
in a long timei, but we've never been explicit about what
versions we actually support. As of this commit we are
no longer testing against MongoDB 2.2 either. MongoDB 2.2
reached EOL in February of 2014.
2016-06-15 10:49:00 -07:00
Bernie Hackett
53a7bea492 PYTHON-1022 - Drop support for Python 3.2
This change removes the u() helper from bson.py3compat
and all of its uses in the driver and tests. PyPy3 continues
to be supported since, even though it is based on python 3.2.5,
it has always supported the u string prefix.

The README and install docs are now explicit about PyPy(3) support.
2016-06-15 10:05:43 -07:00
Bernie Hackett
7afca2faa9 PYTHON-1067 - Minor doc fixes 2016-06-14 11:32:24 -07:00
aherlihy
d5082fe45c Remove event_listeners from URI_VALIDATORS 2016-06-14 17:58:59 +02:00
aherlihy
d98a745700 PYTHON-1067 - Implement SDAM Monitoring 2016-06-14 15:20:19 +02:00
aherlihy
10608144d6 PYTHON-658 - Support minPoolSize, maxIdleTimeMS 2016-06-14 14:37:06 +02:00
Luke Lovett
ecab1c9432 PYTHON-1090, PYTHON-1098 - Use sane codec options when reading write responses.
When reading a write response from the server, we now use the 'replace'
unicode_decode_error_handler and 'dict' as the document_class.
2016-06-01 13:34:18 -07:00
Laurent Arnoud
8df6b7cdc5 Add missing backquote for CERT_REQUIRED 2016-06-01 11:03:14 -07:00
Adam Chainz
a5383b6c49 Convert readthedocs link for their .org -> .io migration for hosted projects
As per their email ‘Changes to project subdomains’:

> Starting today, Read the Docs will start hosting projects from subdomains on the domain readthedocs.io, instead of on readthedocs.org. This change addresses some security concerns around site cookies while hosting user generated data on the same domain as our dashboard.

Test Plan: Manually visited all the links I’ve modified.
2016-05-31 12:48:11 -07:00
Bernie Hackett
3025d68af0 PYTHON-1093 - Use extras_require to install optional dependencies 2016-05-26 16:47:23 -07:00
Bernie Hackett
80fc55aae7 PYTHON-750 - Support cross realm GSSAPI tests 2016-05-26 16:23:53 -07:00
Bernie Hackett
fe6f485de8 Really test SERVICE_REALM 2016-05-26 16:23:53 -07:00
Bernie Hackett
7e92cda92a Update WinKerberos link 2016-05-26 16:23:53 -07:00
Bernie Hackett
0abfba6155 PYTHON-750 - Kerberos SSPI support for Windows 2016-05-26 16:23:53 -07:00
Bernie Hackett
db1dea6f73 PYTHON-1042 - Support client certificate passphrase 2016-05-26 14:59:42 -07:00
Bernie Hackett
d7abe6e7be PYTHON-1073 - Support certificate revocation lists 2016-05-24 11:47:49 -07:00
A. Jesse Jiryu Davis
2ac4855661 PYTHON-1076 Must set WSGIDaemonProcess with mod_wsgi.
WSGIScriptAlias alone means the application runs in "embedded" mode,
which we don't support.
2016-05-20 16:27:10 -04:00
Bernie Hackett
59d8fdadc1 PYTHON-1058 - Support decoding datetime.isoformat format for $date
This change also adds support for the (+|-)HH offset format.
2016-05-20 13:12:47 -07:00
Bernie Hackett
740fc3c07a PYTHON-1033, PYTHON-1034 - Make protocol asserts exceptions
This change introduces a new exception, pymongo.errors.ProtocolError,
and uses it in place of asserts related to the wire protocol.
2016-05-19 17:18:00 -07:00
Bernie Hackett
1413bb0077 PYTHON-1087 - Fix __repr__ handling of *TimeoutMS=None 2016-05-19 15:19:27 -07:00
Bernie Hackett
c6907bd40d PYTHON-1086 - Fix find_one documentation 2016-05-18 14:57:30 -07:00
Bernie Hackett
ecbbb8a442 Start work on 3.3 2016-05-18 13:32:01 -07:00
A. Jesse Jiryu Davis
0a6f92a048 FAQ formatting. 2016-03-23 13:09:18 -04:00
Bernie Hackett
0b34f9702c BUMP 3.2.2 2016-03-15 15:48:41 -07:00
Bernie Hackett
a107dec568 Changelog for 2.9.3 2016-03-15 15:44:14 -07:00
Bernie Hackett
03e53a9511 Changelog for 3.2.2 2016-03-14 16:54:15 -07:00
Bernie Hackett
80aa1117fd PYTHON-1071 - Use command reported namespace for getMore 2016-03-14 13:47:45 -07:00
Bernie Hackett
36817ac0f6 Fix a racy test 2016-03-10 15:34:58 -08:00
Bernie Hackett
7ee852a00f PYTHON-1070 - Make index cache thread safe 2016-03-10 07:42:00 -08:00
Bernie Hackett
241a898813 PYTHON-1059 - Make kwarg only options unknown to the URI parser 2016-03-09 12:14:18 -08:00
Bernie Hackett
b227f07cf0 PYTHON-1063 - Add an example doc for tailable cursors 2016-03-08 17:46:23 -08:00
Bernie Hackett
6c4e4b5a81 PYTHON-1065 - Support 1 for batch_size with MongoDB >= 3.2 2016-03-07 17:48:54 -08:00
Bernie Hackett
e873e272fe Fix a test for MongoDB 3.3 behavior change 2016-03-03 16:00:10 -05:00
Bernie Hackett
63c8fd34dd PYTHON-1060 - Remove command document repr from exception messages 2016-03-02 17:16:27 -05:00
Bernie Hackett
98dcaa2363 PYTHON-1056 - Disallow double quotes in database names 2016-03-02 16:25:50 -05:00
Sergey Ninua
1d81aea087 allow connect option to be passed as string 2016-03-02 15:43:07 -05:00
Bernie Hackett
ddbd2ddc25 PYTHON-1062 - Only use "textSearchEnabled" when testing MongoDB 2.4 2016-03-02 15:32:52 -05:00
Bernie Hackett
07b0f78585 Start work on 3.2.2 2016-03-02 15:18:11 -05:00
Luke Lovett
22fd629968 BUMP 3.2.1 2016-02-02 14:46:48 -08:00
Luke Lovett
7d701e27dd Update changelog for 3.2.1. 2016-02-02 14:46:13 -08:00
Bernie Hackett
3279d03131 PYTHON-1052 - Clarify delegated auth example 2016-02-02 14:22:24 -08:00
Bernie Hackett
49c847f9b5 Fix a few issues discovered by coverity scan 2016-02-01 17:05:28 -08:00
A. Jesse Jiryu Davis
9e6b66c499 PYTHON-1050 Rare RuntimeError during shutdown. 2016-01-30 12:51:51 -05:00
Luke Lovett
9b9ad1747d PYTHON-1047 - inline_map_reduce should execute the mapreduce command only once. 2016-01-28 17:37:31 -08:00
Bernie Hackett
6a14d70120 PYTHON-1044 - Fix up unknown BSON type handing 2016-01-28 11:21:34 -08:00
Bernie Hackett
46d9cf9d07 PYTHON-1041 - Update monitoring spec tests to latest
Also fix a number of bugs in the test runner.
2016-01-15 10:49:47 -08:00
Bernie Hackett
4bad518ccd Filter out killCursors in some monitoring tests 2016-01-12 16:27:20 -08:00
Bernie Hackett
15a18aa785 Debug a spurious test failure 2016-01-08 16:42:55 -08:00
Bernie Hackett
e09ded21e0 Fix a test when running with WT 2016-01-08 15:38:30 -08:00
Bernie Hackett
12a698d3ff PYTHON-1029 - Assert messageLength <= maxMessageSizeBytes 2016-01-08 15:07:37 -08:00
A. Jesse Jiryu Davis
c34eec8fad PYTHON-1036 use setVersion to detect stale primary 2015-12-23 17:22:43 -06:00
Bernie Hackett
792b7626dc PYTHON-1021 - Support git describe based server versions 2015-12-15 13:33:23 -08:00
aherlihy
a3cf3cf568 PYTHON-1031 - GridFsBucket.download_to_stream now uses GridOutIterator 2015-12-15 15:28:20 -05:00
Bernie Hackett
aa12164d27 Start work on 3.2.1 2015-12-15 11:01:44 -08:00
Bernie Hackett
23478e84c6 BUMP 3.2 2015-12-07 16:28:13 -08:00
Bernie Hackett
08a668f36d PYTHON-1019 - GridIn must use ReadPreference.PRIMARY 2015-12-07 11:23:06 -08:00
Bernie Hackett
af6d5e39dc Modernize installation docs 2015-12-03 17:26:08 -08:00
A. Jesse Jiryu Davis
d6e1308955 Motor now supports asyncio. 2015-12-03 20:22:03 -05:00
Bernie Hackett
5e1b08090f Post rc0 work 2015-12-03 17:05:22 -08:00
Bernie Hackett
a2170e6140 BUMP 3.2rc0 2015-11-18 21:09:25 -08:00
Bernie Hackett
275e8c3a9e Documentation and changelog updates for 3.2 2015-11-18 20:26:49 -08:00
Felix Yan
13f86c598a PYTHON-1009 Switch from "Monotime" to "monotonic" 2015-11-18 19:32:36 -08:00
Luke Lovett
29df784185 PYTHON-989 - Fix find_one_and_write_concern test when run with authentication. 2015-11-18 16:50:55 -08:00
Bernie Hackett
0d274781db Fix a test for MongoDB 3.2 change 2015-11-18 16:41:10 -08:00
Luke Lovett
cbf4b770e4 PYTHON-472 - Fix raw BSON tests when run with authentication. 2015-11-18 16:16:31 -08:00
Bernie Hackett
733079b149 PYTHON-1014 - Omit $readPreference from find command 2015-11-18 15:46:55 -08:00
Bernie Hackett
58781f12d6 PYTHON-1014 - Minor test fix 2015-11-18 15:31:54 -08:00
aherlihy
ab400361cc PYTHON-1014 - Unrecognized $ operators now included in find command 2015-11-18 15:04:36 -08:00
Bernie Hackett
b93c10504c PYTHON-985 - Fix cursor test for is_mongos changes 2015-11-18 15:02:38 -08:00
aherlihy
596f80fc8d PYTHON-985 - MongoClient properties now block until connected 2015-11-18 15:02:38 -08:00
Luke Lovett
e4d3392f90 PYTHON-472 - Add a RawBSONDocument class that decodes its comprising bytes only on-demand.
This provides an API for inserting and returning raw BSON.
2015-11-18 15:00:09 -08:00
Luke Lovett
504d4b206c PYTHON-989 - Don't use unsatisfiable write concern in tests against non-replica sets. 2015-11-18 14:20:14 -08:00
Luke Lovett
7f14b69c3c PYTHON-989 - Check for write concern errors when using the findAndModify command. 2015-11-18 14:20:14 -08:00
aherlihy
2d960ac520 PYTHON-968 - Handle EINTR error 2015-11-18 14:17:56 -08:00
aherlihy
894775c70c Prohibit bypass_document_validation with w=0 2015-11-18 14:17:56 -08:00
aherlihy
ab6b3a3b1b Add support for maxAwaitTimeMS to getMore 2015-11-18 14:17:56 -08:00
aherlihy
36129ed2aa Don't set the slaveOk bit on getMore and killCursors commands 2015-11-18 14:17:56 -08:00
Luke Lovett
448859b139 PYTHON-981 - Optimize looking for $out in aggregation pipeline. 2015-11-18 14:17:56 -08:00
aherlihy
44872948a4 Revised partial index tests for new explain format 2015-11-18 14:17:56 -08:00
Luke Lovett
393ed35866 PYTHON-981 - Apply collection-level read concern to *_map_reduce and aggregate when appropriate. 2015-11-18 14:17:56 -08:00
aherlihy
f5b44ea35f PYTHON-982 - Support bypassDocumentValidation 2015-11-18 14:17:56 -08:00
Hannes Magnusson
bcf0d57df3 PYTHON-990: Fix argument name in notes 2015-11-18 14:12:28 -08:00
aherlihy
9364abe46a PYTHON-990 - Support partial indexes 2015-11-18 14:12:28 -08:00
aherlihy
b8528100e1 PYTHON-978 - Use getMore command for CommandCursor 2015-11-18 14:12:28 -08:00
Luke Lovett
2942d50c34 PYTHON-989 - Support write concern in find_and_modify, find_one_and_XXX. 2015-11-18 14:12:28 -08:00
Luke Lovett
dde4a658b5 PYTHON-981 - Implement ReadConcern. 2015-11-18 14:12:28 -08:00
aherlihy
5396444f3c PYTHON-978 - Use killCursors command 2015-11-18 12:57:48 -08:00
aherlihy
497998dbd6 Skip find monitoring tests for > 3.1.5 2015-11-18 12:57:47 -08:00
aherlihy
1a3aeea426 PYTHON-978 - Use find/getMore commands 2015-11-18 12:57:47 -08:00
Bernie Hackett
01eb25b2b0 PYTHON-979 - Update fsyncUnlock helper for command monitoring 2015-11-18 12:57:47 -08:00
aherlihy
cfa23481fa PYTHON-979 - Use fsync command 2015-11-18 12:57:47 -08:00
Bernie Hackett
ec47de71f2 PYTHON-979 - Update currentOp helper for command monitoring 2015-11-18 12:57:47 -08:00
aherlihy
1764aaa6b8 PYTHON-979 - Use currentOp command 2015-11-18 12:57:47 -08:00
Bernie Hackett
0862de6164 Start work on 3.2 2015-11-18 12:53:49 -08:00
Bernie Hackett
953cfaafd7 BUMP 3.1.1 2015-11-17 16:40:02 -08:00
Bernie Hackett
2ba55a446f Minor changelog updates 2015-11-17 15:35:41 -08:00
Luke Lovett
c63c0f1d91 PYTHON-1013 - Only reraise PyExc_Exceptions as InvalidBSON in C extensions. 2015-11-17 11:07:39 -08:00
Bernie Hackett
b6d6954d09 Changelog updates for PyMongo 3.1.1 2015-11-16 16:48:32 -08:00
Bernie Hackett
cab20bd7f1 PYTHON-1011 - Raise DocumentTooLarge when appropriate 2015-11-16 15:33:13 -08:00
aherlihy
af0daa4fc4 PYTHON-1010 write_dict now checks the error indicator when exiting iteration loop 2015-11-13 10:58:23 -05:00
Bernie Hackett
631e23eb95 Claim support for python 3.5 2015-11-13 10:33:34 -05:00
Bernie Hackett
c873ef3fdb Start work on 3.1.1 2015-11-13 10:30:14 -05:00
Bernie Hackett
928b06882b BUMP 3.1 2015-11-02 14:58:34 -08:00
Bernie Hackett
06f200e1d5 BUMP 3.1rc0 2015-10-19 17:11:09 -07:00
Bernie Hackett
c7c2567a8d Clean up read preference tests 2015-10-16 17:24:34 -07:00
A. Jesse Jiryu Davis
06b32a00ab PYTHON-1003 Test _list_collections uses one socket at a time. 2015-10-16 17:06:06 -04:00
A. Jesse Jiryu Davis
dc709127e3 PYTHON-1003 Avoid checking out multiple sockets per thread. 2015-10-16 17:06:06 -04:00
Bernie Hackett
52ebf27413 Remove arbitrary wtimeout from gridfs tests 2015-10-15 21:02:13 -07:00
A. Jesse Jiryu Davis
e6457cdd3e PYTHON-983 Update docs for new executor design. 2015-10-15 00:37:39 -04:00
A. Jesse Jiryu Davis
4618998dd1 PYTHON-983 Idle monitor threads use excessive CPU. 2015-10-14 23:52:18 -04:00
Bernie Hackett
c0df9955f4 Changelog for 3.1 2015-10-12 12:28:31 -07:00
Bernie Hackett
7ac3b9eac7 Include changelog from 2.9 2015-10-12 11:24:57 -07:00
Bernie Hackett
101f704744 PYTHON-952 - Redact command and reply documents for sensitive commands 2015-10-11 14:19:16 -07:00
Bernie Hackett
5c9f97e66c PYTHON-952 - Fix global tests when auth is enabled 2015-10-11 09:48:24 -07:00
Bernie Hackett
6c494079a7 PYTHON-952 - Minor test fix 2015-10-09 17:59:23 -07:00
Bernie Hackett
28885b25e8 PYTHON-952 - API improvements
This commit implements the following simplifications and improvements:

- The Subscriber ABC has been renamed to CommandListener
- The subscribe function has been renamed to register
- The COMMAND constant has been removed
- The get_subscribers function has been removed
- Command listeners can now be registered per MongoClient instance
  instead of just globally
2015-10-09 17:03:51 -07:00
Luke Lovett
875251c3d9 PYTHON-976 - Use str(exception) instead of exception.message to support Python 3. 2015-10-07 12:51:50 -07:00
Luke Lovett
22c79ac0f6 PYTHON-999 - Update SDAM tests and fix related failures. 2015-10-07 11:55:35 -07:00
Luke Lovett
b6182d0587 PYTHON-976 - Publish a CommandFailedEvent for arbitrary failures. 2015-10-07 11:08:05 -07:00
Bernie Hackett
519f0682c5 Fix a bulk operations test for MongoDB 3.2 behavior change 2015-10-05 14:44:49 -07:00
Bernie Hackett
489d5172ee PYTHON-997 - Add FAQ entry about _id and document mutation 2015-10-05 10:52:02 -07:00
Bernie Hackett
680fee7f27 PYTHON-991 - Fix out of date note about "not master" error 2015-10-01 12:55:08 -07:00
Bernie Hackett
a2a83c005f PYTHON-952 - Publish events for uses of _first_batch 2015-09-30 10:14:04 -07:00
Bernie Hackett
8a21411c33 Silence pointless compiler warnings 2015-09-29 18:57:57 -07:00
Bernie Hackett
c327913cbf Fix issues found in coverity scan 2015-09-29 17:29:59 -07:00
Bernie Hackett
62e180ac2b PYTHON-952 - More robust delete_many / remove tests 2015-09-23 17:41:49 -07:00
Bernie Hackett
0558e4b3a4 PYTHON-996 - More aggressively lower recursion limit 2015-09-23 16:42:42 -07:00
Bernie Hackett
40e0d9d14b PYTHON-996 - Work around overflow handling change in python 3.5 2015-09-23 16:11:11 -07:00
Bernie Hackett
4bbe2133a1 PYTHON-996 - Adjust regex tests for python 3.5 2015-09-22 15:17:50 -07:00
Bernie Hackett
b2a6fc61fd Improve socket_closed test 2015-09-21 14:18:19 -07:00
Bernie Hackett
dbcafc44f8 PYTHON-952 - Test improvements 2015-09-16 16:24:40 -07:00
Bernie Hackett
9556805bce PYTHON-952 - Add spec test runner and fix bugs 2015-09-16 12:52:40 -07:00
Bernie Hackett
f5eed9707c Fix up profiling tests for MongoDB 3.1.x 2015-09-11 16:28:36 -07:00
Bernie Hackett
173046ef01 PYTHON-952 - Avoid killCursors in tests 2015-09-10 11:33:31 -07:00
Bernie Hackett
e89a60afe4 PYTHON-952 - Make tests more predictable 2015-09-10 10:20:32 -07:00
Bernie Hackett
b80fa6d632 PYTHON-952 - Bulk write operations monitoring
This change adds monitoring of bulk write operations (i.e.
Collection.bulk_write, Collection.insert_many, Collection.insert with multiple
documents, Bulk.execute, etc.). It also fixes bugs in conversion of legacy
write results to write command result format and conversion of legacy queries
to find command documents. Finally, it adds an operation_id attribute to the
published events to tie related events together.
2015-09-10 09:10:19 -07:00
A. Jesse Jiryu Davis
c4a82814f4 Update MongoDB Manual link for mapreduce command. 2015-09-07 15:24:12 -04:00
Bernie Hackett
a331fa9ff2 PYTHON-977 - Don't use b() on master 2015-09-04 18:38:14 -07:00
Luke Lovett
d5d1d03a3d PYTHON-977 - avoid 'b' string prefix for Python version compatibility in tests. 2015-09-04 16:04:52 -07:00
Luke Lovett
3321b66d34 PYTHON-977 - Fix __hash__ method on BSON types that inherit from Python builtin types.
In Python 2, objects automatically inherit the __hash__ of their parent
class. In Python 3, objects that override __eq__ do not automatically inherit
__hash__, so these objects were not hashable under Python 3.  Additionally,
mutable BSON types and types that overide __eq__ but did not explicitly define
__hash__ had broken __hash__ methods under Python 2.  This commit unifies the
hashing behavior between Python versions and fixes the __hash__ methods such
that two BSON objects hash the same only if they are equal.

N.B.: bson.code.Code and bson.regex.Regex are no longer hashable under Python 2
because they are mutable.
2015-09-04 14:45:24 -07:00
A. Jesse Jiryu Davis
4edbd03d2b More info about gevent monkey patching effects. 2015-09-03 15:58:49 -04:00
Ultrabug
79a57e3a31 enhanced gevent doc with code example wrt #290 2015-09-03 15:58:49 -04:00
Ultrabug
e57ed9d4f8 document gevent monkey patching side effect
when terminating gevent's hub and waiting for remaining greenlets
2015-09-03 15:58:49 -04:00
Bernie Hackett
5c5322387d PYTHON-980 - Document deprecation of the eval command 2015-08-21 17:32:30 -07:00
Bernie Hackett
164cc34320 PYTHON-975 - Name our threads 2015-08-21 17:06:44 -07:00
Bernie Hackett
fe5c119ca4 PYTHON-952 - Fix killCursors for replica set connections 2015-08-21 15:21:03 -07:00
Bernie Hackett
414250b5ef PYTHON-952 - Minor docstring updates 2015-08-21 13:46:05 -07:00
Bernie Hackett
98af86a1ab PYTHON-952 - Fix an issue with killCursors handling 2015-08-21 13:36:31 -07:00
Bernie Hackett
0e4f79c7c3 PYTHON-952 - Non-bulk write operation monitoring 2015-08-21 12:47:08 -07:00
Bernie Hackett
5dba74c005 PYTHON-952 - killCursors monitoring 2015-08-17 16:22:19 -07:00
Bernie Hackett
8ed682b48f PYTHON-974 - Use appropriate hash comparators for sensitive functions 2015-08-14 12:21:33 -07:00
Bernie Hackett
202215d3a4 PYTHON-952 - Publish explain commands when $explain is used 2015-08-14 12:19:50 -07:00
Bernie Hackett
0bc75c1281 Fix monitoring test under auth 2015-08-12 18:25:25 -07:00
Bernie Hackett
07d2199477 PYTHON-952 - Fix duration measurements.
We weren't including the time to decode responses in
a number of places. This commit also fixes an issue with
handling "cursor not found" errors from mongos versions
older than 2.4.
2015-08-12 14:04:21 -07:00
Bernie Hackett
fa4a6a39d3 PYTHON-952 - Query and getMore monitoring
This commit adds support for monitoring queries and getMore
operations, including getMore operations for command cursors
(e.g. aggregate cursor getMore). It also fixes a bug in duration
calculation.
2015-08-11 12:19:28 -07:00
Bernie Hackett
f0a85a4869 PYTHON-952 - Basic command monitoring
This commit adds support for publishing events when commands
(ismaster, findAndModify, listCollections, etc.) start and
succeed or fail. See the new module, pymongo.monitoring, for
details.

This commit only adds basic infrastructure and support for
monitoring generic commands. Support for monitoring queries,
getMores, killCursors, and write operations are forthcoming.
2015-08-11 11:39:03 -07:00
aherlihy
04b1b8ad34 open_upload_stream returns only GridIn 2015-08-11 12:14:06 -04:00
Adam Meily
d06a6397b8 Addressed comments in PR: changed insert_many() to accept any iterable. 2015-08-06 14:58:37 -07:00
Adam Meily
1e5c8974ee Added unit test for insert_many() with a generator 2015-08-06 14:58:37 -07:00
Adam Meily
35f9895a78 insert_many(): Added support for generators 2015-08-06 14:58:37 -07:00
aherlihy
193915e636 PYTHON-959 - Connection string spec compliance. 2015-08-06 13:14:31 -04:00
aherlihy
b9baa8ae8a PYTHON-960 - GridFS spec compliance 2015-08-06 12:41:40 -04:00
Bernie Hackett
8b986a4f2c PYTHON-967 - Call print as a function in README 2015-08-05 18:25:29 -07:00
Luke Lovett
f62dbc15bd PYTHON-969 - Check return value from PyObject_Call before using it in PyObject_GetAttrString. 2015-07-22 16:43:34 -07:00
aherlihy
07ff7ea721 PYTHON-961 - Add warning to prevent deadlock during getaddrinfo. 2015-07-21 17:07:55 -04:00
aherlihy
6b644054b7 PYTHON-860 - Ignore unauthorized errors for index creation in GridFs 2015-07-21 12:33:34 -04:00
aherlihy
aab0bd5c46 PYTHON-962 - NotImplemented instead of NotImplementedError 2015-07-21 12:13:46 -04:00
Luke Lovett
5140166772 PYTHON-928 - Fix tests around MongoReplicaSetClient __repr__ to expect original seed list instead of discovered nodes. 2015-07-17 16:41:06 -07:00
Luke Lovett
43683041fe PYTHON-928 - Fix tests around client __repr__ to expect original seed list instead of discovered nodes. 2015-07-17 15:57:23 -07:00
Luke Lovett
5f14e1b9bf PYTHON-928 - Enhance __repr__ of MongoClient with other options passed in to the constructor. 2015-07-17 14:49:36 -07:00
Bernie Hackett
74eb28c7cd Migration guide updates 2015-07-17 13:24:42 -07:00
A. Jesse Jiryu Davis
bbff9ff015 Add new SDAM test, stepdown_change_set_name. 2015-07-14 22:10:01 -04:00
Bernie Hackett
728c17f1ad PYTHON-884 - Add 3.0 migration guide. 2015-07-14 13:32:34 -07:00
Bernie Hackett
39c41b277e Fix $comment tests for MongoDB 3.1.x. 2015-07-13 17:18:49 -07:00
Bernie Hackett
77de378c2a PYTHON-963 - A few more doctest fixes. 2015-07-13 16:30:58 -07:00
Guillaume Gelin
2323a1c735 Use a standard version variable name (specified by PEP8)
See https://www.python.org/dev/peps/pep-0008/#version-bookkeeping
2015-07-13 14:43:17 -07:00
Luke Lovett
8dad0f05fd PYTHON-963 - Fix doctests for documentation when running against MongoDB 2.6.x, 3.0.x. 2015-07-10 16:26:01 -07:00
Luke Lovett
880394fe99 PYTHON-222 - Add a 'tzinfo' attribute to CodecOptions that specifies a timezone to which to decode datetime objects. 2015-07-09 13:32:23 -07:00
aherlihy
39308c4b2f PYTHON-721 - Add unicode_decode_error_handler to CodecOptions. 2015-07-09 15:08:02 -04:00
Luke Lovett
70be0d8911 PYTHON-964 - Raise ConnectionFailures properly when connecting to Unix-domain sockets. 2015-07-09 11:57:24 -07:00
Jonatan Samoocha
8fd0da832a Corrected return value for comparison of different types 2015-07-08 15:10:25 -07:00
Jonatan Samoocha
82bfa718cc Added unit tests for remaining write operation comparisons 2015-07-08 15:10:25 -07:00
Jonatan Samoocha
3847d14cd9 Added rich comparison methods to _WriteOp superclass 2015-07-08 15:10:25 -07:00
Jonatan Samoocha
5142dae7e6 Added unit test to demonstrate issue of unavailable rich comparison methods 2015-07-08 15:10:25 -07:00
aherlihy
1fefda2e00 PYTHON-307 Replace select with poll on platforms that support it. 2015-07-08 15:03:11 -07:00
Bernie Hackett
a88940506b Start work on 3.1.0. 2015-07-08 15:00:19 -07:00
Bernie Hackett
f3931c1e19 BUMP 3.0.3 2015-06-30 17:36:56 -07:00
Bernie Hackett
d3d8ab8fc0 Update MANIFEST.in 2015-06-30 15:39:25 -07:00
Bernie Hackett
4927e7aba4 Changelog for 3.0.3. 2015-06-30 15:37:16 -07:00
Bernie Hackett
53353f8fd8 PYTHON-954 - Update links and text for TxMongo 2015-06-30 15:03:06 -07:00
Luke Lovett
6a0d85451e Fix authentication error in test_authenticate_multiple for MongoDB 2.2 sharded. 2015-06-25 14:23:08 -07:00
A. Jesse Jiryu Davis
c226b4fb93 PYTHON-939 - AttributeError during shutdown.
I was treating a weakref.ref as if it were a weakref.proxy.
2015-06-16 20:28:59 -04:00
Bernie Hackett
5fcc5c72ac PYTHON-951 - Raise CorruptGridFile for truncated chunks. 2015-06-16 16:43:15 -07:00
A. Jesse Jiryu Davis
06e7649da1 PYTHON-859 - Start dev guide with entry on PeriodicExecutor. 2015-06-15 20:40:49 -04:00
A. Jesse Jiryu Davis
a316c6576d PYTHON-939 - Stop background threads quicker.
Instead of signaling each thread to close, then waiting for it to finish
before signaling the next, instead signal all threads to close and let
them stop in parallel before joining any.

Additionally, spend less time holding strong references to threads.
2015-06-15 20:37:11 -04:00
Jason R. Coombs
1c806791a9 PYTHON-946 - Allow fields to be any sequence. 2015-06-15 14:43:44 -07:00
Bernie Hackett
e73406370c PYTHON-942 - Fix changelog guidance to no_cursor_timeout. 2015-06-15 13:39:14 -07:00
Bernie Hackett
87580b188b PYTHON-934 - Add another simple URI test. 2015-06-15 13:18:58 -07:00
Len Buckens
64009228f8 PYTHON-934 - allow ssl_match_hostname option to be passed as string 2015-06-15 13:16:30 -07:00
aherlihy
66dbe93d45 PYTHON-945 - Remove validation of the OP_REPLY "startingFrom" field. 2015-06-08 16:24:13 -07:00
aherlihy
f4bcdc9e14 PYTHON-940 - Unhelpful and pretty wrong error message. 2015-06-08 15:50:16 -07:00
aherlihy
1e7ebb1792 PYTHON-933 - "maxPoolSize=0" allowed, causes hang. 2015-06-08 14:23:00 -07:00
Bernie Hackett
ff3c18ffbc PEP440 version numbers... 2015-05-19 10:38:24 -07:00
A. Jesse Jiryu Davis
baa6cf0fd8 PYTHON-932 - Attribute err in GSSAPI / Kerberos 2015-05-19 13:34:50 -04:00
A. Jesse Jiryu Davis
056d1a01f4 Version -> + 2015-05-19 13:34:38 -04:00
Bernie Hackett
3271ea29c3 BUMP 3.0.2 2015-05-12 12:26:24 -07:00
Bernie Hackett
a2b6bd2d97 Changelog for PyMongo 3.0.2. 2015-05-11 16:13:56 -07:00
Bernie Hackett
6e17485c5f Changelog for PyMongo 2.8.1. 2015-05-11 11:02:44 -07:00
A. Jesse Jiryu Davis
3d1c20669c PYTHON-924 - Use electionId to detect stale primaries. 2015-05-11 12:17:59 -04:00
Bernie Hackett
51cadce6fb PYTHON-915 - More robust tests. 2015-05-08 11:48:29 -07:00
Bernie Hackett
f506d8b69f PYTHON-915 - Accept 0 for localThresholdMS. 2015-05-08 08:34:15 -07:00
Bernie Hackett
3d65bab521 PYTHON-927 - Document the non-static nature of MongoClient.nodes 2015-05-07 17:01:31 -07:00
Bernie Hackett
4cb6815397 PYTHON-923 - Add changelog entry about bson.int64.Int64 2015-05-07 16:31:15 -07:00
Bernie Hackett
785ff28cd1 PEP8 2015-05-07 16:14:46 -07:00
nahumoz@gmail.com
c43da1c281 Add log4mongo-python
Log4mongo-python is actively maintained and upaded to the latest pymongo versions (2.8 and 3.X).
2015-05-07 16:12:59 -07:00
Bernie Hackett
58ab8df727 PYTHON-894 - More doc clarifications for alive. 2015-05-07 14:52:31 -07:00
Bernie Hackett
f282babff0 PYTHON-926 - ReadPreference.NEAREST shouldn't pick arbiters. 2015-05-07 14:50:38 -07:00
A. Jesse Jiryu Davis
c31d4808bf PYTHON-922 - Read preferences support copy and pickle. 2015-05-04 21:43:36 -04:00
A. Jesse Jiryu Davis
dce3f366cc Start 3.0.2 with proper formatting. 2015-04-23 23:28:22 -04:00
A. Jesse Jiryu Davis
a6535c5c7b PYTHON-912 - Never try auth with a recovering RS member. 2015-04-23 23:24:36 -04:00
A. Jesse Jiryu Davis
df2962fb9f Start 3.0.2. 2015-04-23 23:14:02 -04:00
Bernie Hackett
a5131ff234 BUMP 3.0.1 2015-04-21 13:35:46 -07:00
Bernie Hackett
94c69e269e PYTHON-908 - Document serverSelectionTimeoutMS.
Also clarify connectTimeoutMS and socketTimeoutMS.
2015-04-21 12:58:04 -07:00
Bernie Hackett
07e8cd9e01 PYTHON-907 - Fix MANIFEST.in for doc theme changes. 2015-04-21 09:50:18 -07:00
Bernie Hackett
70185ff98e Add 2.7.x release notes to 3.x changelog. 2015-04-20 16:25:06 -07:00
Bernie Hackett
a69eb517a0 Fix imports in test_read_preferences. 2015-04-20 16:19:46 -07:00
Bernie Hackett
9e3662dddb README fixes. 2015-04-20 16:04:06 -07:00
Bernie Hackett
6e1115db37 Changelog for 3.0.1. 2015-04-20 16:00:35 -07:00
Bernie Hackett
55578f9405 Use modern PyMongo in tests. 2015-04-20 15:12:35 -07:00
Bernie Hackett
4026787edf Fix docstring. 2015-04-20 15:04:54 -07:00
Bernie Hackett
bc5e7d6ac9 PYTHON-905 - Fix $readPreference with query modifiers. 2015-04-20 15:02:17 -07:00
behackett
48c3787889 Add required whitespace. 2015-04-19 10:39:30 -07:00
Vladimir Savin
343fce35be Small fix documentation aggregation
Updated the example of Grouping
2015-04-19 10:34:48 -07:00
A. Jesse Jiryu Davis
edde3d6576 PYTHON-900 - Python 3-compatible test. 2015-04-17 17:33:14 -04:00
A. Jesse Jiryu Davis
c6c8393a61 PYTHON-894 - Skip aggregation cursor test on old mongods. 2015-04-17 16:19:45 -04:00
A. Jesse Jiryu Davis
cb64f87aa6 PYTHON-894 - Set cursor.alive False after final batch.
Even with this change, "next" can raise StopIteration even though
"alive" is True. For example if batch size is 2 and there are 4
documents in the result set, then after the 4th document "alive" is True
but "next" raises StopIteration.
2015-04-17 14:56:36 -04:00
behackett
42fc925b11 PYTHON-900 - Fix GridFS.delete(). 2015-04-16 20:20:22 -07:00
A. Jesse Jiryu Davis
81549e0608 PYTHON-898 - Fix case of getmore with removed RS member. 2015-04-15 21:44:07 -04:00
A. Jesse Jiryu Davis
2cc37059b8 PYTHON-898 - Send getMore to same mongos as initial query. 2015-04-15 17:14:25 -04:00
Bernie Hackett
d3aa09a165 PYTHON-895 - Fix _list_collections OP_GET_MORE for legacy servers.
This also pedantically fixes the same issue for list_indexes, which
can't technically fail in the same way since you are limited
to 64 indexes on a collection.
2015-04-14 12:03:47 -07:00
Bernie Hackett
1a8478dbd5 PYTHON-893 - Fix application of SON manipulators in CommandCursor. 2015-04-14 11:39:23 -07:00
Bernie Hackett
b1810c4461 PYTHON-876 - Better docs and test for modifiers Cursor param. 2015-04-11 15:08:49 -07:00
Bernie Hackett
dfc7551542 PYTHON-875 - Fix Cursor.hint(<index spec>).count() 2015-04-11 15:06:53 -07:00
Bernie Hackett
8623f6e190 PYTHON-891 - Collection.save should always return _id. 2015-04-11 15:05:39 -07:00
Bernie Hackett
567ac2f9ea Start work on 3.0.1. 2015-04-09 16:50:45 -07:00
Bernie Hackett
18328a9095 BUMP 3.0 2015-04-07 15:05:22 -07:00
Bernie Hackett
ad53c1a594 Update install docs. 2015-04-07 14:56:40 -07:00
A. Jesse Jiryu Davis
7e05938452 Capitalize "Python" in changelog. 2015-04-07 16:30:02 -04:00
A. Jesse Jiryu Davis
23eaebf7b2 Note the loss of Connection and ReplicaSetConnection. 2015-04-07 16:29:25 -04:00
Bernie Hackett
5c497b9b7f Add TLS/SSL example docs. 2015-04-07 12:04:15 -07:00
A. Jesse Jiryu Davis
9690a5a2d5 PYTHON-821 - Note that the new CRUD API methods don't apply SON manipulators. 2015-04-06 13:53:51 -04:00
Bernie Hackett
c7313115b6 Merge pull request #259 from nickmilon/patch-1
Update collection.py
2015-04-05 15:57:52 -07:00
Nick Milon
d5fcf12aa0 Update collection.py
small typo in doc string
2015-04-06 00:52:59 +03:00
Bernie Hackett
16d22915ea PYTHON-874 - Support wincertstore as ca_certs fallback on Windows. 2015-04-03 13:39:11 -07:00
Bernie Hackett
fbeca92430 PYTHON-874 - Support certifi as ca_certs fallback on old pythons. 2015-04-03 09:46:18 -07:00
A. Jesse Jiryu Davis
6547e1008b PYTHON-863 - Fix heartbeatFrequencyMS.
Had slept 10.5 seconds between checks instead of 10 seconds. Introduced in
previous commit.
2015-04-02 22:35:26 -04:00
A. Jesse Jiryu Davis
fa89e4ae38 PYTHON-863 - Don't take a lock from a weakref callback. 2015-04-02 16:12:05 -04:00
A. Jesse Jiryu Davis
5648745d0b PYTHON-863 - Ref cycle in Monitor. 2015-04-02 13:42:17 -04:00
Bernie Hackett
22c16c70ed Post rc1. 2015-04-01 18:37:25 -07:00
Bernie Hackett
3dd5309378 BUMP 3.0rc1 2015-04-01 18:09:12 -07:00
Bernie Hackett
0444783a20 Update install docs. 2015-04-01 17:37:35 -07:00
Bernie Hackett
12465b9021 PYTHON-872 - Update changelog. 2015-04-01 17:31:35 -07:00
Bernie Hackett
f42422a310 PYTHON-872 - Test ConfigurationError. 2015-04-01 15:43:39 -07:00
Bernie Hackett
5dca43758e PYTHON-872 - Can't test loading system CA certs on Windows. 2015-04-01 15:43:39 -07:00
Bernie Hackett
330e6c8e04 PYTHON-872 - Add tests. 2015-04-01 15:43:39 -07:00
Bernie Hackett
365c9bad72 PYTHON-872 - Better error message on handshake failure. 2015-04-01 15:43:39 -07:00
Bernie Hackett
d396068e6a PYTHON-872 - Default to ssl.CERT_REQUIRED when ssl=True.
If ssl=True is passed as a keyword arg (or ssl=true in the URI)
but no value for ssl_cert_reqs or ssl_ca_certs has been provided,
assume ssl.CERT_REQUIRED for cert_reqs and attempt to load
system provided CA certificates. Raise ConfigurationError if
the necessary SSLContext methods don't exist.
2015-04-01 15:43:39 -07:00
A. Jesse Jiryu Davis
e786e993e6 Delete obsolete test_pool_with_fork. 2015-04-01 12:31:18 -04:00
A. Jesse Jiryu Davis
400bb19950 Fix racy tests of legacy unacknowledged writes.
Each test that writes to a collection with w=0 uses its own exclusive collection,
to avoid intermittently breaking subsequent tests.
2015-04-01 11:19:09 -04:00
A. Jesse Jiryu Davis
6865ba72ed Redundant assignment in test_crud.py. 2015-03-31 16:46:40 -04:00
A. Jesse Jiryu Davis
34bdbbe120 Reuse global test client in test_crud.py. 2015-03-31 16:45:40 -04:00
Bernie Hackett
3716b449cc PYTHON-871 - Fix encoding of defaultdict. 2015-03-27 14:35:09 -07:00
Bernie Hackett
5df17c2c63 PYTHON-818 - Remove unicode_literals future imports. 2015-03-27 10:08:11 -07:00
Bernie Hackett
76530ccd72 PYTHON-870 - Fix two unlikely reference leaks. 2015-03-26 13:00:40 -07:00
Bernie Hackett
e88764d9e0 PYTHON-869 - Use ReadPreference.PRIMARY for current_op and unlock. 2015-03-26 12:58:27 -07:00
Bernie Hackett
bfb273ddec Post rc0. 2015-03-25 14:02:41 -07:00
Bernie Hackett
8e5fdc6134 BUMP 3.0rc0 2015-03-25 13:16:50 -07:00
Bernie Hackett
aec685b374 Fix up copyright dates. 2015-03-25 11:55:02 -07:00
Bernie Hackett
7d4f916b64 Update install docs. 2015-03-25 10:58:29 -07:00
Bernie Hackett
981414da40 Define and use some constants. 2015-03-24 17:53:36 -07:00
Luke Lovett
7b5ae760a9 Close socket in test_pool_check. 2015-03-25 00:31:07 +00:00
Bernie Hackett
d2f9807cd1 PYTHON-857 - Remove MongoClient.(min|max)_wire_version.
The min_wire_version and max_wire_version attributes have
always been racy when connected to a mixed version replica set
or any sharded cluster. When connected to a mongos all you know
is the wire version of that mongos, not the shards behind it.
With mongos load balancing this problem is even worse, since
each operation could possibly be executed on a different mongo
version during an upgrade.
2015-03-24 14:38:25 -07:00
Bernie Hackett
ffbc6b995b Various doc fixes. 2015-03-24 14:28:04 -07:00
Bernie Hackett
b136092a22 PYTHON-857 - Delete test_wire_version_mongos_ha. 2015-03-24 13:27:25 -07:00
Bernie Hackett
be69d19513 PYTHON-857 - Clean up _command helper return values. 2015-03-24 13:24:02 -07:00
Bernie Hackett
725f834218 PYTHON-868 - Apply local threshold for mongos load balancing. 2015-03-24 08:43:41 -07:00
A. Jesse Jiryu Davis
2fa9231bbd PYTHON-868 - Fix secondary reads in Sharded mode. 2015-03-23 22:16:17 -04:00
Bernie Hackett
e7c5cafc07 PYTHON-865 - Fix mongos $readPreference issues. 2015-03-23 19:07:15 -07:00
Bernie Hackett
2d3f02ed38 PYTHON-857 - Fix options() for legacy server versions. 2015-03-23 14:44:35 -07:00
Bernie Hackett
4c30fae1f2 PYTHON-857 - Fix race in collection_names and options. 2015-03-23 13:39:25 -07:00
A. Jesse Jiryu Davis
8925a642ea Fix bulk result for legacy insert with write concern failure. 2015-03-21 20:49:24 -04:00
A. Jesse Jiryu Davis
edd513d3a2 Set SlaveOkay bit for list_indexes / index_information. 2015-03-21 17:28:49 -04:00
A. Jesse Jiryu Davis
a489bcf5b4 Fix test of mapreduce and read preference. 2015-03-21 17:23:47 -04:00
A. Jesse Jiryu Davis
8dd02f16ef Merge branch 'PYTHON-857-writable-max-wv'
* PYTHON-857-writable-max-wv:
  PYTHON-857 - Update C version of batch writes.
  PYTHON-857 - Fix SlaveOkay wire protocol bit for mapreduce.
  PYTHON-857 - Delete MongoClient._writable_max_wire_version().
  PYTHON-857 - Rename _get_socket_for_writes to _socket_for_writes.
  PYTHON-857 - Delete MongoClient._send_message.
  PYTHON-857 - Fix "not master" error handling.
  PYTHON-857 - Remove MongoClient.__check_gle_response.
  PYTHON-857 - Collection and Database use SocketInfo.command.
  PYTHON-857 - Complete wire-protocol race fix in Bulk API.
  PYTHON-857 - Simplify _Bulk.execute_no_results.
  PYTHON-857 - Pass socket to Collection._insert() etc.
  PYTHON-857 - Faster attribute access on SocketInfo.
  Remove MongoDB 2.5.x-specific code for retrieving an upserted _id.
  PYTHON-857 - Use SocketInfo, not MongoClient, in message.py.
  Obsolete comment about max write command size.
  PYTHON-857 - Fix server-reset logic.
  PYTHON-857 - Use client._get_socket_for_writes for write commands.
  PYTHON-857 - Use client._get_socket_for_writes for OP_UPDATE and OP_DELETE.
  PYTHON-857 - Use client._get_socket_for_writes for OP_INSERT.

Conflicts:
	pymongo/collection.py
	pymongo/helpers.py
2015-03-21 17:19:14 -04:00
A. Jesse Jiryu Davis
27874fc2ec PYTHON-857 - Update C version of batch writes.
As with the Python functions, the C implementations of _do_batched_insert and
_do_batched_write command must now take a SocketInfo, not a MongoClient, to
ensure they send the OP_INSERT or write command over the same socket used to
determine the server's wire protocol version.
2015-03-21 16:36:43 -04:00
A. Jesse Jiryu Davis
0fd80eda35 PYTHON-857 - Fix SlaveOkay wire protocol bit for mapreduce.
Server Selection Spec: "Clients MUST always set the slaveOK wire protocol flag
on reads to ensure that any server type can handle the request. If the server
is a secondary, write operations will fail with a "not master" error from the
server; this is by design and is a consequence of using a direct connection to
a secondary."
2015-03-21 10:22:34 -04:00
Bernie Hackett
05fa59f104 PYTHON-866 - Change MIN_HEARTBEAT_INTERVAL to 500ms. 2015-03-20 18:11:08 -07:00
A. Jesse Jiryu Davis
6341a9075b PYTHON-857 - Delete MongoClient._writable_max_wire_version().
The function assumed all writable servers' maxWireVersion was the same, which
may be wrong when load balancing among mongoses during a rolling upgrade. Even
in the case of a standalone or replica set it exposes the driver unnecessarily
to race conditions.
2015-03-20 20:55:08 -04:00
Bernie Hackett
0b104af222 PYTHON-842 - SSL URI config support.
Credit for the ideas in this patch go to Len Buckens (buckensl)
from https://github.com/mongodb/mongo-python-driver/pull/253.
2015-03-20 17:41:13 -07:00
Bernie Hackett
bba49fd618 PYTHON-864 - Support RFC-3339 offset format for $date. 2015-03-20 16:23:55 -07:00
A. Jesse Jiryu Davis
62df1a7cf5 PYTHON-857 - Rename _get_socket_for_writes to _socket_for_writes. 2015-03-20 11:00:23 -04:00
A. Jesse Jiryu Davis
73fe2826d4 PYTHON-857 - Delete MongoClient._send_message.
The deleted test_stale_killcursors was redundant with
test_kill_cursors_with_server_unavailable.
2015-03-20 09:41:24 -04:00
A. Jesse Jiryu Davis
4bb9da18cf PYTHON-857 - Fix "not master" error handling. 2015-03-19 20:48:51 -04:00
Bernie Hackett
902dbe7ed5 Fix up doc formatting for parallel_scan. 2015-03-19 17:36:01 -07:00
Bernie Hackett
b35b2201de Fix formatting in find() docs. 2015-03-19 17:13:23 -07:00
Bernie Hackett
a5cdb2f652 PYTHON-798 - Improve docs and add examples. 2015-03-19 13:03:48 -07:00
A. Jesse Jiryu Davis
a5fae5bbd5 PYTHON-857 - Remove MongoClient.__check_gle_response. 2015-03-19 14:24:27 -04:00
A. Jesse Jiryu Davis
41bf0080cf PYTHON-857 - Collection and Database use SocketInfo.command. 2015-03-19 14:17:26 -04:00
Bernie Hackett
648e5beabb PYTHON-677 - Really make WriteConcern immutable. 2015-03-19 10:20:03 -07:00
Bernie Hackett
7a49a2947e PYTHON-822 - Remove no longer necessary test workaround. 2015-03-18 15:05:26 -07:00
aherlihy
6cbaed39dc PYTHON-822: Added CRUD YAML tests. 2015-03-18 15:03:03 -07:00
Bernie Hackett
657c5115c9 PYTHON-821 - Improve docs for write result acknowledged attribute. 2015-03-18 14:00:16 -07:00
A. Jesse Jiryu Davis
0b2bb1ad11 PYTHON-857 - Complete wire-protocol race fix in Bulk API. 2015-03-18 15:19:04 -04:00
A. Jesse Jiryu Davis
98922562cf PYTHON-857 - Simplify _Bulk.execute_no_results. 2015-03-18 15:19:04 -04:00
A. Jesse Jiryu Davis
1af1fd27db PYTHON-857 - Pass socket to Collection._insert() etc.
Prepare to solve the wire protocol race in the Bulk API. Acquire a socket
before calling Collection._insert, _update, or _remove.

Remove _Bulk.legacy_insert, which was obsoleted when we decided to ignore wnote
and jnote from legacy servers in #645fc3a65 for PYTHON-684.
2015-03-18 15:19:04 -04:00
Bernie Hackett
ca95df4c62 PYTHON-820 - Ignore useCursor and batchSize when appropriate. 2015-03-17 18:27:03 -07:00
A. Jesse Jiryu Davis
af7ed042cc PYTHON-857 - Faster attribute access on SocketInfo. 2015-03-17 16:21:24 -04:00
A. Jesse Jiryu Davis
9d0f4a7dc0 Remove MongoDB 2.5.x-specific code for retrieving an upserted _id. 2015-03-17 16:20:23 -04:00
Bernie Hackett
3c45c726e7 PYTHON-820 - Set batchSize on aggregate CommandCursor. 2015-03-17 09:00:37 -07:00
Bernie Hackett
9e3175f3e5 PYTHON-862 - Add batch_size to Cursor constructor. 2015-03-17 06:43:54 -07:00
A. Jesse Jiryu Davis
5e12ca0579 PYTHON-857 - Use SocketInfo, not MongoClient, in message.py.
This is the main change to solve the wire protocol version race, and bugs when
we load-balance a mix of 2.4 and 2.6 mongoses. Stray uses of
_writable_max_wire_version and other cleanups remain.
2015-03-16 23:03:59 -04:00
Bernie Hackett
706aef83f6 Post b1. 2015-03-16 17:13:34 -07:00
Bernie Hackett
7d1bcb08a3 BUMP 3.0b1 2015-03-16 17:02:12 -07:00
Bernie Hackett
379e4ccc05 Update install docs for b1. 2015-03-16 15:45:06 -07:00
Bernie Hackett
dff745b1cd PYTHON-861 - Doc updates and compliance. 2015-03-16 15:32:03 -07:00
A. Jesse Jiryu Davis
3115effc2e Obsolete comment about max write command size. 2015-03-16 18:30:07 -04:00
A. Jesse Jiryu Davis
44712e1e3d PYTHON-857 - Fix server-reset logic. 2015-03-16 18:29:45 -04:00
A. Jesse Jiryu Davis
176e1e018b PYTHON-857 - Use client._get_socket_for_writes for write commands. 2015-03-16 18:29:22 -04:00
A. Jesse Jiryu Davis
c000354416 PYTHON-857 - Use client._get_socket_for_writes for OP_UPDATE and OP_DELETE.
Also check max document size in legacy writes.
2015-03-16 17:35:59 -04:00
A. Jesse Jiryu Davis
27c961a2ab PYTHON-857 - Use client._get_socket_for_writes for OP_INSERT.
We must get a socket *before* choosing whether to use write commands or legacy
writes. I will update the code in steps, getting a socket earlier and earlier
in the write path.

This commit gets a socket just before sending OP_INSERT in _do_batched_insert,
and temporarily disables the C version of _do_batched_insert.
2015-03-16 12:34:45 -04:00
Bernie Hackett
14ce3af058 PYTHON-861 - Implement list_indexes. 2015-03-16 08:00:58 -07:00
Bernie Hackett
9c4d01701b PYTHON-861 - Implement create_indexes. 2015-03-16 07:56:46 -07:00
A. Jesse Jiryu Davis
54b52f2abd PYTHON-728 - Fix signal handling in gevent / eventlet.
In this change:

https://github.com/mongodb/mongo-python-driver/commit/f737ec0#diff-01419ea067833899fda0f45f93ea1ce0L169

I updated SocketInfo to close itself on socket.error, instead of on *all*
exceptions. This makes no difference in regular python: a signal raised during
socket.recv() is expressed as an EINTR error from poll:

https://hg.python.org/cpython/file/1c45047c5102/Modules/socketmodule.c#l708

All error codes from poll become socket.error. Eventually in PyEval_EvalFrameEx
the interpreter checks for signals and throws KeyboardInterrupt into the
current frame on the main thread.

But in Gevent and Eventlet, the polling mechanism (epoll, kqueue, ...) is
called in Python code, which experiences the signal as a KeyboardInterrupt from
the start, rather than as an initial socket.error. So my new code in SocketInfo
does *not* catch the error, the socket remains open, and it is reused for the
next operation. As in PYTHON-294 the next operation throws "AssertionError: ids
don't match", because the previous server response is still pending.
2015-03-14 21:42:35 -04:00
Bernie Hackett
0f6b05819c PYTHON-861 - Fix dropDups tests. 2015-03-14 18:09:15 -07:00
Bernie Hackett
f93c73aa73 PYTHON-861 - create/ensure index changes
- Deprecate ensure_index
- Remove caching from create_index
- In create_index, remove support for the cache_for param, and the
  bucket_size and drop_dups aliases (they all remain in ensure_index)
- GridFS uses create_index
- Fix up tests.
2015-03-14 13:38:13 -07:00
A. Jesse Jiryu Davis
412ceeb9f5 Feature to run a subset of tests in a green framework.
Use like:

  python green_framework_test.py gevent -s test.test_client
2015-03-12 09:41:56 -04:00
A. Jesse Jiryu Davis
a5c23a7520 Typo in test_ha. 2015-03-12 09:10:59 -04:00
Bernie Hackett
3bcbe0682d PYTHON-858 - Clean up high availability docs. 2015-03-11 19:28:54 -07:00
A. Jesse Jiryu Davis
f757eb0433 Some unused imports in tests. 2015-03-11 21:56:44 -04:00
A. Jesse Jiryu Davis
f737ec0db9 PYTHON-728 - Translate socket.error to ConnectionFailure in pool.py.
SocketInfo and Pool are now responsible for catching all socket.errors and
gaierrors and translating them to ConnectionFailure. Server and MongoClient
need no longer worry about anything but ConnectionFailure. Functions in pool.py
and network.py still throw socket.errors into SocketInfo and Pool.
2015-03-11 19:57:01 -04:00
aherlihy
c23fde58f5 Added server selection timeout to hanging tests. 2015-03-11 14:43:55 -07:00
aherlihy
70c06d11a9 PYTHON-813 Removed client_knobs where no longer needed 2015-03-11 13:03:59 -07:00
A. Jesse Jiryu Davis
d6a71e0a24 Add Anna Herlihy to contributors. 2015-03-11 13:22:31 -04:00
A. Jesse Jiryu Davis
0a357e1df1 Don't call ismaster twice when opening a monitor socket. 2015-03-10 16:12:15 -04:00
A. Jesse Jiryu Davis
ff4c429f6f PYTHON-512 - Remove gevent from tox.ini. 2015-03-10 08:43:53 -07:00
A. Jesse Jiryu Davis
916488e508 Delete racy test_selection_failure. 2015-03-10 08:43:52 -07:00
A. Jesse Jiryu Davis
6a50a0489b Revert "Mock the clock in test_selection_failure."
This reverts commit 55efc35379.
2015-03-10 08:43:52 -07:00
A. Jesse Jiryu Davis
fd84969da4 Revert "Python 3.4 compatibility in test_selection_failure."
This reverts commit 1ec4ab3260.
2015-03-10 08:43:52 -07:00
A. Jesse Jiryu Davis
28ca78a260 Revert "Unused import in test_topology."
This reverts commit 0b3d6eb111.
2015-03-10 08:43:52 -07:00
Bernie Hackett
6617eab7f1 Post b0 2015-03-10 08:43:52 -07:00
Bernie Hackett
53a792eb40 BUMP 3.0b0 2015-03-09 17:33:24 -07:00
Bernie Hackett
c8e9db36c6 Changelog updates. 2015-03-09 15:34:18 -07:00
Bernie Hackett
229e57e986 Mention beta releases in install docs. 2015-03-09 14:55:23 -07:00
Bernie Hackett
c87424e7af PYTHON-856 - as_class -> document_class
This commit changes the name of the as_class option
in CodecOptions to document_class, to match the name
of the MongoClient option.
2015-03-09 14:32:42 -07:00
aherlihy
fa1466179f PYTHON-813 Added support for serverSelectionTimeoutMS 2015-03-09 12:38:24 -07:00
Bernie Hackett
4fd6f8a0b1 PYTHON-854 max_pool_size -> maxPoolSize
With this change the max_pool_size named parameter to
MongoClient is removed. It is replaced by the maxPoolSize
MongoDB URI option, which can be passed in a URI, or as a
keyword argument to MongoClient.
2015-03-09 10:08:13 -07:00
Bernie Hackett
d9c165bbe8 PYTHON-851 - Fix a test. 2015-03-08 23:20:36 -07:00
Bernie Hackett
6bacdaafaa PYTHON-851 - Clean up MongoClient properties. 2015-03-08 20:23:07 -07:00
Bernie Hackett
f2aa319f22 PYTHON-815 - Fix rtt test runner. 2015-03-08 15:32:41 -07:00
Bernie Hackett
cb1c046b98 PYTHON-815 - Fix server selection spec test runner. 2015-03-08 14:41:52 -07:00
A. Jesse Jiryu Davis
873278cbf6 Rename test_mongos_ha to test_mongos_load_balancing. 2015-03-08 08:25:13 -04:00
A. Jesse Jiryu Davis
ea8ca5ec7d PYTHON-852 - Mongos load balancing.
The behavior for a list of mongoses is changed from "high availability" to
"load balancing". Before, the client connected to the lowest-latency mongos in
the list, and used it until a network error prompted it to re-evaluate all
mongoses' latencies and reconnect to one of them. In PyMongo 3, the client
monitors its network latency to all the mongoses continuously, and distributes
operations evenly among those with the lowest latency. See
high_availability.rst.
2015-03-08 08:25:13 -04:00
A. Jesse Jiryu Davis
8ececbb1de Don't remove a mongos on disconnect. 2015-03-08 08:24:43 -04:00
A. Jesse Jiryu Davis
329130712c Ease-of-use testing with ha_tools.py. 2015-03-08 08:24:35 -04:00
A. Jesse Jiryu Davis
d80c5a8e39 Merge pull request #254 from aherlihy/squashed-PYTHON-815
Python 815: Added Server-Selection YAML tests.
2015-03-08 08:24:19 -04:00
Bernie Hackett
eeef679228 PYTHON-836 - Fix command routing for aggregate and map_reduce helpers. 2015-03-07 14:16:47 -08:00
Bernie Hackett
c2ab84d117 PYTHON-836 - Fix new test under auth. 2015-03-07 12:21:24 -08:00
Bernie Hackett
b71526a2da PYTHON-836 - Always set slaveOk bit for non-mongos direct connection. 2015-03-07 11:09:16 -08:00
aherlihy
ec213e0067 PYTHON-815: Added YAML tests for server selection. 2015-03-06 15:21:24 -05:00
Bernie Hackett
0b9d79fb92 Move another legacy test. 2015-03-06 08:32:18 -08:00
Bernie Hackett
af577f222c Bring changelog up to date. 2015-03-05 20:30:09 -08:00
Bernie Hackett
761c630d4d PYTHON-834 - Add option to disable match_hostname. 2015-03-05 14:03:49 -08:00
Bernie Hackett
c60a4cd84b Fix ReturnDocument examples. 2015-03-05 11:45:00 -08:00
Bernie Hackett
d69f76d380 Finalize option locations and exports.
- Move ReturnDocument to pymongo.collection.
- Change ReturnDocument.Before to ReturnDocument.BEFORE
- Change ReturnDocument.After to ReturnDocument.AFTER
- Add pymongo.cursor.CursorType.
- Move pymongo.cursor.NON_TAILABLE and friends to attributes of CursorType.
- read_preferences.ReadPreference is once again an "enum".
- Fix docs for read_preferences.ReadPreference.
- Rename pymongo.options to pymongo.operations.
- Export CursorType, ReturnDocument, WriteConcern, and public classes
  from pymongo.opertions through pymongo/__init__.py
- Fix up a number of documentation issues in the process.
2015-03-05 11:35:46 -08:00
A. Jesse Jiryu Davis
fcc06e52d5 Simplify TopologyDescription.reset_server.
Same effect, much more directly expressed.
2015-03-05 13:57:47 -05:00
A. Jesse Jiryu Davis
0b3d6eb111 Unused import in test_topology. 2015-03-05 13:57:47 -05:00
Bernie Hackett
d3f7f229e5 PYTHON-845 - Add examples to CRUD docstrings. 2015-03-04 17:31:36 -08:00
A. Jesse Jiryu Davis
a290c6f748 Correct the description of waitQueueMultiple. 2015-03-03 15:38:45 -05:00
A. Jesse Jiryu Davis
8c0600e26c PYTHON-770 - Update SDAM tests from specs repo.
test_discovery_and_monitoring still passes.
2015-03-03 15:32:33 -05:00
A. Jesse Jiryu Davis
7dbcc4b71a PYTHON-726 - Test in gevent and eventlet. 2015-03-02 16:36:02 -05:00
Bernie Hackett
21e1e1d67f PYTHON-850 - Fix an authentication test. 2015-02-26 16:40:45 -08:00
Bernie Hackett
8f0bd0a6d4 PYTHON-850 - Change some uses of ConfigurationError to Type/ValueError. 2015-02-26 16:02:25 -08:00
A. Jesse Jiryu Davis
dc25d69f7e PYTHON-844 - Use the Python 3 docs' HTML theme. 2015-02-25 21:50:58 -05:00
A. Jesse Jiryu Davis
b1276e5829 PYTHON-841 FAQ entry for key order and subdocument matching. 2015-02-25 16:15:12 -05:00
Bernie Hackett
3f3b6bedfc PYTHON-846 - Database.connection -> Database.client 2015-02-25 11:57:39 -08:00
A. Jesse Jiryu Davis
7f42430978 PYTHON-847 Remove disconnect(), synonym of MongoClient.close().
close() seems more standard among MongoDB drivers.
2015-02-25 14:52:34 -05:00
A. Jesse Jiryu Davis
e7a1b261cd PYTHON-848 Remove MongoClient.alive.
The ``alive`` method is removed since it no longer
provides meaningful information; even if the client is disconnected,
it may discover a server in time to fulfill the next operation.
2015-02-25 14:51:06 -05:00
Bernie Hackett
7164ba2f41 PYTHON-839 - Better validation error messages. 2015-02-25 10:14:29 -08:00
Bernie Hackett
caf69240ce PYTHON-838 - Deprecate Database.add_son_manipulator 2015-02-25 10:08:50 -08:00
A. Jesse Jiryu Davis
71db74dc70 Typo in FAQ. 2015-02-25 00:03:28 -05:00
Bernie Hackett
c800cd18ad PYTHON-837 - Implement CRUD spec exception hierarchy. 2015-02-24 13:49:39 -08:00
Bernie Hackett
b559ab0b46 PYTHON-835 - Consistent method signatures. 2015-02-24 13:44:16 -08:00
Bernie Hackett
029bbe5080 PEP8 / Pylint cleanups. 2015-02-23 14:43:28 -08:00
Bernie Hackett
c0474a00bf Debug a test. 2015-02-20 16:24:46 -08:00
Bernie Hackett
5819c86acd Fix a racy test. 2015-02-20 16:21:18 -08:00
Bernie Hackett
839893939e PYTHON-821 - Deprecated legacy API.
This commit deprecates insert, update, save, and remove. Each
now raises DeprecationWarning at stacklevel 2. This change also
updates all tutorials and example documentation to use the new
CRUD API, tests the deprecations, and fixes up a few more tests
that were still using the legacy API.
2015-02-20 15:41:45 -08:00
Bernie Hackett
aa090fe393 PYTHON-821 - Small test fixes. 2015-02-19 10:36:42 -08:00
Bernie Hackett
a817fa9a28 PYTHON-821 - Add test_legacy_api.py 2015-02-19 09:32:14 -08:00
Bernie Hackett
d717bc6a4b Skip forking tests if we don't have multiprocessing. 2015-02-18 15:25:13 -08:00
Bernie Hackett
871403b5cb PYTHON-821 - Switch internals to the new CRUD API. 2015-02-17 20:05:06 -08:00
Bernie Hackett
4588f6e0e0 Debug some tests. 2015-02-17 17:07:35 -08:00
Bernie Hackett
1e586185dc Fix typo. 2015-02-17 16:01:48 -08:00
Bernie Hackett
12d74ff56f PYTHON-821 - Use new CRUD API in GridFS. 2015-02-13 13:12:58 -08:00
Bernie Hackett
30af616009 PYTHON-821 - Migrate most tests to new the CRUD API. 2015-02-13 08:46:43 -08:00
Bernie Hackett
13f20bb45a PYTHON-821 - Add insert_many to built docs. 2015-02-12 18:02:06 -08:00
Bernie Hackett
f9243f0ad9 PYTHON-821 - Implement insert_many 2015-02-12 16:28:46 -08:00
Bernie Hackett
4d6bdb1097 PYTHON-821 - Implement delete_one and delete_many. 2015-02-12 11:04:58 -08:00
Bernie Hackett
e7866dbd19 PYTHON-821 - Implement replace_one, update_one, and update_many. 2015-02-11 20:01:16 -08:00
Bernie Hackett
b9cd7b627b PYTHON-821 - Introduce results and options modules. 2015-02-11 13:52:51 -08:00
Bernie Hackett
df4e5269b3 PYTHON-821 - Implement insert_one. 2015-02-11 12:48:50 -08:00
Bernie Hackett
7416e6595c PYTHON-821 - Implement find_one_and_*.
This change also deprecates find_and_modify. Migrate
to find_one_and_delete, find_one_and_update, and/or
find_one_and_replace.
2015-02-10 12:09:47 -08:00
A. Jesse Jiryu Davis
9da835ab3d PYTHON-825 BSON API changes and internal options handling.
This change resolves four issues:

PYTHON-826 The new codec_options submodule is moved from pymongo to bson.

PYTHON-827 Use codec_options in BSON APIs.

Functions and methods of the bson module that accepted the options as_class,
tz_aware, and uuid_subtype now accept a codec_options parameter instead.

For example, the function definition for bson.decode_all changes from this:

def decode_all(data, as_class=dict, tz_aware=True,
               uuid_subtype=OLD_UUID_SUBTYPE)

to:

def decode_all(data, codec_options=CodecOptions())

The following functions are changed:

- decode_all
- decode_iter
- decode_file_iter

The following methods are changed:

- BSON.encode
- BSON.decode

This is a breaking change for any application that uses the BSON API directly
and changes any of the named parameter defaults. No changes are required for
applications that use the default values for these options. The behavior
remains the same.

PYTHON-828 Internal BSON module changes to support CodecOptions

The pure Python BSON module passes around a CodecOptions instance instead of
as_class, tz_aware, and uuid_subtype. C extensions pass these values around in
a struct.

PYTHON-801 Rename uuid_subtype to uuid_representation.
2015-02-05 23:09:23 -06:00
Bernie Hackett
be0ad8dec3 PYTHON-821 - Implement Collection.bulk_write. 2015-02-03 13:46:17 -08:00
A. Jesse Jiryu Davis
a2c13090d8 PYTHON-826 Move codec_options submodule from pymongo to bson. 2015-02-02 09:38:49 -05:00
A. Jesse Jiryu Davis
1ec4ab3260 Python 3.4 compatibility in test_selection_failure. 2015-01-27 19:15:34 -05:00
A. Jesse Jiryu Davis
55efc35379 Mock the clock in test_selection_failure.
Prepares to reliably test PYTHON-831.
2015-01-27 18:02:06 -05:00
A. Jesse Jiryu Davis
9b208caed9 PYTHON-829 Call ismaster on each new connection.
Call ismaster on each new connection and store the results on the SocketInfo
instance.

The upcoming Authentication Spec says: "If credentials exist, upon opening a
socket, drivers MUST send an isMaster command immediately. This allows a driver
to determine whether the server is an Arbiter. Calling ismaster additionally
allows the driver to know if the default authentication method for each socket
is MONGODB-CR or SCRAM-SHA-1, avoiding races when the driver repopulates the
pool after a disconnect."

In theory we could choose not to call ismaster if there are no credentials, but
it's simpler always to call ismaster, and paves the way for future breaking
changes to the wire protocol besides the current breaking change to
authentication.
2015-01-26 16:54:14 -05:00
A. Jesse Jiryu Davis
38a6711e70 PYTHON-829 Move some network code to network.py. 2015-01-26 16:54:00 -05:00
A. Jesse Jiryu Davis
60b6dc6408 Clean up a stray user. 2015-01-26 16:38:16 -05:00
A. Jesse Jiryu Davis
301bf8066c Replace more tearDowns with addCleanup. 2015-01-26 16:38:16 -05:00
A. Jesse Jiryu Davis
565e5faeb9 No more need to call MongoClient.close in tests. 2015-01-26 16:38:16 -05:00
A. Jesse Jiryu Davis
6cd00eee7f Use with-statement to flush test key-file. 2015-01-26 16:38:16 -05:00
A. Jesse Jiryu Davis
26baeafb00 Replace some tearDowns with addCleanup. 2015-01-26 16:38:16 -05:00
A. Jesse Jiryu Davis
15c018655c Remove tearDowns from test_ha.
MongoClients now close themselves cleanly when garbage-collected. Dropping the database at the end of TestMongosHighAvailability isn't needed since the whole cluster will be destroyed.
2015-01-26 16:38:16 -05:00
A. Jesse Jiryu Davis
0a75f04384 Remove pre-MongoDB-2.0 version checks from tests. 2015-01-26 16:19:12 -05:00
A. Jesse Jiryu Davis
acd90be727 Reset average round trip time if a server is disconnected.
The Server Discovery And Monitoring Spec says if a server "changes from a known
type to Unknown its RTT is set to null."
2015-01-26 15:38:24 -05:00
A. Jesse Jiryu Davis
d29919da31 Correct a comment in test_round_trip_time. 2015-01-26 15:38:24 -05:00
Bernie Hackett
c3ea16b0ea Update MongoDB version references from 2.8 to 3.0. 2015-01-24 09:42:24 -08:00
Bernie Hackett
c31baa2dfa PYTHON-830 - Fix bad uses of _get_wc_override. 2015-01-23 15:08:22 -08:00
A. Jesse Jiryu Davis
07e3884305 Longer timeouts in test_insert_large_batch.
Amazon build slaves can be alarmingly slow.
2015-01-22 17:40:45 -05:00
A. Jesse Jiryu Davis
3b4532244b Fix and clarify test_insert_large_batch.
Using separate collections avoids an apparent race in mongos 2.6's
dropCollection, as well as clarifying the test. Further clarify it by
explicitly naming and specifying batches and the ids of documents within them.
2015-01-22 16:08:47 -05:00
A. Jesse Jiryu Davis
a1ccdcd87a Debug test_insert_large_batch. 2015-01-22 10:29:23 -05:00
A. Jesse Jiryu Davis
db4edc63aa Fix test_init_disconnected.
It failed when the replica set config contains hostnames that differ from the
DB_IP environment variable that PyMongo's tests use. E.g. if DB_IP is
"127.0.0.1" but the replica set is configured to use hostnames like
"localhost:27017", then test_init_disconnected failed because the tests' global
"host" variable is "127.0.0.1" but MongoClient.host is "localhost".
2015-01-22 10:13:39 -05:00
A. Jesse Jiryu Davis
21937f4f52 Race in test_exhaust_getmore_server_error. 2015-01-21 14:44:54 -05:00
A. Jesse Jiryu Davis
28ca03c7c0 Lock the Pool to return a socket. 2015-01-20 22:29:06 -05:00
A. Jesse Jiryu Davis
7af79ad612 Update comments in test_insert_large_batch. 2015-01-20 21:35:26 -05:00
A. Jesse Jiryu Davis
ece5496658 Race in test_continue_on_error. 2015-01-20 21:27:35 -05:00
A. Jesse Jiryu Davis
9155a9524c Import SkipTest correctly in Python 2.6. 2015-01-20 13:29:03 -05:00
A. Jesse Jiryu Davis
34560199ba Two test failures on Windows. 2015-01-20 12:44:04 -05:00
A. Jesse Jiryu Davis
738c48c92c Let test_network_error_on_operation succeed without a server. 2015-01-20 12:08:53 -05:00
behackett
c07e543e58 PYTHON-820 - API changes for find/find_one to comply with CRUD spec.
- Changed parameter names (default values and behaviors remain the same):
  - spec (spec_or_id in find_one) -> filter
  - fields -> projection
  - partial -> allow_partial_results

- The "timeout" option is renamed to "no_cursor_timeout" with its default
  changed to False.

- The tailable, await_data, and exhaust options will be replaced with a
  cursor_type option. Valid values:
  - cursor.NON_TAILABLE
  - cursor.TAILABLE
  - cursor.TAILABLE_AWAIT
  - cursor.EXHAUST

- The following options are added:
  - oplog_replay (bool - default False) - only valid with tailable cursors
    against the oplog.
  - modifiers (document - default None) - A dict of query modifiers. See
    http://docs.mongodb.org/manual/reference/operator/query-modifier/#modifiers for
    options.

- The following options are removed, replaced by the "modifiers" option:
  - max_scan
  - snapshot

- The as_class option is removed. Use Collection.with_options instead.
2015-01-19 22:10:56 -08:00
Bernie Hackett
71e083d81b PYTHON-820 - count and distinct changes to comply with CRUD. 2015-01-14 16:56:00 -08:00
Bernie Hackett
06b35d4acb Work around Vim's poor parsing of python docstrings. 2015-01-14 13:29:45 -08:00
Bernie Hackett
5d429bfe46 PYTHON-820 - Change aggregate to comply with the CRUD spec. 2015-01-14 13:02:33 -08:00
A. Jesse Jiryu Davis
5a09c8fba5 Race in test_round_trip_time. 2015-01-14 12:41:50 -05:00
A. Jesse Jiryu Davis
2c2b538367 PYTHON-816 Improved test coverage for Pool. 2015-01-12 21:12:27 -05:00
A. Jesse Jiryu Davis
e7b72dcd1e PYTHON-816 Simplify Pool.
The pool can no longer exceed its max_size now that "force" is gone. Move as
much logic as possible out of methods and into functions to clarify where state
is modified.
2015-01-12 21:12:27 -05:00
A. Jesse Jiryu Davis
e8c03d65a7 Python 2 compatibility in TestMonitor.test_atexit_hook. 2015-01-12 21:04:07 -05:00
A. Jesse Jiryu Davis
a6bb78d441 Stop thread sooner after Monitor is deleted.
Otherwise the PeriodicExecutor waits up to 10 seconds to stop and unregister
itself. Not a real problem since the executor is a daemon thread, but it makes
TestMonitor slow and unreliable.
2015-01-12 18:03:15 -05:00
A. Jesse Jiryu Davis
b633af82a9 Simplify TestMonitor.
The executor is now registered immediately, don't need to wait.
2015-01-12 18:03:15 -05:00
A. Jesse Jiryu Davis
9d9b65e2c2 Shorter timeout in TestMonitor.
Make false negative (test passes but shouldn't) less likely.
2015-01-12 18:03:15 -05:00
Bernie Hackett
eb99dc7d0d PYTHON-798 - Fix auth tests. 2015-01-12 12:17:40 -08:00
Bernie Hackett
a2551b96f2 PYTHON-818 - Work around issues with unicode_literals and pbkdf2_hmac. 2015-01-12 12:09:19 -08:00
Bernie Hackett
b7b627d822 PYTHON-798 - Make common.BaseObject immutable
This change makes the codec_options, read_preference, and
write_concern attributes of MongoClient, Database, and
Collection read only. If you need to change any of these
options per-instance use MongoClient.get_database,
Database.get_collection, or Collection.with_options instead.
2015-01-12 10:35:28 -08:00
Bernie Hackett
755d5c74eb PYTHON-814 - API and behavior changes for Database.command.
Database.command no longer obeys Database.read_preference or
Database.codec_options. Explicit parameters have been added
for both options. See the ticket for a full explanation.
2015-01-09 13:18:36 -08:00
Bernie Hackett
4e13a39db9 PYTHON-812 - Make local threshold global and immutable. 2015-01-08 11:21:54 -08:00
Bernie Hackett
a788b1f1aa PYTHON-811 - latencyThresholdMS -> localThresholdMS 2015-01-08 11:21:44 -08:00
A. Jesse Jiryu Davis
66c9d76e07 Don't test 'text' command with MongoDB 2.8. 2015-01-05 17:15:24 -05:00
A. Jesse Jiryu Davis
47a736da89 PYTHON-799 Avoid deadlock in Cursor destructor with PyPy.
Use a background thread to periodically close destroyed
cursors instead of killing them directly from Cursor.__del__.
2015-01-05 15:21:51 -05:00
A. Jesse Jiryu Davis
1ab83f72cf PYTHON-799 Break ref cycle in Monitor.
Previous code to avoid the cycle was wrong.
2015-01-05 15:21:50 -05:00
Bernie Hackett
811864de88 Add codec_options to MongoReplicaSetClient docs. 2014-12-29 16:36:49 -08:00
Bernie Hackett
f968f58ac6 PYTHON-805 - Fix docs for find() and Cursor. 2014-12-29 16:25:55 -08:00
Bernie Hackett
a3fb2462bb PYTHON-801 - Remove BaseObject.uuid_subtype 2014-12-29 07:34:07 -08:00
Bernie Hackett
7e4ebde147 PYTHON-801 - Add STANDARD and PYTHON_LEGACY to bson.binary
And use them in place of UUID_SUBTYPE and OLD_UUID_SUBTYPE. This
change also cleans up and clarifies the documentation for
JAVA_LEGACY and CSHARP_LEGACY. None of these are binary subtypes,
but instead UUID representations in the Python, C#, and Java drivers.
2014-12-24 09:52:58 -08:00
Bernie Hackett
1db2b0bfa5 PYTHON-800 - Clean up internal use of CodecOptions. 2014-12-23 19:52:31 -08:00
Bernie Hackett
73edd2c134 PYTHON-785 - Really check Collection's write_concern in GridFS. 2014-12-23 12:04:10 -08:00
A. Jesse Jiryu Davis
89466cd3f9 Clean up test_auto_ref_and_deref_list. 2014-12-22 14:49:11 -06:00
A. Jesse Jiryu Davis
dc9145d2de Delete references to missing file /examples/requests.
(Documentation for Database.error() and related methods was copied
from v2.8, but in PyMongo 3.0 request are entirely removed and
the examples file is deleted.)
2014-12-21 23:12:41 -06:00
Bernie Hackett
1b1457ab1f PYTHON-677 - Finish transition to WriteConcern. 2014-12-20 22:34:48 -08:00
Bernie Hackett
bf048c22f1 PYTHON-677 - WriteConcern docs. 2014-12-20 22:34:47 -08:00
Bernie Hackett
0c277f6fd2 PYTHON-785 - Check Collection's write_concern in GridFS 2014-12-20 22:34:47 -08:00
A. Jesse Jiryu Davis
5fed41b0fb PYTHON-807 Silence warnings when testing Database.error(). 2014-12-20 09:31:28 -05:00
A. Jesse Jiryu Davis
b1183ada1f PYTHON-785 No need for getlasterror before filemd5.
Obsoleted by commit fab611f63.
2014-12-20 09:29:56 -05:00
A. Jesse Jiryu Davis
fe8afcee4d PYTHON-807 Deprecate Database.error() and related methods. 2014-12-19 19:57:01 -05:00
Bernie Hackett
fbfe2250c6 PYTHON-805 - Fix legacy internals that pass read_preference to Cursor 2014-12-19 11:40:28 -08:00
Bernie Hackett
fc6b99b946 PYTHON-804 - Add codec_options, etc. to Database.create_collection 2014-12-18 17:01:43 -08:00
James Root
3f0a31d58a Updated minimongo repository location 2014-12-18 16:21:11 -08:00
Bernie Hackett
fe5e723285 PYTHON-806 - Always use command cursor 'ns' value for OP_GET_MORE 2014-12-18 16:12:38 -08:00
Bernie Hackett
c545175d0b PYTHON-796 - Support listCollections and listIndexes command cursors 2014-12-18 16:11:33 -08:00
A. Jesse Jiryu Davis
4ca6047c8c Race in test_network_error_on_operation. 2014-12-18 09:32:44 -05:00
Bernie Hackett
f6a260c683 PYTHON-805 - Add with_options and remove per helper read_preference
This change removes the read_preference parameter from various
command helpers on the Collection object. Those options were
never shipped in a PyMongo release. It also documents which
helpers obey Collection.read_preference.

The bigger change is the removal of the read_preference, tag_sets,
and secondary_acceptable_latency_ms params from find() and find_one()
- a major backward breaking change. Collection.with_options
is intended to replace their use.

coll.find(read_preference=ReadPreference.SECONDARY)

changes to

coll.with_options(read_preference=ReadPreference.SECONDARY).find()
2014-12-17 15:06:03 -08:00
A. Jesse Jiryu Davis
f0daebf4bb PYTHON-799 Create a PeriodicExecutor class for background monitoring.
The executor will also be used to solve a deadlock in Cursor.__del__.
2014-12-17 13:19:05 -05:00
A. Jesse Jiryu Davis
34398d5bf7 Delete test_errors.py.
This file contains one test that has long been redundant with TestClient.test_host_w_port.
2014-12-17 11:36:25 -05:00
Bernie Hackett
a72d95b229 PYTHON-803 - Don't use Collection.find() for commands.
This change introduces a _command helper in the helpers
module, used by Database.command and various internal and
external command helpers instead of iterating a Cursor
instance.

This change also introduces a small incompatibility with
earier versions. The as_class and fields options have been
removed from Database.command. They were never documented
and only used by some internal helpers. This also removes
the documented uuid_subtype option. A forthcoming API
refactor will replace that functionality.
2014-12-16 14:37:43 -08:00
Bernie Hackett
550f25370e PYTHON-802 - Add get_database and get_collection methods 2014-12-15 11:01:29 -08:00
Bernie Hackett
949d354cf0 PYTHON-800 - Docs for codec_options. 2014-12-15 10:49:51 -08:00
Bernie Hackett
7272b5ccd5 PYTHON-800 - Add __eq__ and __ne__ methods to CodecOptions. 2014-12-15 10:45:24 -08:00
Bernie Hackett
b87fb790a2 PYTHON-800 - Add CodecOptions class. 2014-12-12 14:11:44 -08:00
A. Jesse Jiryu Davis
8a64f261fd Fix how unittests check for "enableTestCommands" server option. 2014-12-12 10:33:39 -05:00
A. Jesse Jiryu Davis
9efdbc8e43 Indentation style in Topology. 2014-12-12 10:04:12 -05:00
A. Jesse Jiryu Davis
6ae50e2ea1 Update a comment in Monitor. 2014-12-12 10:04:12 -05:00
A. Jesse Jiryu Davis
ef9188fc93 Long line. 2014-12-12 10:04:12 -05:00
A. Jesse Jiryu Davis
108e97baad Unused imports in tests. 2014-12-10 14:11:33 -05:00
A. Jesse Jiryu Davis
9852464880 Unused imports in mongo_client. 2014-12-10 11:58:46 -05:00
A. Jesse Jiryu Davis
f769c1e816 Update docstring for a test utility, SocketGetter. 2014-12-10 11:54:43 -05:00
A. Jesse Jiryu Davis
1707d33b3a Update comments in select_server(). 2014-12-10 11:52:50 -05:00
A. Jesse Jiryu Davis
9aa0195df9 PYTHON-785 Update connection-pooling FAQ. 2014-12-10 11:51:31 -05:00
A. Jesse Jiryu Davis
7adf3e6ec5 Tests detect when Mongo Orchestration has enabled test commands. 2014-12-09 15:56:14 -05:00
A. Jesse Jiryu Davis
49403798dd Avoid ResourceWarnings in TestPooling. 2014-12-08 17:52:03 -05:00
A. Jesse Jiryu Davis
2bc6d9337d Dead code in test_read_preferences. 2014-12-08 17:44:41 -05:00
A. Jesse Jiryu Davis
e68f8354e8 Race in test_round_trip_time. 2014-12-05 15:45:16 -05:00
A. Jesse Jiryu Davis
beb2e412b0 Unused import 2014-12-05 15:38:40 -05:00
A. Jesse Jiryu Davis
32eecb5a91 Python 3 compatibility in TestJsonUtil.test_regex.
Removing "compile_re" means that Python 2 and 3 no longer behave differently,
remove test code that was specific to Python 3.
2014-12-05 15:37:16 -05:00
A. Jesse Jiryu Davis
94e3673a51 Rename maybe_return_socket to return_socket.
The name "maybe_return_socket" made more sense when a socket might *not* be
returned because it was a request socket, or because the pool might be
overfull. Now requests are gone, and the pool can't be overfull--"force" is
gone and max_pool_size is strictly enforced.
2014-12-05 14:06:38 -05:00
A. Jesse Jiryu Davis
2ba730722b PYTHON-526 Remove 'compile_re' option.
PyMongo now never attempts to compile BSON regular expressions as Python native
regular expressions.
2014-12-05 14:06:38 -05:00
A. Jesse Jiryu Davis
25e5bca03b Race in test_round_trip_time. 2014-12-03 18:19:26 -05:00
A. Jesse Jiryu Davis
515d6bf7e4 Style in pymongo_mocks.py. 2014-12-03 18:11:58 -05:00
A. Jesse Jiryu Davis
197fb30312 Avoid ResourceWarning with MockPool tests in Python 3.3. 2014-12-03 18:10:50 -05:00
A. Jesse Jiryu Davis
522ad13720 More reliable test_round_trip_time. 2014-12-03 17:52:56 -05:00
A. Jesse Jiryu Davis
a41c3095c4 Long line in test_cursor. 2014-12-03 17:42:59 -05:00
A. Jesse Jiryu Davis
e0ed3ce2b5 Don't reassign "address" parameter in _send_message(). 2014-12-03 17:35:07 -05:00
A. Jesse Jiryu Davis
8c413615ff Changelog formatting. 2014-12-03 17:21:48 -05:00
A. Jesse Jiryu Davis
79dd0e4758 Update cursor management for PyMongo 3.0.
CursorManager was deprecated in PYTHON-323. Now we undeprecate it, but we remove
BatchCursorManager. MongoClient.set_cursor_manager now accepts None in addition
to accepting a CursorManager subclass. CursorManager.close now requires, and
MongoClient.kill_cursors accepts, an "address" parameter.
2014-12-03 17:16:11 -05:00
A. Jesse Jiryu Davis
2c6483b348 Rely on standard json module.
Now that we've dropped Python 2.4 and 2.5, we know the standard json module is
available.
2014-12-03 16:32:41 -05:00
A. Jesse Jiryu Davis
a811ef6675 Delete an ancient FAQ about the Year 2038 Problem. 2014-12-03 16:32:41 -05:00
A. Jesse Jiryu Davis
ca1bc57ebb Dead code. 2014-12-03 16:32:41 -05:00
A. Jesse Jiryu Davis
0b9b109e3c Make Pool.get_socket a context manager.
SocketInfo itself is no longer a context manager.
Simplifies exhaust cursors and exception handling,
and avoids a confusing weakref.
2014-12-03 16:32:41 -05:00
A. Jesse Jiryu Davis
cd31d2da25 Delete an ancient note about MongoDB 1.5. 2014-12-03 16:30:35 -05:00
A. Jesse Jiryu Davis
ecc55f502a New method to calculate average round trip time.
Replace 5-sample moving average with exponentially weighted average,
required by the upcoming Server Selection Spec. Move responsibility for
tracking the average from ServerDescription to Monitor. Now the
ServerDescription only knows the average at the time it was created.
2014-12-03 16:30:35 -05:00
Bernie Hackett
be570a1888 Raise if nonce or server signature don't match. 2014-12-02 12:18:23 -08:00
Bernie Hackett
630f9245e3 PYTHON-795 - Fix password handling for None and the empty string. 2014-12-02 09:10:55 -08:00
A. Jesse Jiryu Davis
dcdb2eb112 PYTHON-785 Changelog: how to adapt to a world without start_request. 2014-12-01 21:08:28 -05:00
A. Jesse Jiryu Davis
bafb8c7b44 Fix race in TestMongoClientFailover.test_discover_primary. 2014-11-25 17:41:34 -05:00
A. Jesse Jiryu Davis
b93a39e80d PYTHON-785 Delete examples/requests.rst. 2014-11-24 22:48:44 -05:00
A. Jesse Jiryu Davis
e7b0596442 PYTHON-785 Remove start_request().
Remove MongoClient's methods start_request(), in_request(), and end_request().
The purpose of requests was to provide read-your-writes consistency when using
w=0 write concern. Starting a request pins a socket to a thread so any
operations on that thread end up in the same queue on the server side.

Justification for removing: mongos 2.6+ doesn't support socket pinning by
default, and mongos 2.8+ doesn't support it at all (SERVER-12273), so whatever
weak consistency guarantees a request was supposed to provide are not provided
with sharding.

It's unnecessary with MongoDB 2.6+ since write commands always block and send a
response.

It's a confusing feature that should rarely be used, if ever, yet people
incorrectly use it all the time. It makes our connection pool unmaintainable to
any but the most expert developers.
2014-11-24 22:48:44 -05:00
A. Jesse Jiryu Davis
262b9893cb PYTHON-785 Don't call start_request in mod_wsgi test. 2014-11-24 22:48:44 -05:00
A. Jesse Jiryu Davis
3764d76dce PYTHON-785 Delete TestReplicaSetRequest. 2014-11-24 22:48:44 -05:00
Bernie Hackett
e06fe26a65 PYTHON-792 - Update create collection and index docs. 2014-11-24 15:46:20 -08:00
A. Jesse Jiryu Davis
8be5f2b382 test_client style. 2014-11-24 18:15:36 -05:00
A. Jesse Jiryu Davis
83ab167f0c test_network_error_on_operation can run without a server. 2014-11-24 18:15:35 -05:00
A. Jesse Jiryu Davis
990afe5707 Unused import in monitor. 2014-11-24 18:15:35 -05:00
Bernie Hackett
db4ab8d769 Use _UNPACK_INT in new BSON helpers. 2014-11-24 13:30:34 -08:00
Bernie Hackett
1b7e393e67 Add Heewa Barfchin to contributors. 2014-11-24 13:14:39 -08:00
Bernie Hackett
8631d7520d Update changelog to mention new BSON helpers. 2014-11-24 13:14:39 -08:00
Bernie Hackett
4e20ab3ca5 Document uuid_subtype parameter for BSON.encode/decode. 2014-11-24 13:14:39 -08:00
Bernie Hackett
c28975c395 Document to uuid_subtype parameter for decoders. 2014-11-24 13:14:39 -08:00
Bernie Hackett
6fd3d3926e Fix up docs for decode_(file_)iter. 2014-11-24 13:14:39 -08:00
Bernie Hackett
811b636fae Fix decode_(file_)iter tests for 3.0-dev. 2014-11-24 13:14:39 -08:00
Bernie Hackett
c6b9892c30 Allow decode_(file_)iter to use C extensions. 2014-11-24 13:14:39 -08:00
Bernie Hackett
6c82488b77 Add compile_re support to decode_(file_)iter. 2014-11-24 13:14:39 -08:00
Heewa Barfchin
b948b08854 Add generator versions of decode_all in bson.
When decoding large collections of bson documents, the python representation
of dicts are time and space costly, so it's sometimes useful to generate and
consume the documents iteratively. This patch adds two new functions to do
that: decode_iter and decode_file_iter. The first is given all the bson data,
but yields one document at a time, while the second reads from a file object
enough to yield one document at a time (to avoid reading in an entire file).
2014-11-24 13:14:39 -08:00
A. Jesse Jiryu Davis
620c1bd491 Fix test_default_roles to work with mongo-orchestration. 2014-11-24 14:20:47 -05:00
A. Jesse Jiryu Davis
b85beec98b test_lazy_connect_w0 can break the next test. 2014-11-24 12:56:33 -05:00
A. Jesse Jiryu Davis
596645b265 Unused import in test_pooling. 2014-11-24 10:08:22 -05:00
A. Jesse Jiryu Davis
5c1a31c1ae Update test_cert_ssl_validation_hostname_fail for replica set in 3.0-dev. 2014-11-24 10:08:06 -05:00
A. Jesse Jiryu Davis
92df7906d5 More reliable test_max_pool_size. 2014-11-24 10:01:39 -05:00
A. Jesse Jiryu Davis
22f7e29c24 Optional packages: backports.pbkdf2, pykerberos, monotime. 2014-11-21 21:09:07 -05:00
A. Jesse Jiryu Davis
54a9769402 Use a monotonic clock if possible. 2014-11-21 21:09:07 -05:00
A. Jesse Jiryu Davis
b7adbdc5c9 Tests can rely on Javascript sleep() function.
Introduced in MongoDB 1.9, and we now only test back to 2.2.
2014-11-21 21:09:07 -05:00
A. Jesse Jiryu Davis
fab611f63c PYTHON-785 Don't use requests in GridFS. 2014-11-21 20:19:40 -05:00
Bernie Hackett
5aee3e1b31 PYTHON-791 - Fix JSON support for Timestamp. 2014-11-21 14:35:48 -08:00
Bernie Hackett
f4c4061bbd Changelog and related fixes. 2014-11-21 14:24:26 -08:00
A. Jesse Jiryu Davis
710227237a PYTHON-789 Clarify valid ObjectId input (3.0-dev). 2014-11-20 23:18:41 -05:00
A. Jesse Jiryu Davis
e8be121a89 PYTHON-785 Don't use requests in tests. 2014-11-20 22:57:56 -05:00
A. Jesse Jiryu Davis
daad4446f8 Rename connection_id and conn_id to "address". 2014-11-18 17:40:34 -05:00
A. Jesse Jiryu Davis
6a7edf76ed Finish renaming 'set_name' to 'replica_set_name'. 2014-11-18 17:33:01 -05:00
A. Jesse Jiryu Davis
ff7958ad38 PYTHON-525 Helpful connection error messages. 2014-11-18 12:14:35 -05:00
A. Jesse Jiryu Davis
13cb74a760 Simplify auth tests, don't create additional root users.
Don't log out the global test client either; keep it logged in as root and
use it to create additional non-root users to test Database.add_user,
authenticate, logout, and so on.
2014-11-17 21:39:22 -05:00
A. Jesse Jiryu Davis
1732b09155 Remove TestClientLazyConnectBadSeeds.
It isn't testing anything, and it can interfere with later tests: on Mac,
there's a global getaddrinfo lock. TestClientLazyConnectBadSeeds
starts 10 threads and doesn't join them, so they're still vying for the
lock as the next tests run.
2014-11-17 20:34:56 -05:00
A. Jesse Jiryu Davis
79b02fdd56 Shorter timeout in connection-failure tests. 2014-11-17 20:34:25 -05:00
A. Jesse Jiryu Davis
dedf203be9 Typo in test_host_w_port. 2014-11-17 20:34:25 -05:00
A. Jesse Jiryu Davis
28cf3102a6 Undeprecate message.insert().
In PyMongo 2.6, message.insert was replaced with _do_batched insert. It was
deprecated but not removed in case third-party libraries might rely on it. In
PyMongo 2.7 we implemented the Bulk API (PYTHON-630) and message.insert found a
new use.
2014-11-17 20:30:11 -05:00
A. Jesse Jiryu Davis
0e222c4c4c Rename "set_name" to "replica_set_name".
Rename the attributes of IsMaster, ServerDescription, TopologyDescription, and
TopologySettings from "set_name" to "replica_set_name" for greater clarity.
2014-11-17 20:29:16 -05:00
A. Jesse Jiryu Davis
5991635553 Unused imports in test files. 2014-11-17 16:15:12 -05:00
A. Jesse Jiryu Davis
026757fd0d Unused imports. 2014-11-17 16:12:18 -05:00
A. Jesse Jiryu Davis
43a5349c48 Fix test_stale_getmore and test_stale_killcursors. 2014-11-14 22:37:23 -05:00
A. Jesse Jiryu Davis
4948c04d6a Fix add_user tests for MongoDB 2.4. 2014-11-14 22:18:59 -05:00
A. Jesse Jiryu Davis
1b71104d75 Fix race with disconnect, auth, and getMore. 2014-11-14 22:18:06 -05:00
A. Jesse Jiryu Davis
a60de8eba1 Merge branch 'Winnetou-patch-3' into 3.0-dev
* Winnetou-patch-3:
  Two typos
2014-11-14 17:09:22 -05:00
Mieszko
6fe70b2ee0 Two typos 2014-11-14 20:23:39 +01:00
A. Jesse Jiryu Davis
beaf1175b4 Fix wtimeout tests for MongoDB 2.8. 2014-11-13 15:48:45 -05:00
A. Jesse Jiryu Davis
c2d4ca1a13 Fix require_test_commands decorator for unittests. 2014-11-13 15:48:45 -05:00
A. Jesse Jiryu Davis
5c8884c44b PYTHON-788 Remove copy_database helper method. 2014-11-13 14:05:10 -05:00
Bernie Hackett
02ef49ab42 PyMongo 2.8 changelog. 2014-11-11 15:06:40 -08:00
Bernie Hackett
ab9aa9619d PYTHON-778 - Document URI quoting rules. 2014-11-11 14:44:37 -08:00
A. Jesse Jiryu Davis
c1c8e1c6ca Typo in README.rst. 2014-11-10 21:36:49 -05:00
A. Jesse Jiryu Davis
627be51f4f Fix whitespace in test/utils.py. 2014-11-09 18:37:40 -05:00
A. Jesse Jiryu Davis
fd7ef80d00 PYTHON-782 Verify readchunk() works for a disconnected GridOut.
In PyMongo 3, GridOut always begins disconnected and connects on demand. It
doesn't have the same bug as on the v2.8 branch, since __getattr__ calls
_ensure_file().
2014-11-06 22:24:15 -05:00
Luke Lovett
d6e88051f2 Add a user and authenticate before copy_database specifying fromhost. 2014-11-05 21:09:33 +00:00
Luke Lovett
74699ec555 Assert that MongoClient raises OperationFailure when connecting to a host with bad credentials using SASL PLAIN. 2014-11-04 21:07:31 +00:00
Luke Lovett
1799781669 Force all tests to run in alphabetical order by module name. 2014-11-04 00:10:26 +00:00
Luke Lovett
b418b9f1ba Test the right client in TestClient.test_contextlib. 2014-11-04 00:10:26 +00:00
Luke Lovett
3bc1d1db7d Re-authenticate after logging out from TestThreadsAuth. 2014-11-04 00:10:26 +00:00
A. Jesse Jiryu Davis
db888042bd Fix races in TestTopologyErrors. 2014-11-03 17:25:51 -05:00
A. Jesse Jiryu Davis
ad54c686f1 Remove unused class SocketSettings. 2014-11-03 15:38:29 -05:00
A. Jesse Jiryu Davis
02194fecaf All TopologySettings options should default to None. 2014-11-03 15:38:12 -05:00
A. Jesse Jiryu Davis
4eef9836d9 Import style in test_gridfs. 2014-11-03 15:36:27 -05:00
A. Jesse Jiryu Davis
8a5980d738 More consistent use of 'reset' and 'close'. 2014-11-03 14:40:06 -05:00
A. Jesse Jiryu Davis
21976d9976 Monitors stop themselves when the Topology is GC'ed. 2014-11-03 14:40:06 -05:00
A. Jesse Jiryu Davis
38848d47f3 MongoClient.close() stops monitors.
Subsequent operations restart them.
2014-11-03 14:40:06 -05:00
A. Jesse Jiryu Davis
7226dab318 Faster method of checking server compatibility. 2014-11-03 12:06:57 -05:00
A. Jesse Jiryu Davis
01dc7fe47e Longer timeout in test_request_with_fork. 2014-11-03 09:39:06 -05:00
A. Jesse Jiryu Davis
60217e4e19 Fix race in test_common. 2014-11-02 15:34:48 -05:00
Bernie Hackett
64cda725e5 Use a separate db for manipulator test. 2014-11-02 08:30:52 -08:00
Bernie Hackett
1391e32f45 Add Sergey Azovskov to contributors. 2014-11-02 08:18:22 -08:00
Bernie Hackett
5db5276973 Add version information to docstring. 2014-11-02 08:16:42 -08:00
Bernie Hackett
b79f59eacf Manipulate defaults to False in find_and_modify. 2014-11-02 08:14:02 -08:00
Sergey Azovskov
75246e7c49 Added support for manipulate param in find_and_modify for consistency with find method 2014-11-02 08:13:45 -08:00
Bernie Hackett
232c801224 Update travis.yml 2014-10-31 16:06:43 -07:00
Bernie Hackett
919bdfe591 PYTHON-762 - Fix tests for python3.2. 2014-10-31 15:49:05 -07:00
A. Jesse Jiryu Davis
1447ad1257 Remove pymongo.errors.UnsupportedOption. 2014-10-31 16:42:11 -04:00
A. Jesse Jiryu Davis
7e6433b6bd Fix tests of MongoClient.host property.
Inadvertently used an RS client instead of a direct one,
when a replica set is available.
2014-10-31 16:38:32 -04:00
A. Jesse Jiryu Davis
52373af236 Remove obsolete GridFile test. 2014-10-31 16:38:32 -04:00
Bernie Hackett
6ff8b3669b PYTHON-781 - Fix tests for multiple storage engines.
Remove a few seemingly pointless test cases that
aren't portable across server versions, storage engines,
etc.
2014-10-31 13:30:02 -07:00
Bernie Hackett
626aeb71db PYTHON-761 - Use listCollections for helper methods 2014-10-31 13:27:39 -07:00
Bernie Hackett
370e9f25c6 PYTHON-762 - Use listIndexes for index_information 2014-10-31 13:25:18 -07:00
A. Jesse Jiryu Davis
7fb570d334 test_atexit_hook wasn't testing what it meant to. 2014-10-31 16:10:13 -04:00
A. Jesse Jiryu Davis
9143e187d3 Remove GridFS.open and close, and GridFile. 2014-10-31 14:15:25 -04:00
A. Jesse Jiryu Davis
936ee264cb PEP 257. 2014-10-31 14:15:24 -04:00
A. Jesse Jiryu Davis
d314b1f4fb Remove warnings about MongoDB versions before 1.8. 2014-10-31 14:15:24 -04:00
A. Jesse Jiryu Davis
08dccbba46 Remove ancient version annotations.
Delete "versionchanged" and "versionadded" directives that predate 2.0.
2014-10-31 14:15:24 -04:00
Bernie Hackett
429aa9c582 PYTHON-768 - Support authMechanismProperties.
This change also removes the gssapiServiceName option (deprecated in
PyMongo 2.8), which is replaced by authMechanismProperties=SERVICE_NAME:<service name>.
2014-10-30 22:01:38 -07:00
A. Jesse Jiryu Davis
0a246d2033 Standardize how tests construct MongoClients. 2014-10-30 19:36:59 -04:00
A. Jesse Jiryu Davis
772da8931e Redundant test code. 2014-10-30 19:35:26 -04:00
A. Jesse Jiryu Davis
935f8b7275 Test GridFS.find_one. 2014-10-28 16:20:53 -04:00
A. Jesse Jiryu Davis
7bda4586d6 Style. 2014-10-28 16:20:53 -04:00
ximing
facd8945b9 Add find_one() method for gridfs. 2014-10-28 15:54:57 -04:00
A. Jesse Jiryu Davis
fd8dd020bc PYTHON-703 Remove slow SON.__contains__ method.
__setitem__ must now check self.__keys to avoid setting keys twice during
"copy.copy(son_obj)".
2014-10-24 13:19:43 -04:00
Don Mitchell
b8c944f118 Allow destructive ops during son iteration
and let python handle (identical to iter on list)
2014-10-24 13:19:33 -04:00
Don Mitchell
4093c06726 Don't unnecessarily copy the key list
Conflicts:
	doc/contributors.rst
	test/test_son.py
2014-10-24 13:19:20 -04:00
A. Jesse Jiryu Davis
a7db21a0b4 PYTHON-706 Mention that backports.pbkdf2 provides the best performance. 2014-10-23 21:25:54 -04:00
behackett
d15a7ffbb5 PYTHON-706 - Optimize XOR in SCRAM HI. 2014-10-23 21:21:11 -04:00
A. Jesse Jiryu Davis
65900ad602 PYTHON-706 Use fastest SCRAM-SHA-1 implementation available. 2014-10-23 20:54:00 -04:00
A. Jesse Jiryu Davis
d89576f23e PYTHON-764 Update auth examples for MongoDB 2.8.
(cherry picked from commit 3ca47b8)
2014-10-23 16:32:00 -04:00
A. Jesse Jiryu Davis
ee11436675 PYTHON-764 SCRAM-SHA-1 automatic upgrade / downgrade. 2014-10-23 16:30:55 -04:00
Adam Comerford
4b70b2a6f7 Update grid_file.py
Comments need to reflect 256 to 255 kb default chunk size change to propagate to docs
2014-10-17 13:47:54 -04:00
A. Jesse Jiryu Davis
b633496415 PYTHON-757 Warn against installing third-party "bson" package.
Do **not** install the "bson" package. PyMongo comes with its own bson package;
doing "pip install bson" installs a third-party package that is incompatible
with PyMongo.

(cherry picked from commit eb25125)
2014-10-09 16:56:56 -04:00
A. Jesse Jiryu Davis
cb082d0ecc Avoid TypeError in Pool.__del__ during shutdown. 2014-10-09 16:51:27 -04:00
A. Jesse Jiryu Davis
73c9c3b0da PYTHON-749 Handle floating-point chunkSize in GridOut.
(cherry picked from commit 41dc866)
2014-10-08 13:00:12 -04:00
A. Jesse Jiryu Davis
ff6a5430fb PYTHON-749 Test that GridOut handles chunkSize as a float.
(cherry picked from commit fedad11)
2014-10-08 13:00:12 -04:00
A. Jesse Jiryu Davis
8e7caaacdb PYTHON-766 Fix KeyError when parsing certain mongos error responses. 2014-10-07 19:45:16 -04:00
A. Jesse Jiryu Davis
72513df373 PYTHON-766 Demonstrate a bug parsing an error message from mongos. 2014-10-07 19:45:16 -04:00
A. Jesse Jiryu Davis
c5eae2f99f Use replica set connection in tests wherever possible.
Most tests now inherit from IntegrationTest and use self.client for all MongoDB
operations. self.client is now a replica set connection if an RS is available,
otherwise a connection to a standalone.
2014-10-07 13:36:52 -04:00
A. Jesse Jiryu Davis
366e11d529 Silence DeprecationWarnings in add_user tests. 2014-10-06 22:32:01 -04:00
behackett
a142752e02 PYTHON-763 - Bump MAX_SUPPORTED_WIRE_VERSION to 3. 2014-10-02 16:36:01 -07:00
A. Jesse Jiryu Davis
de215fe88b Fix MongoClient.__getattr__ implementation.
Before, MongoClient._does_not_exist had raised AttributeError, 'super' object has no
attribute '__getattr__'. Now it raises, AttributeError: MongoClient has no attribute
'_does_not_exist'. To access the _does_not_exist database, use client['_does_not_exist'].
2014-10-02 17:41:49 -04:00
A. Jesse Jiryu Davis
c554297a0f Modern exception-handling syntax in ha_tools.
Now that we've dropped support for Python 2.4.
2014-10-02 10:08:26 -04:00
A. Jesse Jiryu Davis
f91c3d61cb Use with-statements to acquire locks.
We can use with-statements now that we've dropped support
for Python 2.4.
2014-10-02 10:07:43 -04:00
A. Jesse Jiryu Davis
6b978c9f87 Remove _TestLazyConnectMixin class.
This was necessary when we tested MongoClient and MongoReplicaSetClient
separately in PyMongo 2.x. In PyMongo 3.x the classes are unified so we
test all lazy-connection functionality in the same test class in test_client.py.
2014-10-02 09:21:15 -04:00
A. Jesse Jiryu Davis
6a75dc624d PYTHON-737 Raise AutoReconnect on exhaust cursor error.
Cursor had raised socket.error when failing to receive a batch from an exhaust
cursor, but it should raise AutoReconnect.

Also forward-port exhaust cursor tests from v2.8 to 3.0-dev.
2014-10-02 08:38:39 -04:00
A. Jesse Jiryu Davis
05f036c32c Update Topology tests.
The tests had once done "c = Cluster()" throughout. When Cluster was renamed
Topology, tests were left half-updated. They did "c = Topology()". This commit
completes the renaming: tests now do "t = Topology()".
2014-10-01 22:43:27 -04:00
A. Jesse Jiryu Davis
6b6f61f26c Fix TestMonitor.test_atexit_hook. 2014-09-26 21:31:56 -04:00
A. Jesse Jiryu Davis
f3546cc77b PYTHON-525 Update replica set docs for new MongoClient.
Also improve RST markup and fix duplicate reference targets in docstrings.
2014-09-26 19:30:47 -04:00
Bernie Hackett
43fd070ad3 PYTHON-493 - Add **kwargs to Database.dereference 2014-09-26 16:23:03 -07:00
Bernie Hackett
7653359bd8 PYTHON-679 - Add simple test for socketKeepAlive. 2014-09-26 15:18:05 -07:00
Bernie Hackett
772e3d3d84 PYTHON-693 - Fix parsing of default values for keyword args. 2014-09-26 11:35:43 -07:00
A. Jesse Jiryu Davis
6c53a9f876 PYTHON-525 Redundant server discovery tests.
These were written before test_discovery_and_monitor.py and its
accompanying JSON test files. topology.py maintains 100% test
coverage after these deletions.
2014-09-26 09:26:27 -04:00
A. Jesse Jiryu Davis
fdd93a1d78 Debug TestMonitor.test_atexit_hook. 2014-09-26 09:26:07 -04:00
A. Jesse Jiryu Davis
6004e2bcdd PYTHON-525 Use MongoClient in test_ha. 2014-09-25 16:36:36 -04:00
A. Jesse Jiryu Davis
a3bf6249b4 Test dropping an index twice. 2014-09-25 16:34:16 -04:00
A. Jesse Jiryu Davis
7b9341490d Test MongoClient with invalid URI scheme. 2014-09-25 16:34:16 -04:00
A. Jesse Jiryu Davis
7554a93268 Spelling: "test_drop_indexes_non_existent". 2014-09-25 16:34:16 -04:00
A. Jesse Jiryu Davis
8e8a7334dd Fix test_not_master_error for auth. 2014-09-25 16:34:16 -04:00
A. Jesse Jiryu Davis
6641d04882 Unused imports. 2014-09-25 16:34:15 -04:00
A. Jesse Jiryu Davis
28d40f5745 Redundant implementation of partition_node(). 2014-09-25 16:34:15 -04:00
A. Jesse Jiryu Davis
e417045bc0 Improve MongoClient test coverage. 2014-09-25 16:34:15 -04:00
A. Jesse Jiryu Davis
265490bd74 Unused helper function "shuffled()". 2014-09-25 16:34:15 -04:00
Bernie Hackett
7e04bfea39 PYTHON-753 - Add "How To Ask For Help" in README.rst 2014-09-25 13:14:21 -07:00
A. Jesse Jiryu Davis
fabff670af NotMasterError, not AutoReconnect, on w=0 write to secondary.
Not a breaking change, since NotMasterError inherits from AutoReconnect. But a
NotMasterError is more consistent with the original intent: bail as if we'd done a
getLastError.
2014-09-25 11:33:44 -04:00
A. Jesse Jiryu Davis
78cc210dcb Dead code in Pool. 2014-09-25 11:33:07 -04:00
A. Jesse Jiryu Davis
647ed74dcf PYTHON-525 Remove "force" param for Pool.get_socket().
MongoReplicaSetClient's old monitor used "force" to get a socket even when the
pool had reached its max size. This was so complicated and bug-prone that I
prohibited it in the Server Discovery And Monitoring Spec: monitors use
dedicated sockets now instead of sharing a pool with the application.
2014-09-25 11:32:06 -04:00
A. Jesse Jiryu Davis
081ca08163 PYTHON-525 Socket timeout for monitoring is connect_timeout.
The spec's justification is that while a client waits for a server to respond to a
connection, the client does not know if the server will respond eventually or if it is
down. Users help the client guess by supplying a reasonable connectTimeoutMS for
their network.

The socketTimeoutMS, on the other hand, must account for both network latency
and the operation's duration. Applications should set a long or infinite
socketTimeoutMS to wait for long-running operations.

A socket used for monitoring does two things: it connects and calls ismaster. Both
operations are fast on the server, so only network latency matters. Thus both
operations use connectTimeoutMS, since that is the value users supply to help the
client guess if a server is down, based on users' knowledge of expected latencies
on their networks.
2014-09-25 11:15:31 -04:00
A. Jesse Jiryu Davis
148bbc2fb2 Note that Topology.select_server() calls open() if needed. 2014-09-24 22:29:27 -04:00
A. Jesse Jiryu Davis
fea501f314 PYTHON-525 Try to halt monitors before exiting. 2014-09-24 19:12:30 -04:00
A. Jesse Jiryu Davis
cfcc601922 Fix test_server.py's docstring. 2014-09-24 19:12:13 -04:00
Bernie Hackett
09eec2c179 PYTHON-739 - Add namespace to command failure message. 2014-09-24 14:05:57 -07:00
A. Jesse Jiryu Davis
a0330f7b63 PYTHON-525 Update ReadPreference doc. 2014-09-24 16:09:36 -04:00
A. Jesse Jiryu Davis
4d28ed7028 PYTHON-525 Obsolete attributes in RS client doc. 2014-09-24 16:09:36 -04:00
A. Jesse Jiryu Davis
1236e58bc4 Fix docs for latency_threshold_ms. 2014-09-24 16:09:36 -04:00
Bernie Hackett
d3392a581f PYTHON-752 - Fix escaping in SocketInfo.command. 2014-09-24 12:34:57 -07:00
Bernie Hackett
fd880545bf PYTHON-700 - Support subclassing of son manipulators 2014-09-24 09:40:33 -07:00
A. Jesse Jiryu Davis
bfbfd3a866 TestCursorManager need not inherit from TestRequestMixin. 2014-09-24 10:16:16 -04:00
A. Jesse Jiryu Davis
2f039d87e3 Remove "functools.partial" backport. 2014-09-24 10:13:18 -04:00
A. Jesse Jiryu Davis
496e39faa2 Remove "itertools.permutations" backport. 2014-09-24 10:11:25 -04:00
A. Jesse Jiryu Davis
13a3aa3aa4 Remove "assertIsInstance" backport.
No longer required since we use unittest2 on Python 2.6, and the method is
in the standard library for Python 2.7+.
2014-09-24 10:08:57 -04:00
A. Jesse Jiryu Davis
5405d93467 Remove unused test method "assertSoon". 2014-09-24 10:04:57 -04:00
A. Jesse Jiryu Davis
3dae9fafe8 Instructions to compile python for mod_wsgi testing. 2014-09-24 09:54:43 -04:00
Bernie Hackett
8f64e476ba PYTHON-480 - Filter __getattr__ lookups.
After this change creating instances of Database or
Collection with a name starting with a leading underscore
requires dict-style access on the parent object. This
solves problems with ipython code completion and ABCMeta
while still preserving the ability to access databases and
collections named this way.
2014-09-23 15:41:41 -07:00
A. Jesse Jiryu Davis
f6f1f77e35 Python 3 compatibility in mod_wsgi test. 2014-09-23 15:26:49 -04:00
Bernie Hackett
9c8852d93f PYTHON-760 - BSONInt64 -> Int64 2014-09-23 11:43:41 -07:00
A. Jesse Jiryu Davis
8b8123932f Use lower() to canonicalize hostnames.
Normalize hostname to lowercase, since DNS is case-insensitive:

http://tools.ietf.org/html/rfc4343

This prevents useless rediscovery if "foo.com" is in the seed list but
"FOO.com" is in the ismaster response.
2014-09-22 16:36:20 -04:00
A. Jesse Jiryu Davis
5a0c9f658b Update JSON test files from spec repo.
Tests updated to handle hostname down-casing and the replacement
of "clusterType" with "topologyType".

https://github.com/mongodb/specifications/tree/master/source/server-discovery-and-monitoring/tests
2014-09-22 14:29:32 -04:00
A. Jesse Jiryu Davis
3c9fd60fed PYTHON-525 Use MongoClient in replica set tests.
Connect the MongoClient to the replica set if one is running,
otherwise connect it to the standalone. Only continue to use
MongoReplicaSetClient when testing the specific behavior of
that deprecated class.

Also suppress some warnings when running tests, and better
determine whether to test IPv6.
2014-09-20 08:42:23 -04:00
Luke Lovett
aa7cf47731 PYTHON-758 Allow tests to use an existing user when running under auth. 2014-09-19 21:17:11 +00:00
Bernie Hackett
b9dea4a670 Restore copy_database fromhost test...
...and skip it on buggy mongos versions.
2014-09-18 16:42:07 -07:00
A. Jesse Jiryu Davis
98f96295aa Obsolete docs for "authenticate" and "logout".
All sockets are automatically authenticated or logged out when one thread
calls authenticate() or logout(). There is no need to disconnect the client.
2014-09-18 09:07:04 -04:00
A. Jesse Jiryu Davis
9a944b56ce Auth doc should use term "deployment", not "cluster".
The term "cluster" is reserved for sharded clusters in MongoDB documentation.
This document should use the term "deployment" to mean any set of one or
more MongoDB servers.
2014-09-17 22:32:43 -04:00
A. Jesse Jiryu Davis
98afef5871 Replace "Cluster" term with "Topology".
The Server Discovery And Monitoring Spec has replaced the term "cluster"
with "topology", since "cluster" in MongoDB terminology should be reserved
for sharded clusters. "Topology" describes a single server, replica set, or a
set of mongoses.

The previous commit replaced "cluster" with "topology" in file names. Here
I replace the term in class and variable names.
2014-09-17 22:32:43 -04:00
A. Jesse Jiryu Davis
d464dc49c6 Rename "cluster" files to "topology".
The Server Discovery And Monitoring Spec has replaced the term "cluster"
with "topology", since "cluster" in MongoDB terminology should be reserved
for sharded clusters. "Topology" describes a single server, replica set, or a
set of mongoses.

The next commit will replace "Cluster" names with "Topology".
2014-09-17 22:32:43 -04:00
Bernie Hackett
6595657128 PYTHON-759 - Support $date as ISO-8601 or $numberLong 2014-09-17 14:02:18 -07:00
A. Jesse Jiryu Davis
65cea3c76f Raise OperationFailure if command response has no document.
Commands are implemented as a find_one on the "$cmd" collection.
In the unlikely event the find_one succeeds but has no documents,
raise OperationFailure.

Before this change, PyMongo would've thrown UnboundLocalError.
2014-09-16 15:33:19 -04:00
A. Jesse Jiryu Davis
735a1247ca PYTHON-525 Deprecate MongoReplicaSetClient.
MongoClient now supports all MongoReplicaSetClient's features.
Fix bugs and add features in the new MongoClient to bring it up
to spec. MongoReplicaSetClient is now a deprecated stub that
subclasses MongoClient.

Introduce new errors, NetworkTimeout and NotMasterError, to
communicate events that MongoClient must handle specially.
2014-09-16 15:33:19 -04:00
Bernie Hackett
6a7c9139a0 PYTHON-314, PYTHON-744 - Hint by index name, count with hint.
This change introduces two closely related features. Cursor.hint
now accepts the name of an index as an alternative to passing
the index spec. Cursor.count will now pass the hint, if one was
specified, to the count command. Count with hint is only supported
by MongoDB 2.6 and newer.
2014-09-12 13:10:09 -07:00
A. Jesse Jiryu Davis
a801c38d4a PYTHON-525 Restart monitor threads after fork.
A reimplementation of PYTHON-549 for PyMongo 3's new MongoClient.
2014-09-09 16:14:59 -04:00
A. Jesse Jiryu Davis
fd3154d8a1 PYTHON-525 Don't reset whole Cluster on network error.
According to the spec, clear the pool for the server we were disconnected from
and mark the server Unknown, but don't update other servers. This is a change
from PyMongo 2's MongoReplicaSetClient, which reset all servers and their pools
when disconnected from the primary specifically.

The spec's justification is, "since application sockets are used frequently, a
network error likely means the server has just become unavailable, so an
immediate refresh is likely to get a network error, too. The server will not
remain Unknown forever. It will be refreshed by the next periodic check or, if
an application operation needs the server sooner than that, then a re-check
will be triggered by the server selection algorithm."

If the primary has gone down and we are in the midst of an election, marking
all servers Unknown and forcing a re-scan will simply detect that all servers
are currently secondaries, which the client knows anyway.
2014-09-09 13:49:57 -04:00
A. Jesse Jiryu Davis
5d5c9835a6 PYTHON-525 Python 3 compatibility in SocketInfo.check_auth. 2014-09-08 12:06:00 -04:00
A. Jesse Jiryu Davis
dd8d82c198 PYTHON-525 Update obsolete docstring. 2014-09-08 08:56:14 -04:00
A. Jesse Jiryu Davis
6f79c4ca63 PYTHON-525 Fix race in test_max_wire_version. 2014-09-07 18:02:29 -04:00
A. Jesse Jiryu Davis
006cb1aaf7 PYTHON-525 Don't use auto_start_request in mod_wsgi tests.
auto_start_request is gone from the new MongoClient and is about to be
removed from MongoReplicaSetClient.
2014-09-06 14:50:05 -04:00
Bernie Hackett
c33c03078e PYTHON-525 - Fix overflow error when testing on Windows 2014-09-05 16:11:30 -07:00
Bernie Hackett
83cf1702bd Fix index tests for MongoDB 2.7.x explain output 2014-09-05 15:33:28 -07:00
Bernie Hackett
71380ca65b PYTHON-706 - Optimize our use of HMAC. 2014-09-05 06:44:21 -07:00
A. Jesse Jiryu Davis
49c51cfc89 Fix long comment line. 2014-09-05 09:01:23 -04:00
A. Jesse Jiryu Davis
9827681cc9 PYTHON-525 Fix test_cluster_spec.
After rebasing, ClusterSettings should no longer take a "heartbeat_frequency" argument.
2014-09-04 16:11:56 -04:00
Bernie Hackett
9ad0cc6d0f PYTHON-706 - Use SystemRandom for secure nonces. 2014-09-04 12:52:27 -07:00
A. Jesse Jiryu Davis
7d81e3fa5e Convert YAML to JSON. 2014-09-04 09:48:02 -04:00
A. Jesse Jiryu Davis
375e03e392 PYTHON-525 Test direct connection to an RS member via external IP. 2014-09-04 09:48:02 -04:00
A. Jesse Jiryu Davis
1aa477ae41 Rename test to more accurate direct_connection_slave.yml. 2014-09-04 09:48:02 -04:00
A. Jesse Jiryu Davis
5d1fa0f133 PYTHON-525 Better test_cluster_spec messages.
If a server or cluster is the wrong type at the end of a test, print the type's name, not its number.
2014-09-04 09:48:02 -04:00
A. Jesse Jiryu Davis
a526952b2f PYTHON-525 Handle a new primary with wrong setName.
Bug fix in updated_cluster_description: if a new server is a primary of another replica set, set the cluster type to ReplicaSetWithPrimary or ReplicaSetNoPrimary, depending on whether this set's primary is known.
2014-09-04 09:48:02 -04:00
A. Jesse Jiryu Davis
604bf91968 Correct cluster type if a primary uses internal IP.
Begin with CLUSTER_TYPE.ReplicaSetNoPrimary and a
seed list of "A". The client connects to A and finds that
it's a primary, and its host list is ["B"], where "B" is the
internal IP for "A". The client should remove "A" from its
list of servers and add "B" as SERVER_TYPE.Unknown,
and start monitoring "B".

The cluster type should remain ReplicaSetNoPrimary,
since server "B" is of type Unknown, and "A" is no longer
in the ClusterDescription. However, the cluster type
winds up as ReplicaSetWithPrimary.
2014-09-04 09:48:02 -04:00
A. Jesse Jiryu Davis
1bc754e05c Fix style in test_cluster_spec. 2014-09-04 09:48:02 -04:00
A. Jesse Jiryu Davis
fac5d5b39e YAML files should end with a newline. 2014-09-04 09:48:02 -04:00
A. Jesse Jiryu Davis
351fe62f25 Update discovery.yml test from spec. 2014-09-04 09:48:01 -04:00
Eric Daniels
ecd6905078 Fixed hosts in discovery test 2014-09-04 09:48:01 -04:00
Eric Daniels
44168e1c77 Fixed yml formatting 2014-09-04 09:48:01 -04:00
Eric Daniels
2411f2c3e8 Implemented Cluster Monitor tests and test harness to consume them 2014-09-04 09:48:01 -04:00
Bernie Hackett
5c4b2499eb PYTHON-346 - Use codecs for all string decoding/encoding. 2014-09-03 15:05:14 -07:00
A. Jesse Jiryu Davis
41c1a9afa6 PYTHON-525 Reimplement auth for new MongoClient.
The new MongoClient, based on Cluster and Server,
includes functionality that had been split between the
old MongoClient and MongoReplicaSetClient. A
previous commit introduced the new MongoClient
but broke authentication.
2014-09-03 17:39:52 -04:00
A. Jesse Jiryu Davis
324d1de030 PYTHON-525 Update test_ssl for new MongoClient. 2014-09-03 17:38:30 -04:00
A. Jesse Jiryu Davis
30c42979a1 Run tests even if prior run didn't clean up users.
If a previous test run created a user and didn't remove it (e.g. the test hung or a debugging session was terminated), the next test run will fail because of the narrowed localhost exception (SERVER-12621). Work around this by trying to log in as the test user, if that fails re-raise the original error.
2014-09-03 17:35:51 -04:00
A. Jesse Jiryu Davis
075fa1152b PYTHON-525 Tests determine quickly if a mongod is available.
Don't wait 5 seconds before giving up.
2014-09-03 17:35:43 -04:00
A. Jesse Jiryu Davis
1f4391b5b2 Fix test_unix_socket for narrowed localhost exception. 2014-09-03 17:32:43 -04:00
A. Jesse Jiryu Davis
71d4d93749 PYTHON-525 Speed up ConnectionFailure tests. 2014-09-03 17:32:30 -04:00
A. Jesse Jiryu Davis
20dd80e5f2 PYTHON-525 Skip SSL tests quickly if SSL is disabled.
Don't wait 5 seconds to determine that an SSL-enabled server is unavailable.
2014-09-03 17:32:24 -04:00
A. Jesse Jiryu Davis
567675666f PYTHON-525 Bugfix, allow tests to override SERVER_WAIT_TIME.
The "with client_knobs(server_wait_time=0.1)" optimization for tests hadn't actually changed MongoClient's behavior.
2014-09-03 17:31:48 -04:00
Bernie Hackett
c6a1a2c384 PYTHON-346 - Type lookup and caching improvements. 2014-09-03 13:53:22 -07:00
Bernie Hackett
4292756d3c PYTHON-754 - Deprecate dropDups / drop_dups 2014-08-29 16:55:07 -07:00
Bernie Hackett
d3e74639f6 PYTHON-346 - Add _encode_mapping, cache subtypes. 2014-08-29 15:23:22 -07:00
Bernie Hackett
1accea6fc2 PYTHON-226 - Optimize ObjectId creation from BSON
This change optimizes creating an instance of ObjectId
from a 12 byte bytes instance. It gets us most of the way
to what was requested in the ticket without creating a
separate subtype just for decoding.

There are also a number of changes to clean up the module
in general and silence pylint complaints.
2014-08-28 21:07:14 -07:00
A. Jesse Jiryu Davis
9d01f6c994 Skip kill_cursors tests for mongos before 2.4.7. 2014-08-28 16:57:57 -04:00
A. Jesse Jiryu Davis
2f9d24ade6 PYTHON-525 Reimplement MongoClient to use Cluster.
Replace MongoClient with an implementation that relies on Cluster and Server. The new MongoClient takes over MongoReplicaSetClient's responsibilities.

Authentication, secondary-pinning, and Mongos high-availability are broken and will be reimplemented in a future commit. RS tests are temporarily disabled.
2014-08-28 16:57:57 -04:00
A. Jesse Jiryu Davis
564d20aa76 PYTHON-525 Cluster improvements.
* open() is idempotent.
* Open on demand.
* Implement reset().
* Obey PoolOptions.
* Obey ClusterSettings.server_wait_time.
* Bugfix for server_wait_time=0.
* Raise AutoReconnect, not ConnectionFailure.
2014-08-28 16:49:33 -04:00
A. Jesse Jiryu Davis
590c68d287 PYTHON-525 Move SERVER_TYPE to its own file. 2014-08-28 16:49:33 -04:00
A. Jesse Jiryu Davis
51daea7eb2 PYTHON-525 Add method Cluster.select_server().
In addition to plural select_servers().
2014-08-28 16:49:33 -04:00
A. Jesse Jiryu Davis
c06b3bdb94 Undeprecate MongoClient.set_cursor_manager. 2014-08-28 16:49:33 -04:00
A. Jesse Jiryu Davis
2fc926ac7c Missing import. 2014-08-28 16:49:33 -04:00
A. Jesse Jiryu Davis
3027853cd9 PYTHON-525 Server selection implemented within ReadPreference classes. 2014-08-28 16:49:33 -04:00
Bernie Hackett
6e2f8a2773 PYTHON-346 - Remove buffer copies. 2014-08-28 10:55:45 -07:00
Bernie Hackett
3396ea94cc PYTHON-505 - Fix bson tests under Jython2.7.
Re-introduces a workaround for http://bugs.jython.org/issue1728,
which looks like it will finally be fixed in Jython2.7b4.
2014-08-22 16:43:05 -07:00
Bernie Hackett
f76618d45f Clean up an unnecessary constant definition. 2014-08-22 16:00:31 -07:00
Bernie Hackett
852b2d36f8 PYTHON-346 - Eliminate second _bson_to_dict return value
This has been unnecessary for many releases.
2014-08-22 15:35:56 -07:00
Bernie Hackett
e6809e8132 PYTHON-346 - Eliminate unnecessary datetime.replace call 2014-08-22 14:45:04 -07:00
Bernie Hackett
071137ddde Skip dropDups test on mongo versions newer than 2.6.x
The dropDups option is no longer supported in MongoDB.
2014-08-22 12:54:17 -07:00
Bernie Hackett
3e059f76d7 PYTHON-346 - Optimize decoding of most types.
This change provides perf improvements for decoding
most types in pure python. Like the previous changes
for encoding, the biggest improvements are seen decoding
BSON arrays to python lists - over 150% using pypy.
2014-08-22 11:40:49 -07:00
Bernie Hackett
adb37e2802 PYTHON-346 - Relocate _make_c_string and friends. 2014-08-21 15:34:20 -07:00
Bernie Hackett
09722a9b6b PYTHON-346 - Cleanup style and silence a host of pylint complaints. 2014-08-20 13:21:02 -07:00
Bernie Hackett
e68fdf2b62 PYTHON-505 - Fix C extension build with VC++. 2014-08-20 13:15:26 -07:00
Bernie Hackett
74f55a283a PYTHON-346 - Eliminate _get_int unsigned option
This cleans up a few pylint complaints and provides a
small perf improvement.
2014-08-20 11:30:12 -07:00
Bernie Hackett
8dc79d1b30 PYTHON-346 - Use a tuple for decoder options.
This is just a cleanup of the existing decoder. I tried
using a namedtuple but that imposed up to a 17% perf hit
(a regular tuple imposed no measureable perf hit). We may
be able to avoid that problem with a new API that accepts
decoder options in a specific class instead of creating the
instance in the decoder itself.
2014-08-20 11:10:04 -07:00
Bernie Hackett
bad4a109b4 PYTHON-706 - SCRAM-SHA-1 2014-08-13 15:02:28 -07:00
Luke Lovett
17fb3a2a02 PYTHON-505 Allow C extensions to encode any mapping type, not just dicts. 2014-08-13 16:16:25 +00:00
A. Jesse Jiryu Davis
f56ba1bff1 No-rendezvous pool tests use the correct pool.
_test_max_pool_size_no_rendezvous had run tests with the MongoClient "self.c", then asserted post-conditions with the local MongoClient "c". So the test passed by accident: it never tested what it thought it tested.

Require tests to pass the client explicitly to the MongoThread to avoid repeating this mistake.
2014-08-11 10:09:12 -04:00
A. Jesse Jiryu Davis
9a8d4b5c7e Enable MongoClient unittests that were disabled by mistake. 2014-08-05 11:23:31 -04:00
A. Jesse Jiryu Davis
334fcae221 PYTHON-525 Race condition in TestClusterErrors.test_pool_reset. 2014-08-04 21:11:57 -04:00
A. Jesse Jiryu Davis
edcb291d91 Tiny style fix. 2014-08-04 21:11:57 -04:00
Bernie Hackett
28a9f1cfb8 PYTHON-743 - Add ClientOptions class. 2014-08-04 11:38:46 -07:00
Bernie Hackett
c15c2be61d PYTHON-719 - Fix imports and indentation. 2014-08-04 11:29:56 -07:00
A. Jesse Jiryu Davis
7c5c23bf60 PYTHON-525 Avoid lost notifications in Monitor.request_check().
If another thread called Monitor.request_check() while the Monitor was in run(),
right after _check_with_retry() and before it acquired the lock, the Monitor
would miss the notification and wait "heartbeat_frequency" before checking
again.

Doesn't matter in real life, since re-checking a server a millisecond after the
last check isn't useful, but important for tests that change state and immediately
call request_check().
2014-07-30 20:05:29 -04:00
A. Jesse Jiryu Davis
9cdb1dee8c PYTHON-525 Configurable heartbeat_frequency.
May not actually be user-configurable in the new MongoClient, but useful to
prevent race conditions in cluster-monitoring tests.
2014-07-29 08:54:14 -04:00
A. Jesse Jiryu Davis
6bdce59b08 Allow certificate-validation tests to run. 2014-07-29 08:43:20 -04:00
A. Jesse Jiryu Davis
d3326de5aa close_cursors requires 'address' parameter. 2014-07-28 21:21:37 -04:00
A. Jesse Jiryu Davis
36c3ccb007 Wrap server responses in a Response or ExhaustResponse object. 2014-07-28 21:21:37 -04:00
Luke Lovett
d45aa36468 PYTHON-682 Add .coveragerc 2014-07-23 19:23:57 +00:00
Bernie Hackett
4aa3f9f855 PYTHON-346 - Fix DBRef encoding under jython2.7
Jython doesn't support struct.pack_into for bytearray.
2014-07-22 17:38:10 -07:00
Bernie Hackett
799b11f2aa PYTHON-346 - Fix unhashable types issue in python 3.4. 2014-07-22 16:45:21 -07:00
Bernie Hackett
2d8fc71cf3 PYTHON-707 - Fix -Werror=declaration-after-statement 2014-07-22 16:35:50 -07:00
Bernie Hackett
bce2cc2a28 PYTHON-738 - Clarify versionchanged line for bulk insert. 2014-07-22 16:21:17 -07:00
Luke Lovett
22702866c4 PYTHON-707 Update bson.son.SON's documentation in light of new BSONInt64 type. 2014-07-22 22:55:41 +00:00
Bernie Hackett
88372990d9 PYTHON-346 - Reimplement pure python BSON encoder.
This is the first step in rewriting the pure python BSON
module. These changes provide measurable improvements for
all types including up to a 95% improvement in encoding
performance for lists/tuples.
2014-07-22 15:42:23 -07:00
Luke Lovett
2277ee3531 PYTHON-707 Encode BSONInt64 in C extensions. 2014-07-21 17:40:37 +00:00
Luke Lovett
35c7445a67 PYTHON-708 Support $undefined and $numberLong extended JSON types. 2014-07-18 16:46:35 +00:00
Luke Lovett
5136bb723c PYTHON-707 Add a BSONInt64 type. 2014-07-18 14:59:21 +00:00
A. Jesse Jiryu Davis
55f18f0937 SocketInfo's 'host' parameter is no longer optional. 2014-07-17 15:26:58 -04:00
A. Jesse Jiryu Davis
118b47e6e3 Unused imports. 2014-07-17 15:23:40 -04:00
A. Jesse Jiryu Davis
ccb79b1cda PYTHON-726 Document how to run tests with Gevent. 2014-07-17 15:13:33 -04:00
A. Jesse Jiryu Davis
403b93eb84 PYTHON-726 Fix tests to run with Gevent's monkey-patching.
Gevent and multiprocessing work poorly together, so don't use
multiprocessing in test_objectid. Additionally, Gevent 0.13.8
deadlocks with more than about 40 concurrent greenlets on Mac,
so reduce the concurrency to about 20. test_interrupt_signal
still fails with 0.13.8, but others pass, and *all* tests pass
with Gevent 1.0.1:

python -m gevent.monkey setup.py test
2014-07-17 15:13:22 -04:00
A. Jesse Jiryu Davis
1bfac99f08 PYTHON-724 Remove Gevent-specific code.
PyMongo 2.x has Gevent-specific code to support Gevent with or without
patch_thread. However, patch_socket is always required with Gevent.

In PyMongo 3, we remove all Gevent-specific code and rely on Gevent's
patch_all.

Remove the "use_greenlets" option and attribute for MongoClient and
MongoReplicaSetClient.
2014-07-17 15:09:46 -04:00
A. Jesse Jiryu Davis
2177256da0 Fix intermittent failure in test_exhaust_network_error. 2014-07-17 14:08:43 -04:00
A. Jesse Jiryu Davis
648301e082 PYTHON-724 Fix test_pooling for PyPy.
Coding mistakes introduced in 5ce1dd.
2014-07-17 14:03:45 -04:00
A. Jesse Jiryu Davis
7cd1662ba5 Unused import. 2014-07-15 18:24:51 -04:00
A. Jesse Jiryu Davis
be5b4aeff9 PYTHON-724 Remove greenlet- and gevent-specific client tests. 2014-07-15 18:24:51 -04:00
A. Jesse Jiryu Davis
4ab4a979f8 PYTHON-724 Remove use_greenlets from high-availability tests. 2014-07-15 18:24:51 -04:00
A. Jesse Jiryu Davis
5ce1ddfcce PYTHON-724 Remove greenlet- and gevent-specific pool tests. 2014-07-15 18:24:50 -04:00
Luke Lovett
8c5a21a70f Skip test_exhuast_network_error when connected to a mongos, since mongos doesn't support exhaust cursors. 2014-07-15 21:26:45 +00:00
A. Jesse Jiryu Davis
ac437f5feb PYTHON-724 Explain changes in PyMongo 3.0's Gevent support. 2014-07-15 17:04:57 -04:00
A. Jesse Jiryu Davis
b57a2d2036 PYTHON-724 Remove use_greenlets from docs and comments. 2014-07-15 16:37:52 -04:00
A. Jesse Jiryu Davis
622e9e7d45 Redundant imports. 2014-07-15 16:18:18 -04:00
A. Jesse Jiryu Davis
ae984f7a84 PYTHON-732 Test network error during authentication.
As hoped, rewriting the error-handling code to use context managers
(PYTHON-722) has already fixed PYTHON-732 in the 3.0-dev branch.
2014-07-15 16:11:44 -04:00
A. Jesse Jiryu Davis
6f129dea13 Don't test MongoClientNew with auth until it supports auth. 2014-07-15 16:06:56 -04:00
A. Jesse Jiryu Davis
94b73af1af PYTHON-715 Fix ipv6 tests for restricted localhost exception.
IPv6 clients must be authenticated to use MongoDB 2.7.1+,
even over the localhost interface.
2014-07-15 16:06:07 -04:00
Luke Lovett
f22ff8ca68 PYTHON-679 add 'socketKeepAlive' option to MongoClient and MongoReplicaSetClient. 2014-07-15 01:09:57 +00:00
A. Jesse Jiryu Davis
96184d05d8 Fix ResourceWarning in test_dead_request_socket_with_max_size. 2014-07-14 16:16:53 -04:00
A. Jesse Jiryu Davis
f10f7f91a5 PYTHON-722 Use SocketInfo in a with-statement.
SocketInfo is now responsible for sending and receiving messages,
for closing itself on error, and for returning itself to the pool
when its with-statement is exited.

Pool.discard_socket is removed. Returning a closed socket to the
pool has the same effect as discard_socket had.

Remove client._exhaust_next.
2014-07-14 16:11:35 -04:00
A. Jesse Jiryu Davis
6f5b61cf81 More robust stepdown testing.
A 2.6 primary may not be ready to step down immediately after the RS
is initialized: "no secondaries within 10 seconds of optime". Keep
trying for a while.
2014-07-14 16:09:34 -04:00
A. Jesse Jiryu Davis
f615983bec Fix test.utils.read_from_which_host for the new read preferences. 2014-07-14 16:09:34 -04:00
Bernie Hackett
d408d1101d PYTHON-730 - Add a validate option to uri_parser 2014-07-11 15:23:25 -07:00
Bernie Hackett
709601f022 Clean up SSL support. 2014-07-09 07:22:54 -07:00
Luke Lovett
75395df8db connection_string() helper should use given seed list even without auth enabled. 2014-07-07 21:53:18 +00:00
Luke Lovett
d7ec3a7704 PYTHON-715 Fix tests for MongoDB >= 2.7.1 when running with auth enabled. 2014-07-07 19:05:21 +00:00
Bernie Hackett
c2e6471ee6 PYTHON-727 - Implement and use PoolOptions class 2014-07-03 14:10:37 -07:00
A. Jesse Jiryu Davis
698ddd88c5 Add docstrings in Cluster and related classes. 2014-07-03 14:17:46 -04:00
A. Jesse Jiryu Davis
b32d2f1019 Skip MongoClientNew tests when necessary. 2014-07-02 17:28:53 -04:00
Bernie Hackett
3383d38342 Minor cluster update optimization. 2014-07-02 14:01:20 -07:00
Bernie Hackett
af58f9e9e7 Another fix for test_client_new. 2014-07-02 13:24:56 -07:00
Bernie Hackett
4120399a11 Fix test_client_new for standalone and mongos. 2014-07-02 12:56:09 -07:00
Bernie Hackett
6e3da18114 PYTHON-525 - Cluster monitoring python 3 support. 2014-07-02 11:51:34 -07:00
Bernie Hackett
fcba34b50c PYTHON-525 - Add required properties to MongoClientNew 2014-07-02 11:50:16 -07:00
A. Jesse Jiryu Davis
d79ab6eb5e PYTHON-525 Implement Cluster, Server, and Monitor.
This is prelude to a unified MongoClient class to replace the current
MongoClient and MongoReplicaSetClient. Conforms to the Cluster Monitoring Spec.
2014-07-01 22:53:24 -04:00
Luke Lovett
4fa96c6c2e PYTHON-683 Separate unit tests and integration tests in the pymongo test suite.
Raise SkipTest in tests that require a connection to MongoDB when none is available.
2014-06-30 17:42:29 +00:00
A. Jesse Jiryu Davis
ea74333b01 Spelling. 2014-06-28 12:37:03 -07:00
Bernie Hackett
81dc7e41d2 Fix read preference tests. 2014-06-27 19:25:49 -07:00
Bernie Hackett
be35ff71a2 PYTHON-719 Read preference backward compatibility
This commit does a few things:

- Adds tag_sets back (deprecated)
- Adds secondary_acceptable_latency_ms back (deprecated)
- Makes acceptable latency a per read preference setting
- Cleans up read preference instance generation
- Adds latencyThresholdMS as an alias for secondaryAcceptableLatencyMS.
The name may change before 3.0 is released.
2014-06-27 15:05:20 -07:00
Bernie Hackett
665440be62 Make gridfs tests pass regardless of execution order. 2014-06-27 12:41:18 -07:00
Bernie Hackett
92e7eea8de Fix an issue with mongos read preferences. 2014-06-25 17:42:27 -07:00
Bernie Hackett
80a789e167 PYTHON-718 - Use SSLContext when available.
This commit also introduces a fake SSLContext class
for use in python versions that don't provide one.
2014-06-25 16:09:55 -07:00
Bernie Hackett
6caa320d47 PYTHON-717 - Implement MongoCredential 2014-06-25 15:25:03 -07:00
Luke Lovett
77457f0795 PYTHON-714 Work around localhost exception issues in add_user when connected to MongoDB >= 2.7.1. 2014-06-25 21:26:29 +00:00
Bernie Hackett
e94a6405da Fix tests under pypy3. 2014-06-21 22:49:05 -07:00
A. Jesse Jiryu Davis
ac512ce170 PYTHON-709 insert _id in document after applying non-copying SONManipulators. 2014-06-19 14:51:09 -04:00
A. Jesse Jiryu Davis
468bec6c32 Revert "PYTHON-710, simplify SON's equality operator."
This reverts commit 551e1e3edf.
The change did not work as expected in Jython.
2014-06-19 14:11:45 -04:00
A. Jesse Jiryu Davis
825f779a1a Use modern 'distinct' syntax in tests.
The old syntax is now an error:
https://jira.mongodb.org/browse/SERVER-12642
2014-06-18 20:35:49 -04:00
A. Jesse Jiryu Davis
551e1e3edf PYTHON-710, simplify SON's equality operator. 2014-06-18 19:09:25 -04:00
A. Jesse Jiryu Davis
4aad6bc6b8 PYTHON-710, SON.to_dict shouldn't change original data. 2014-06-18 19:09:19 -04:00
A. Jesse Jiryu Davis
4c763ee5ba PYTHON-710 test that SON.to_dict doesn't change data. 2014-06-18 19:05:02 -04:00
A. Jesse Jiryu Davis
504c5a9889 PYTHON-712 ObjectId.is_valid(None) should be False. 2014-06-18 17:02:07 -04:00
Bernie Hackett
c99fdccab3 Fix autoreconnect test. 2014-06-08 17:20:54 -07:00
Bernie Hackett
3a023abf4e PYTHON-705 - Fix python 3.2 support. 2014-06-08 17:00:55 -07:00
Bernie Hackett
48ffdb0c62 PYTHON-705 - Fix Bulk API legacy upsert _id compatibility
Versions of MongoDB previous to 2.6 only return the upserted
field for an upsert operation if the _id value is an ObjectId.
This patch works around that issue to ensure nUpserted counts
are correct regardless of server version.
2014-06-08 16:38:33 -07:00
Luke Lovett
7e90881d96 PYTHON-681 All requests with w=0 must be wrapped in client.start_request() in the tests when using the shared client 2014-05-21 23:30:45 +00:00
Luke Lovett
e8d44cf6c4 PYTHON-681 Make sure forceerror command and subsequent calls to error() and previous_error() happen on same socket in tests 2014-05-21 22:39:11 +00:00
Luke Lovett
26fb43cf78 PYTHON-681 Reuse MongoClient whenever possible in the tests 2014-05-21 20:41:18 +00:00
Bernie Hackett
cccecff1e9 PYTHON-697 - Fix upsert _id backward compatibility 2014-05-20 11:31:36 -07:00
Bernie Hackett
e005eeda9e Primary -> PRIMARY 2014-05-16 16:13:02 -07:00
Bernie Hackett
10b0622bce PYTHON-698 - Try encoding types with broken __getattr__ methods 2014-05-16 16:07:53 -07:00
Bernie Hackett
9a8d1f6763 Fix an aggregation test. 2014-05-12 16:36:10 -07:00
Bernie Hackett
69b430ac73 Fix a few tests for MongoDB 2.7.0 2014-05-12 14:16:59 -07:00
Bernie Hackett
8978f7fe74 PYTHON-526 - Remaining test fixes. 2014-05-02 15:51:08 -07:00
Bernie Hackett
becc359cad Various fixes for auth tests with old mongos versions. 2014-05-02 15:24:32 -07:00
Luke Lovett
352a5f6231 Move test module-wide setup and teardown to a custom TestRunner class 2014-05-02 20:46:21 +00:00
Bernie Hackett
b8ba0bddae Fix a few tests with really old mongos versions. 2014-05-01 19:33:21 -07:00
Bernie Hackett
797f946758 PYTHON-696 - Fix remove_user for old mongos versions. 2014-05-01 15:44:31 -07:00
Bernie Hackett
9581d24ec3 PYTHON-696 - Fix user and index creation with old mongos versions. 2014-05-01 14:40:29 -07:00
Luke Lovett
a679840cdc The 'test' command in setup.py should use exit status to communicate test pass/failure 2014-05-01 21:00:43 +00:00
Jaroslav Semančík
687a1f41bf Added Jaroslav Semančík (girogiro) to contributors 2014-05-01 11:31:54 -07:00
Jaroslav Semančík
b362cc3454 Fixed wrong Python object name for UTC 2014-05-01 11:31:54 -07:00
Bernie Hackett
e6147ab72b PYTHON-667 - Clarify drop_index behavior when an index does not exist. 2014-05-01 10:52:51 -07:00
Bernie Hackett
a1e05e1300 PYTHON-690 - Various fixes to indexing docstrings. 2014-05-01 10:18:42 -07:00
Luke Lovett
95e3d2aa4a PYTHON-680 Add new test command to setup.py in order to avoid DeprecationWarning when raising SkipTest
The setuptools 'test' command uses the TestResult class from unittest,
even when we're using unittest2 for Python 2.6. Since the old unittest
TestResult class doesn't have an addSkip method, raising SkipTest
causes a DeprecationWarning instead of skipping a test.
2014-05-01 17:03:27 +00:00
Bernie Hackett
fceb009955 PYTHON-691 - Fix UserWarning command issues.
Don't raise UserWarning for helpers and internal calls to
commands that do not obey read preference.
2014-04-29 13:38:21 -07:00
Bernie Hackett
b94298b202 PYTHON-685 - Fix rare resource leak in _cmessage 2014-04-29 13:30:26 -07:00
Bernie Hackett
645fc3a65c PYTHON-684 - Ignore wnote/jnote from legacy servers.
Stop unnecessarily raising OperationFailure in the Bulk API
when a pre-2.6 server returns a result with a wnote or jnote
field.
2014-04-29 12:19:21 -07:00
Bernie Hackett
572c3fada5 Always raise warnings in tests. 2014-04-28 13:04:56 -07:00
behackett
86c0df0341 Use catch_warnings to test warnings. 2014-04-28 11:49:50 -07:00
Luke Lovett
327fdaa560 PYTHON-680 Remove all references to nose 2014-04-28 18:06:27 +00:00
Luke Lovett
141200083e PYTHON-680 Stop using nose in favor of pure unittest/unittest2 2014-04-25 22:57:33 +00:00
Bernie Hackett
2b79325d3b PYTHON-686 - Remove a bunch of references to 2.4 and 2.5 2014-04-24 12:40:29 -07:00
A. Jesse Jiryu Davis
619924d05f Remove mod_wsgi test client's dependency on py3compat. 2014-04-24 15:07:16 -04:00
A. Jesse Jiryu Davis
f524e723e4 Explain how to test PyMongo with mod_wsgi. 2014-04-24 15:07:16 -04:00
Bernie Hackett
939fe8ec70 Remove workaround for python issue7380.
The bug was fixed in python 3.1, which we no longer support.
2014-04-24 11:58:59 -07:00
Bernie Hackett
0a55f923c4 PYTHON-686 - Finish updating docs related to python 3.
Mostly removing references to 2to3, which we no longer use.
2014-04-24 10:35:20 -07:00
Bernie Hackett
b26459cd6a Remove useless uuid module checks.
These were only needed for python 2.4 which does
not provide a uuid module.
2014-04-24 10:09:21 -07:00
Bernie Hackett
bd8d4a3b10 PYTHON-673 - Use bytes and remove binary_type
The binary_type alias was added to support python
2.4 and 2.5, which we no longer support.
2014-04-23 13:25:00 -07:00
Bernie Hackett
91d6b5b5d4 PYTHON-676 - Use bytes instead of binary_type 2014-04-23 13:24:16 -07:00
Bernie Hackett
35410a22e3 PYTHON-675 - Use bytes instead of binary_type 2014-04-23 13:22:57 -07:00
Luke Lovett
4d6d1e067b PYTHON-676 python 2/3 single-source for the test module 2014-04-23 18:37:02 +00:00
Luke Lovett
69ce42c5a0 PYTHON-675 python 2/3 single-source for the gridfs module 2014-04-23 18:37:02 +00:00
Luke Lovett
d494105aa4 PYTHON-674 python 2/3 single-source for the pymongo module 2014-04-23 18:26:18 +00:00
Bernie Hackett
f5c71a5376 PYTHON-672 - Add __ne__ to read preferences 2014-04-22 17:31:26 -07:00
Bernie Hackett
2e4259f333 PYTHON-673 - Fix a json_util issue in python 3.x 2014-04-22 13:34:37 -07:00
Bernie Hackett
0e9f6692f1 PYTHON-673 - Add a few things back to py3compat temporarily 2014-04-22 13:14:42 -07:00
Bernie Hackett
99e792b6be PYTHON-677 - Update docstrings. 2014-04-22 10:32:24 -07:00
Bernie Hackett
4704bb8eb1 PYTHON-677 - Switch internals to new WriteConcern class 2014-04-21 17:13:04 -07:00
Luke Lovett
d4a94d30fd PYTHON-673 python 2/3 single-source for the bson module 2014-04-17 21:29:15 +00:00
behackett
e0b52baf8e PYTHON-672 - Make read preference a class
This commit introduces the following changes:

- Each read preference is now a class.
- Read preferences other than Primary accept a tag_sets parameter.
- The tag_sets attribute of MongoClient, Database, and Collection has
  been removed. Use the tag_sets parameter of the new classes instead.
- The read_preferences.ReadPreference constant still exists and should
continue to work as expected for most users.
2014-04-14 16:28:07 -07:00
Bernie Hackett
2f86207246 PYTHON-526 secondaryAcceptableLatencyMS changes.
- Renamed to acceptableLatencyMS since it is also used
in choosing a new mongos during mongos HA failover.
- Moved to a global immutable setting. The expectation is
that the value would be determined by a network/system
admin. Changing it per operation doesn't make a lot of
sense.

Note - it's possible the name of this option may change again
before 3.0 is released.
2014-04-08 15:27:18 -07:00
Bernie Hackett
9404ff1f12 PYTHON-525 Remove (_must)_use_master.
Left over from MasterSlaveConnection.
2014-04-07 08:31:27 -07:00
behackett
de23b63994 PYTHON-526 Remove get/set/unset_lasterror_options
Use <object>.write_concern instead.
2014-04-05 12:27:38 -07:00
Bernie Hackett
37abda5e25 PYTHON-525 Remove MasterSlaveConnection
MongoDB master/slave clusters are deprecated. Use replica
sets instead. If you must use this client class the 2.x
branch of PyMongo will continue to be maintained for some
time.
2014-04-05 10:38:51 -07:00
Bernie Hackett
814434c1b2 PYTHON-526 Remove the network_timeout query option.
This was always a misguided feature. Using a socket timeout
to "timeout" MongoDB queries is awful for a few reasons:

- It leaves the query running on the server, wasting resources.
- It causes a socket to be closed and discarded unnecessarily.
- Applications that use this tend to immediately retry the query,
often causing another timeout and more wasted resources.

There are three remaining ways to use timeouts with PyMongo:

- connectTimeoutMS - Global setting for timing out a socket's
initial connection to the server.
- socketTimeoutMS - Global setting for timing out any socket
operation. *Do not* use this to enforce time limits on server
side operations.
- max_time_ms (or maxTimeoutMS as a command kwarg) - MongoDB 2.6
server side timebomb for queries and commands. This is a server
side option, passed along with a query or command, that causes
MongoDB to abort the operation if it takes longer than the specified
limit.
2014-04-05 09:59:38 -07:00
Bernie Hackett
85db128efd PYTHON-526 Remove the "safe" option.
Use w=0 for unacknowledged write operations.
2014-04-04 17:15:50 -07:00
Bernie Hackett
e08aa1f90d PYTHON-525 Remove (ReplicaSet)Connection.
Use MongoClient or MongoReplicaSetClient instead.
2014-04-04 16:56:25 -07:00
Bernie Hackett
48a65eb9c1 PYTHON-526 Drop support for slaveOk/slave_okay.
Use any ReadPreference other than PRIMARY instead.
2014-04-04 16:37:32 -07:00
Bernie Hackett
d2cde8719a PYTHON-665 Drop support for Python 2.4, 2.5, and 3.1
If you need to continue to use any of these Python versions with MongoDB
the 2.x branch of PyMongo will continue to be minimally maintained for
some time.
2014-04-04 16:14:21 -07:00
Bernie Hackett
c9f0e89127 Version -> dev0
For 3.0 we'll start using PEP 386/440 compliant version
numbers instead of semantic versioning +.
2014-04-04 14:18:53 -07:00
2120 changed files with 598511 additions and 37565 deletions

4
.codecov.yml Normal file
View File

@ -0,0 +1,4 @@
# do not notify until at least 100 builds have been uploaded from the CI pipeline
# you can also set after_n_builds on comments independently
comment:
after_n_builds: 100

16
.evergreen/combine-coverage.sh Executable file
View File

@ -0,0 +1,16 @@
#!/bin/bash
#
# Coverage combine merges (and removes) all the coverage files and
# generates a new .coverage file in the current directory.
set -eu
# Set up the virtual env.
. .evergreen/scripts/setup-dev-env.sh
uv sync --group coverage
source .venv/bin/activate
ls -la coverage/
coverage combine coverage/coverage.*
coverage html -d htmlcov

65
.evergreen/config.yml Normal file
View File

@ -0,0 +1,65 @@
########################################
# Evergreen Template for MongoDB Drivers
########################################
# When a task that used to pass starts to fail
# Go through all versions that may have been skipped to detect
# when the task started failing
stepback: true
# Mark a failure as a system/bootstrap failure (purple box) rather then a task
# failure by default.
# Actual testing tasks are marked with `type: test`
command_type: system
# Protect ourselves against rogue test case, or curl gone wild, that runs forever
# Good rule of thumb: the averageish length a task takes, times 5
# That roughly accounts for variable system performance for various buildvariants
exec_timeout_secs: 3600 # 60 minutes is the longest we'll ever run (primarily
# for macos hosts)
# What to do when evergreen hits the timeout (`post:` tasks are run automatically)
timeout:
- command: subprocess.exec
params:
binary: ls -la
include:
- filename: .evergreen/generated_configs/functions.yml
- filename: .evergreen/generated_configs/tasks.yml
- filename: .evergreen/generated_configs/variants.yml
pre:
- func: "fetch source"
- func: "setup system"
- func: "assume ec2 role"
post:
# Disabled, causing timeouts
# - func: "upload working dir"
- func: "teardown system"
- func: "upload codecov"
- func: "upload coverage"
- func: "upload mo artifacts"
- func: "upload test results"
- func: "cleanup"
tasks:
- name: resync_specs
commands:
- command: subprocess.exec
params:
binary: bash
include_expansions_in_env: [AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_SESSION_TOKEN]
args:
- .evergreen/scripts/resync-all-specs.sh
working_dir: src
buildvariants:
- name: resync_specs
display_name: "Resync Specs"
run_on: rhel80-small
cron: '0 16 * * MON'
patchable: true
tasks:
- name: resync_specs

View File

@ -0,0 +1,343 @@
functions:
# Assume ec2 role
assume ec2 role:
- command: ec2.assume_role
params:
role_arn: ${aws_test_secrets_role}
duration_seconds: 3600
# Attach benchmark test results
attach benchmark test results:
- command: attach.results
params:
file_location: src/report.json
# Cleanup
cleanup:
- command: subprocess.exec
params:
binary: bash
args:
- .evergreen/scripts/cleanup.sh
working_dir: src
type: test
# Download and merge coverage
download and merge coverage:
- command: ec2.assume_role
params:
role_arn: ${assume_role_arn}
type: setup
- command: subprocess.exec
params:
binary: bash
args:
- .evergreen/scripts/download-and-merge-coverage.sh
- ${bucket_name}
- ${revision}
- ${version_id}
working_dir: src
silent: true
include_expansions_in_env:
- AWS_ACCESS_KEY_ID
- AWS_SECRET_ACCESS_KEY
- AWS_SESSION_TOKEN
type: test
- command: subprocess.exec
params:
binary: bash
args:
- .evergreen/combine-coverage.sh
working_dir: src
type: test
- command: subprocess.exec
params:
binary: bash
args:
- .evergreen/scripts/upload-coverage-report.sh
- ${bucket_name}
- ${revision}
- ${version_id}
working_dir: src
silent: true
include_expansions_in_env:
- AWS_ACCESS_KEY_ID
- AWS_SECRET_ACCESS_KEY
- AWS_SESSION_TOKEN
type: test
- command: s3.put
params:
remote_file: coverage/${revision}/${version_id}/htmlcov/index.html
aws_key: ${AWS_ACCESS_KEY_ID}
aws_secret: ${AWS_SECRET_ACCESS_KEY}
aws_session_token: ${AWS_SESSION_TOKEN}
bucket: ${bucket_name}
local_file: src/htmlcov/index.html
permissions: public-read
content_type: text/html
display_name: Coverage Report HTML
optional: "true"
type: setup
# Fetch source
fetch source:
- command: git.get_project
params:
directory: src
# Run server
run server:
- command: subprocess.exec
params:
binary: bash
args:
- .evergreen/just.sh
- run-server
- ${TEST_NAME}
working_dir: src
include_expansions_in_env:
- VERSION
- TOPOLOGY
- AUTH
- SSL
- ORCHESTRATION_FILE
- UV_PYTHON
- TOOLCHAIN_VERSION
- STORAGE_ENGINE
- REQUIRE_API_VERSION
- DRIVERS_TOOLS
- TEST_CRYPT_SHARED
- AUTH_AWS
- LOAD_BALANCER
- LOCAL_ATLAS
- NO_EXT
type: test
- command: expansions.update
params:
file: ${DRIVERS_TOOLS}/mo-expansion.yml
# Run tests
run tests:
- command: subprocess.exec
params:
binary: bash
args:
- .evergreen/just.sh
- setup-tests
- ${TEST_NAME}
- ${SUB_TEST_NAME}
working_dir: src
include_expansions_in_env:
- AUTH
- SSL
- AWS_ACCESS_KEY_ID
- AWS_SECRET_ACCESS_KEY
- AWS_SESSION_TOKEN
- COVERAGE
- UV_PYTHON
- LIBMONGOCRYPT_URL
- MONGODB_URI
- TOOLCHAIN_VERSION
- DISABLE_TEST_COMMANDS
- GREEN_FRAMEWORK
- NO_EXT
- COMPRESSORS
- MONGODB_API_VERSION
- REQUIRE_API_VERSION
- DEBUG_LOG
- DISABLE_FLAKY
- ORCHESTRATION_FILE
- OCSP_SERVER_TYPE
- VERSION
- IS_WIN32
- REQUIRE_FIPS
- TEST_MIN_DEPS
type: test
- command: subprocess.exec
params:
binary: bash
args:
- .evergreen/just.sh
- run-tests
working_dir: src
type: test
# Send dashboard data
send dashboard data:
- command: subprocess.exec
params:
binary: bash
args:
- .evergreen/scripts/perf-submission-setup.sh
working_dir: src
include_expansions_in_env:
- requester
- revision_order_id
- project_id
- version_id
- build_variant
- parsed_order_id
- task_name
- task_id
- execution
- is_mainline
type: test
- command: expansions.update
params:
file: src/expansion.yml
- command: subprocess.exec
params:
binary: bash
args:
- .evergreen/scripts/perf-submission.sh
working_dir: src
include_expansions_in_env:
- requester
- revision_order_id
- project_id
- version_id
- build_variant
- parsed_order_id
- task_name
- task_id
- execution
- is_mainline
type: test
# Setup system
setup system:
- command: subprocess.exec
params:
binary: bash
args:
- .evergreen/scripts/setup-system.sh
working_dir: src
include_expansions_in_env:
- is_patch
- project
- version_id
type: test
- command: expansions.update
params:
file: src/expansion.yml
# Teardown system
teardown system:
- command: subprocess.exec
params:
binary: bash
args:
- .evergreen/just.sh
- teardown-tests
working_dir: src
type: test
- command: subprocess.exec
params:
binary: bash
args:
- ${DRIVERS_TOOLS}/.evergreen/teardown.sh
working_dir: src
type: test
# Test numpy
test numpy:
- command: subprocess.exec
params:
binary: bash
args:
- .evergreen/just.sh
- test-numpy
working_dir: src
include_expansions_in_env:
- TOOLCHAIN_VERSION
- COVERAGE
type: test
# Upload coverage codecov
upload codecov:
- command: subprocess.exec
params:
binary: bash
args:
- .evergreen/scripts/upload-codecov.sh
working_dir: src
include_expansions_in_env:
- CODECOV_TOKEN
- build_variant
- task_name
- github_commit
- github_pr_number
- github_pr_head_branch
- github_author
- requester
- branch_name
type: test
# Upload coverage
upload coverage:
- command: ec2.assume_role
params:
role_arn: ${assume_role_arn}
type: setup
- command: s3.put
params:
remote_file: coverage/${revision}/${version_id}/coverage/coverage.${build_variant}.${task_name}
aws_key: ${AWS_ACCESS_KEY_ID}
aws_secret: ${AWS_SECRET_ACCESS_KEY}
aws_session_token: ${AWS_SESSION_TOKEN}
bucket: ${bucket_name}
local_file: src/.coverage
permissions: public-read
content_type: text/html
display_name: Raw Coverage Report
optional: "true"
type: setup
# Upload mo artifacts
upload mo artifacts:
- command: ec2.assume_role
params:
role_arn: ${assume_role_arn}
type: setup
- command: archive.targz_pack
params:
target: mongo-coredumps.tgz
source_dir: ./
include:
- ./**.core
- ./**.mdmp
- command: s3.put
params:
remote_file: ${build_variant}/${revision}/${version_id}/${build_id}/coredumps/${task_id}-${execution}-mongodb-coredumps.tar.gz
aws_key: ${AWS_ACCESS_KEY_ID}
aws_secret: ${AWS_SECRET_ACCESS_KEY}
aws_session_token: ${AWS_SESSION_TOKEN}
bucket: ${bucket_name}
local_file: mongo-coredumps.tgz
permissions: public-read
content_type: ${content_type|application/x-gzip}
display_name: Core Dumps - Execution
optional: "true"
type: setup
- command: s3.put
params:
remote_file: ${build_variant}/${revision}/${version_id}/${build_id}/logs/${task_id}-${execution}-drivers-tools-logs.tar.gz
aws_key: ${AWS_ACCESS_KEY_ID}
aws_secret: ${AWS_SECRET_ACCESS_KEY}
aws_session_token: ${AWS_SESSION_TOKEN}
bucket: ${bucket_name}
local_file: ${DRIVERS_TOOLS}/.evergreen/test_logs.tar.gz
permissions: public-read
content_type: ${content_type|application/x-gzip}
display_name: drivers-tools-logs.tar.gz
optional: "true"
type: setup
# Upload test results
upload test results:
- command: attach.results
params:
file_location: ${DRIVERS_TOOLS}/results.json
- command: attach.xunit_results
params:
file: src/xunit-results/TEST-*.xml

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,680 @@
buildvariants:
# Alternative hosts tests
- name: other-hosts-rhel9-fips-latest
tasks:
- name: .test-no-toolchain
display_name: Other hosts RHEL9-FIPS latest
run_on:
- rhel92-fips
batchtime: 1440
expansions:
VERSION: latest
NO_EXT: "1"
REQUIRE_FIPS: "1"
UV_PYTHON: /usr/bin/python3.11
tags: []
- name: other-hosts-rhel8-zseries-latest
tasks:
- name: .test-no-toolchain
display_name: Other hosts RHEL8-zseries latest
run_on:
- rhel8-zseries-small
batchtime: 1440
expansions:
VERSION: latest
NO_EXT: "1"
tags: []
- name: other-hosts-rhel8-power8-latest
tasks:
- name: .test-no-toolchain
display_name: Other hosts RHEL8-POWER8 latest
run_on:
- rhel8-power-small
batchtime: 1440
expansions:
VERSION: latest
NO_EXT: "1"
tags: []
- name: other-hosts-rhel8-arm64-latest
tasks:
- name: .test-no-toolchain
display_name: Other hosts RHEL8-arm64 latest
run_on:
- rhel82-arm64-small
batchtime: 1440
expansions:
VERSION: latest
NO_EXT: "1"
tags: []
- name: other-hosts-amazon2023-latest
tasks:
- name: .test-no-toolchain
display_name: Other hosts Amazon2023 latest
run_on:
- amazon2023-arm64-latest-large-m8g
batchtime: 1440
expansions:
VERSION: latest
NO_EXT: "1"
tags: [pr]
# Atlas connect tests
- name: atlas-connect-rhel8
tasks:
- name: .test-no-orchestration
display_name: Atlas connect RHEL8
run_on:
- rhel87-small
expansions:
TEST_NAME: atlas_connect
tags: [pr]
# Aws auth tests
- name: auth-aws-rhel8
tasks:
- name: .auth-aws
display_name: Auth AWS RHEL8
run_on:
- rhel87-small
tags: []
- name: auth-aws-win64
tasks:
- name: .auth-aws
display_name: Auth AWS Win64
run_on:
- windows-2022-latest-small
tags: []
- name: auth-aws-macos
tasks:
- name: .auth-aws !.auth-aws-web-identity !.auth-aws-ec2
display_name: Auth AWS macOS
run_on:
- macos-14
tags: [pr]
- name: auth-aws-ecs-macos
tasks:
- name: .auth-aws-ecs
display_name: Auth AWS ECS macOS
run_on:
- ubuntu2404-small
tags: [pr]
# Aws lambda tests
- name: faas-lambda
tasks:
- name: .aws_lambda
display_name: FaaS Lambda
run_on:
- rhel87-small
# Backport pr tests
- name: backport-pr
tasks:
- name: backport-pr
display_name: Backport PR
run_on:
- rhel87-small
# Compression tests
- name: compression-snappy-rhel8
tasks:
- name: .test-standard
display_name: Compression snappy RHEL8
run_on:
- rhel87-small
expansions:
COMPRESSOR: snappy
- name: compression-zlib-rhel8
tasks:
- name: .test-standard
display_name: Compression zlib RHEL8
run_on:
- rhel87-small
expansions:
COMPRESSOR: zlib
- name: compression-zstd-rhel8
tasks:
- name: .test-standard !.server-4.2
display_name: Compression zstd RHEL8
run_on:
- rhel87-small
expansions:
COMPRESSOR: zstd
- name: compression-zstd-ubuntu-22
tasks:
- name: .test-standard !.server-4.2 !.server-4.4 !.server-5.0 .python-3.14
- name: .test-standard !.server-4.2 !.server-4.4 !.server-5.0 .python-3.14t
display_name: Compression zstd Ubuntu-22
run_on:
- ubuntu2204-small
expansions:
COMPRESSOR: ztsd
# Coverage report tests
- name: coverage-report
tasks:
- name: coverage-report
display_name: Coverage Report
run_on:
- rhel87-small
# Disable test commands tests
- name: disable-test-commands-rhel8
tasks:
- name: .test-standard .server-latest
display_name: Disable test commands RHEL8
run_on:
- rhel87-small
expansions:
AUTH: auth
SSL: ssl
DISABLE_TEST_COMMANDS: "1"
# Doctests tests
- name: doctests-rhel8
tasks:
- name: .test-non-standard .standalone-noauth-nossl
display_name: Doctests RHEL8
run_on:
- rhel87-small
expansions:
TEST_NAME: doctest
# Encryption tests
- name: encryption-rhel8
tasks:
- name: .test-non-standard
display_name: Encryption RHEL8
run_on:
- rhel87-small
batchtime: 1440
expansions:
TEST_NAME: encryption
tags: [encryption_tag]
- name: encryption-macos
tasks:
- name: .test-non-standard !.pypy
display_name: Encryption macOS
run_on:
- macos-14
batchtime: 1440
expansions:
TEST_NAME: encryption
tags: [encryption_tag]
- name: encryption-win64
tasks:
- name: .test-non-standard !.pypy
display_name: Encryption Win64
run_on:
- windows-2022-latest-small
batchtime: 1440
expansions:
TEST_NAME: encryption
tags: [encryption_tag]
- name: encryption-crypt_shared-rhel8
tasks:
- name: .test-non-standard
display_name: Encryption crypt_shared RHEL8
run_on:
- rhel87-small
batchtime: 1440
expansions:
TEST_NAME: encryption
TEST_CRYPT_SHARED: "true"
tags: [encryption_tag]
- name: encryption-crypt_shared-macos
tasks:
- name: .test-non-standard !.pypy
display_name: Encryption crypt_shared macOS
run_on:
- macos-14
batchtime: 1440
expansions:
TEST_NAME: encryption
TEST_CRYPT_SHARED: "true"
tags: [encryption_tag]
- name: encryption-crypt_shared-win64
tasks:
- name: .test-non-standard !.pypy
display_name: Encryption crypt_shared Win64
run_on:
- windows-2022-latest-small
batchtime: 1440
expansions:
TEST_NAME: encryption
TEST_CRYPT_SHARED: "true"
tags: [encryption_tag]
- name: encryption-pyopenssl-rhel8
tasks:
- name: .test-non-standard
display_name: Encryption PyOpenSSL RHEL8
run_on:
- rhel87-small
batchtime: 1440
expansions:
TEST_NAME: encryption
SUB_TEST_NAME: pyopenssl
tags: [encryption_tag]
# Enterprise auth tests
- name: auth-enterprise-rhel8
tasks:
- name: .test-standard-auth .auth !.free-threaded
display_name: Auth Enterprise RHEL8
run_on:
- rhel87-small
expansions:
TEST_NAME: enterprise_auth
AUTH: auth
- name: auth-enterprise-macos
tasks:
- name: .test-standard-auth !.pypy .auth !.free-threaded
display_name: Auth Enterprise macOS
run_on:
- macos-14
expansions:
TEST_NAME: enterprise_auth
AUTH: auth
- name: auth-enterprise-win64
tasks:
- name: .test-standard-auth !.pypy .auth !.free-threaded
display_name: Auth Enterprise Win64
run_on:
- windows-2022-latest-small
expansions:
TEST_NAME: enterprise_auth
AUTH: auth
# Green framework tests
- name: green-gevent-rhel8
tasks:
- name: .test-standard .sync !.free-threaded
display_name: Green Gevent RHEL8
run_on:
- rhel87-small
expansions:
GREEN_FRAMEWORK: gevent
# Import time tests
- name: import-time
tasks:
- name: check-import-time
display_name: Import Time
run_on:
- rhel87-small
# Kms tests
- name: kms
tasks:
- name: test-gcpkms
batchtime: 1440
- name: test-gcpkms-fail
- name: test-azurekms
batchtime: 1440
- name: test-azurekms-fail
display_name: KMS
run_on:
- debian11-small
# Load balancer tests
- name: load-balancer
tasks:
- name: .test-non-standard .server-6.0 .sharded_cluster-auth-ssl
- name: .test-non-standard .server-7.0 .sharded_cluster-auth-ssl
- name: .test-non-standard .server-8.0 .sharded_cluster-auth-ssl
- name: .test-non-standard .server-rapid .sharded_cluster-auth-ssl
- name: .test-non-standard .server-latest .sharded_cluster-auth-ssl
display_name: Load Balancer
run_on:
- rhel87-small
batchtime: 1440
expansions:
TEST_NAME: load_balancer
# Min support tests
- name: min-support-rhel8
tasks:
- name: .test-min-support
display_name: Min Support RHEL8
run_on:
- rhel87-small
# Mockupdb tests
- name: mockupdb-rhel8
tasks:
- name: .test-no-orchestration
display_name: MockupDB RHEL8
run_on:
- rhel87-small
expansions:
TEST_NAME: mockupdb
tags: [pr]
# Mod wsgi tests
- name: mod_wsgi-ubuntu-22
tasks:
- name: .mod_wsgi
display_name: Mod_WSGI Ubuntu-22
run_on:
- ubuntu2204-small
expansions:
MOD_WSGI_VERSION: "4"
# No c ext tests
- name: no-c-ext-rhel8
tasks:
- name: .test-standard
display_name: No C Ext RHEL8
run_on:
- rhel87-small
expansions:
NO_EXT: "1"
# No server tests
- name: no-server-rhel8
tasks:
- name: .test-no-orchestration
display_name: No server RHEL8
run_on:
- rhel87-small
tags: [pr]
# Ocsp tests
- name: ocsp-rhel8
tasks:
- name: .ocsp
display_name: OCSP RHEL8
run_on:
- rhel87-small
batchtime: 10080
- name: ocsp-win64
tasks:
- name: .ocsp-rsa !.ocsp-staple .latest
- name: .ocsp-rsa !.ocsp-staple .4.4
display_name: OCSP Win64
run_on:
- windows-2022-latest-small
batchtime: 10080
- name: ocsp-macos
tasks:
- name: .ocsp-rsa !.ocsp-staple .latest
- name: .ocsp-rsa !.ocsp-staple .4.4
display_name: OCSP macOS
run_on:
- macos-14
batchtime: 10080
# Oidc auth tests
- name: auth-oidc-ubuntu-22
tasks:
- name: .auth_oidc_remote
display_name: Auth OIDC Ubuntu-22
run_on:
- ubuntu2204-small
batchtime: 1440
- name: auth-oidc-local-ubuntu-22
tasks:
- name: "!.auth_oidc_remote .auth_oidc"
display_name: Auth OIDC Local Ubuntu-22
run_on:
- ubuntu2204-small
batchtime: 1440
expansions:
COVERAGE: "1"
tags: [pr]
- name: auth-oidc-macos
tasks:
- name: "!.auth_oidc_remote .auth_oidc"
display_name: Auth OIDC macOS
run_on:
- macos-14
batchtime: 1440
- name: auth-oidc-win64
tasks:
- name: "!.auth_oidc_remote .auth_oidc"
display_name: Auth OIDC Win64
run_on:
- windows-2022-latest-small
batchtime: 1440
# Perf tests
- name: performance-benchmarks
tasks:
- name: .perf
display_name: Performance Benchmarks
run_on:
- rhel90-dbx-perf-large
batchtime: 1440
# Pyopenssl tests
- name: pyopenssl-rhel8
tasks:
- name: .test-standard .sync
- name: .test-standard .async .replica_set-noauth-ssl
display_name: PyOpenSSL RHEL8
run_on:
- rhel87-small
batchtime: 1440
expansions:
SUB_TEST_NAME: pyopenssl
- name: pyopenssl-macos
tasks:
- name: .test-standard !.pypy .sync
- name: .test-standard !.pypy .async .replica_set-noauth-ssl
display_name: PyOpenSSL macOS
run_on:
- rhel87-small
batchtime: 1440
expansions:
SUB_TEST_NAME: pyopenssl
- name: pyopenssl-win64
tasks:
- name: .test-standard !.pypy .sync
- name: .test-standard !.pypy .async .replica_set-noauth-ssl
display_name: PyOpenSSL Win64
run_on:
- windows-2022-latest-small
batchtime: 1440
expansions:
SUB_TEST_NAME: pyopenssl
# Search index tests
- name: search-index-helpers-rhel8
tasks:
- name: .search_index
display_name: Search Index Helpers RHEL8
run_on:
- rhel87-small
# Server version tests
- name: mongodb-v4.2
tasks:
- name: .server-version
display_name: "* MongoDB v4.2"
run_on:
- rhel87-small
expansions:
VERSION: "4.2"
tags: [coverage_tag]
- name: mongodb-v4.4
tasks:
- name: .server-version
display_name: "* MongoDB v4.4"
run_on:
- rhel87-small
expansions:
VERSION: "4.4"
tags: [coverage_tag]
- name: mongodb-v5.0
tasks:
- name: .server-version
display_name: "* MongoDB v5.0"
run_on:
- rhel87-small
expansions:
VERSION: "5.0"
tags: [coverage_tag]
- name: mongodb-v6.0
tasks:
- name: .server-version
display_name: "* MongoDB v6.0"
run_on:
- rhel87-small
expansions:
VERSION: "6.0"
tags: [coverage_tag]
- name: mongodb-v7.0
tasks:
- name: .server-version
display_name: "* MongoDB v7.0"
run_on:
- rhel87-small
expansions:
VERSION: "7.0"
tags: [coverage_tag]
- name: mongodb-v8.0
tasks:
- name: .server-version
display_name: "* MongoDB v8.0"
run_on:
- rhel87-small
expansions:
VERSION: "8.0"
tags: [coverage_tag]
- name: mongodb-rapid
tasks:
- name: .server-version
display_name: "* MongoDB rapid"
run_on:
- rhel87-small
expansions:
VERSION: rapid
tags: [coverage_tag]
- name: mongodb-latest
tasks:
- name: .server-version
display_name: "* MongoDB latest"
run_on:
- rhel87-small
expansions:
VERSION: latest
tags: [coverage_tag]
# Stable api tests
- name: stable-api-require-v1-rhel8-auth
tasks:
- name: .test-standard !.replica_set-noauth-ssl .server-5.0
- name: .test-standard !.replica_set-noauth-ssl .server-6.0
- name: .test-standard !.replica_set-noauth-ssl .server-7.0
- name: .test-standard !.replica_set-noauth-ssl .server-8.0
- name: .test-standard !.replica_set-noauth-ssl .server-rapid
- name: .test-standard !.replica_set-noauth-ssl .server-latest
display_name: Stable API require v1 RHEL8 Auth
run_on:
- rhel87-small
expansions:
AUTH: auth
REQUIRE_API_VERSION: "1"
MONGODB_API_VERSION: "1"
tags: [versionedApi_tag]
- name: stable-api-accept-v2-rhel8-auth
tasks:
- name: .test-standard .server-5.0 .standalone-noauth-nossl
- name: .test-standard .server-6.0 .standalone-noauth-nossl
- name: .test-standard .server-7.0 .standalone-noauth-nossl
- name: .test-standard .server-8.0 .standalone-noauth-nossl
- name: .test-standard .server-rapid .standalone-noauth-nossl
- name: .test-standard .server-latest .standalone-noauth-nossl
display_name: Stable API accept v2 RHEL8 Auth
run_on:
- rhel87-small
expansions:
AUTH: auth
ORCHESTRATION_FILE: versioned-api-testing.json
tags: [versionedApi_tag]
# Standard nonlinux tests
- name: test-macos
tasks:
- name: .test-standard !.pypy
display_name: "* Test macOS"
run_on:
- macos-14
tags: [standard-non-linux]
- name: test-macos-arm64
tasks:
- name: .test-standard !.pypy .server-6.0
- name: .test-standard !.pypy .server-7.0
- name: .test-standard !.pypy .server-8.0
- name: .test-standard !.pypy .server-rapid
- name: .test-standard !.pypy .server-latest
display_name: "* Test macOS Arm64"
run_on:
- macos-14-arm64
tags: [standard-non-linux]
- name: test-win64
tasks:
- name: .test-standard !.pypy
- name: .test-no-orchestration !.pypy
display_name: "* Test Win64"
run_on:
- windows-2022-latest-small
tags: [standard-non-linux]
- name: test-win32
tasks:
- name: .test-standard !.pypy
display_name: "* Test Win32"
run_on:
- windows-64-vsMulti-small
expansions:
IS_WIN32: "1"
tags: [standard-non-linux]
# Storage engine tests
- name: storage-inmemory-rhel8
tasks:
- name: .test-standard .standalone-noauth-nossl
display_name: Storage InMemory RHEL8
run_on:
- rhel87-small
expansions:
STORAGE_ENGINE: inmemory
# Test numpy tests
- name: test-numpy-rhel8
tasks:
- name: .test-numpy
display_name: Test Numpy RHEL8
run_on:
- rhel87-small
tags: [binary, vector, pr]
- name: test-numpy-macos
tasks:
- name: .test-numpy
display_name: Test Numpy macOS
run_on:
- macos-14
tags: [binary, vector]
- name: test-numpy-macos-arm64
tasks:
- name: .test-numpy
display_name: Test Numpy macOS Arm64
run_on:
- macos-14-arm64
tags: [binary, vector]
- name: test-numpy-win64
tasks:
- name: .test-numpy
display_name: Test Numpy Win64
run_on:
- windows-2022-latest-small
tags: [binary, vector]
- name: test-numpy-win32
tasks:
- name: .test-numpy
display_name: Test Numpy Win32
run_on:
- windows-64-vsMulti-small
expansions:
IS_WIN32: "1"
tags: [binary, vector]

5
.evergreen/just.sh Executable file
View File

@ -0,0 +1,5 @@
#!/bin/bash
set -eu
. .evergreen/scripts/setup-dev-env.sh
just "$@"

View File

@ -0,0 +1,56 @@
#!/bin/bash
PYMONGO=$(dirname "$(cd "$(dirname "$0")" || exit; pwd)")
rm $PYMONGO/test/transactions/legacy/errors-client.json # PYTHON-1894
rm $PYMONGO/test/connection_monitoring/wait-queue-fairness.json # PYTHON-1873
rm $PYMONGO/test/discovery_and_monitoring/unified/pool-clear-application-error.json # PYTHON-4918
rm $PYMONGO/test/discovery_and_monitoring/unified/pool-clear-checkout-error.json # PYTHON-4918
rm $PYMONGO/test/discovery_and_monitoring/unified/pool-clear-min-pool-size-error.json # PYTHON-4918
rm $PYMONGO/test/client-side-encryption/spec/unified/client-bulkWrite-qe.json # PYTHON-4929
# Python doesn't implement DRIVERS-3064
rm $PYMONGO/test/collection_management/listCollections-rawdata.json
rm $PYMONGO/test/crud/unified/aggregate-rawdata.json
rm $PYMONGO/test/crud/unified/bulkWrite-deleteMany-rawdata.json
rm $PYMONGO/test/crud/unified/bulkWrite-deleteOne-rawdata.json
rm $PYMONGO/test/crud/unified/bulkWrite-replaceOne-rawdata.json
rm $PYMONGO/test/crud/unified/bulkWrite-updateMany-rawdata.json
rm $PYMONGO/test/crud/unified/bulkWrite-updateOne-rawdata.json
rm $PYMONGO/test/crud/unified/client-bulkWrite-delete-rawdata.json
rm $PYMONGO/test/crud/unified/client-bulkWrite-replaceOne-rawdata.json
rm $PYMONGO/test/crud/unified/client-bulkWrite-update-rawdata.json
rm $PYMONGO/test/crud/unified/count-rawdata.json
rm $PYMONGO/test/crud/unified/countDocuments-rawdata.json
rm $PYMONGO/test/crud/unified/db-aggregate-rawdata.json
rm $PYMONGO/test/crud/unified/deleteMany-rawdata.json
rm $PYMONGO/test/crud/unified/deleteOne-rawdata.json
rm $PYMONGO/test/crud/unified/distinct-rawdata.json
rm $PYMONGO/test/crud/unified/estimatedDocumentCount-rawdata.json
rm $PYMONGO/test/crud/unified/find-rawdata.json
rm $PYMONGO/test/crud/unified/findOneAndDelete-rawdata.json
rm $PYMONGO/test/crud/unified/findOneAndReplace-rawdata.json
rm $PYMONGO/test/crud/unified/findOneAndUpdate-rawdata.json
rm $PYMONGO/test/crud/unified/insertMany-rawdata.json
rm $PYMONGO/test/crud/unified/insertOne-rawdata.json
rm $PYMONGO/test/crud/unified/replaceOne-rawdata.json
rm $PYMONGO/test/crud/unified/updateMany-rawdata.json
rm $PYMONGO/test/crud/unified/updateOne-rawdata.json
rm $PYMONGO/test/index_management/index-rawdata.json
# PyMongo does not support modifyCollection
rm $PYMONGO/test/collection_management/modifyCollection-*.json
# PYTHON-5248 - Remove support for MongoDB 4.0
find /$PYMONGO/test -type f -name 'pre-42-*.json' -delete
# PYTHON-3359 - Remove Database and Collection level timeout override
rm $PYMONGO/test/csot/override-collection-timeoutMS.json
rm $PYMONGO/test/csot/override-database-timeoutMS.json
# PYTHON-2943 - Socks5 Proxy Support
rm $PYMONGO/test/uri_options/proxy-options.json
# PYTHON-5517 - Avoid clearing the connection pool when the server connection rate limiter triggers
rm $PYMONGO/test/discovery_and_monitoring/unified/backpressure-*.json
echo "Done removing unimplemented tests"

207
.evergreen/resync-specs.sh Executable file
View File

@ -0,0 +1,207 @@
#!/bin/bash
# Resync test files from the specifications repo.
set -eu
PYMONGO=$(dirname "$(cd "$(dirname "$0")"; pwd)")
SPECS=${MDB_SPECS:-~/Work/specifications}
help (){
echo "Usage: resync_specs.sh [-bcsp] spec"
echo "Required arguments:"
echo " spec determines which folder the spec tests will be copied from."
echo "Optional flags:"
echo " -b is used to add a string to the blocklist for that next run. Can be used"
echo " any number of times on a single command to block multiple patterns."
echo " You can use any regex pattern (it is passed to 'grep -Ev')."
echo " -c is used to set a branch or commit that will be checked out in the"
echo " specifications repo before copying."
echo " -s is used to set a unique path to the specs repo for that specific"
echo " run."
echo "Notes:"
echo "You can export the environment variable MDB_SPECS to set the specs"
echo " repo similar to -s, but this will persist between runs until you "
echo "unset it."
}
# Parse flag args
BRANCH=''
BLOCKLIST='.*\.yml'
while getopts 'b:c:s:' flag; do
case "${flag}" in
b) BLOCKLIST+="|$OPTARG"
;;
c) BRANCH="${OPTARG}"
;;
s) SPECS="${OPTARG}"
;;
*) help; exit 0
;;
esac
done
shift $((OPTIND-1))
if [ -n "$BRANCH" ]
then
git -C $SPECS checkout $BRANCH
fi
# Ensure the JSON files are up to date.
if ! [ -n "${CI:-}" ]
then
cd $SPECS/source
make
cd -
fi
# cpjson unified-test-format/tests/invalid unified-test-format/invalid
# * param1: Path to spec tests dir in specifications repo
# * param2: Path to where the corresponding tests live in Python.
cpjson () {
find "$PYMONGO"/test/$2 -type f -delete
cd "$SPECS"/source/$1
find . -name '*.json' | grep -Ev "${BLOCKLIST}" | cpio -pdm \
$PYMONGO/test/$2
printf "\nIgnored files for ${PWD}:\n"
IGNORED_FILES="$(printf "\n%s\n" "$(diff <(find . -name '*.json' | sort) \
<(find . -name '*.json' | grep -Ev "${BLOCKLIST}" | sort))" | \
sed -e '/^[0-9]/d' | sed -e 's|< ./||g' )"
printf "%s\n" $IGNORED_FILES
cd "$PYMONGO"/test/$2
printf "%s\n" $IGNORED_FILES | xargs git checkout master
}
for spec in "$@"
do
# Match the spec dir name, the python test dir name, and/or common abbreviations.
case "$spec" in
auth)
cpjson auth/tests/ auth
;;
bson-binary-vector|bson_binary_vector)
cpjson bson-binary-vector/tests/ bson_binary_vector
;;
bson-corpus|bson_corpus)
cpjson bson-corpus/tests/ bson_corpus
;;
max-staleness|max_staleness)
cpjson max-staleness/tests/ max_staleness
;;
collection-management|collection_management)
cpjson collection-management/tests/ collection_management
;;
connection-string|connection_string)
cpjson connection-string/tests/ connection_string/test
;;
change-streams|change_streams)
cpjson change-streams/tests/ change_streams/
;;
client-backpressure|client_backpressure)
cpjson client-backpressure/tests client-backpressure
;;
client-side-encryption|csfle|fle)
cpjson client-side-encryption/tests/ client-side-encryption/spec
cpjson client-side-encryption/corpus/ client-side-encryption/corpus
cpjson client-side-encryption/external/ client-side-encryption/external
cpjson client-side-encryption/limits/ client-side-encryption/limits
cpjson client-side-encryption/etc/data client-side-encryption/etc/data
;;
connection-monitoring|connection_monitoring)
cpjson connection-monitoring-and-pooling/tests/cmap-format connection_monitoring
;;
connection-logging|connection_logging)
cpjson connection-monitoring-and-pooling/tests/logging connection_logging
;;
cmap|CMAP|connection-monitoring-and-pooling)
cpjson connection-monitoring-and-pooling/tests/logging connection_logging
cpjson connection-monitoring-and-pooling/tests/cmap-format connection_monitoring
;;
apm|APM|command-monitoring|command_monitoring)
cpjson command-logging-and-monitoring/tests/monitoring command_monitoring
;;
command-logging|command_logging)
cpjson command-logging-and-monitoring/tests/logging command_logging
;;
clam|CLAM|command-logging-and-monitoring|command_logging_and_monitoring)
cpjson command-logging-and-monitoring/tests/logging command_logging
cpjson command-logging-and-monitoring/tests/monitoring command_monitoring
;;
crud|CRUD)
cpjson crud/tests/ crud
;;
csot|CSOT|client-side-operations-timeout)
cpjson client-side-operations-timeout/tests csot
;;
gridfs)
cpjson gridfs/tests gridfs
;;
handshake)
cpjson mongodb-handshake/tests handshake
;;
index|index-management)
cpjson index-management/tests index_management
;;
load-balancers|load_balancer)
cpjson load-balancers/tests load_balancer
;;
srv|SRV|initial-dns-seedlist-discovery|srv_seedlist)
cpjson initial-dns-seedlist-discovery/tests/ srv_seedlist
;;
read-write-concern|read_write_concern)
cpjson read-write-concern/tests/operation read_write_concern/operation
;;
retryable-reads|retryable_reads)
cpjson retryable-reads/tests/ retryable_reads
;;
retryable-writes|retryable_writes)
cpjson retryable-writes/tests/ retryable_writes
;;
run-command|run_command)
cpjson run-command/tests/ run_command
;;
sdam|SDAM|server-discovery-and-monitoring|discovery_and_monitoring)
cpjson server-discovery-and-monitoring/tests/errors \
discovery_and_monitoring/errors
cpjson server-discovery-and-monitoring/tests/rs \
discovery_and_monitoring/rs
cpjson server-discovery-and-monitoring/tests/sharded \
discovery_and_monitoring/sharded
cpjson server-discovery-and-monitoring/tests/single \
discovery_and_monitoring/single
cpjson server-discovery-and-monitoring/tests/unified \
discovery_and_monitoring/unified
cpjson server-discovery-and-monitoring/tests/load-balanced \
discovery_and_monitoring/load-balanced
;;
sdam-monitoring|sdam_monitoring)
cpjson server-discovery-and-monitoring/tests/monitoring sdam_monitoring
;;
server-selection|server_selection)
cpjson server-selection/tests/ server_selection
rm -rf $PYMONGO/test/server_selection/logging # these tests live in server_selection_logging
cpjson server-selection/tests/logging server_selection_logging
;;
server-selection-logging|server_selection_logging)
cpjson server-selection/tests/logging server_selection_logging
;;
sessions)
cpjson sessions/tests/ sessions
;;
transactions|transactions-convenient-api)
cpjson transactions/tests/ transactions
cpjson transactions-convenient-api/tests/ transactions-convenient-api
;;
unified|unified-test-format)
cpjson unified-test-format/tests/ unified-test-format/
;;
uri|uri-options|uri_options)
cpjson uri-options/tests uri_options
cp "$SPECS"/source/uri-options/tests/*.pem $PYMONGO/test/uri_options
;;
stable-api|versioned-api)
cpjson versioned-api/tests versioned-api
;;
*)
echo "Do not know how to resync spec tests for '${spec}'"
help
;;
esac
done

View File

@ -0,0 +1,32 @@
#!/bin/bash
# Script run on an ECS host to test MONGODB-AWS.
set -eu
############################################
# Main Program #
############################################
if [[ -z "$1" ]]; then
echo "usage: $0 <MONGODB_URI>"
exit 1
fi
export MONGODB_URI="$1"
if echo "$MONGODB_URI" | grep -q "@"; then
echo "MONGODB_URI unexpectedly contains user credentials in ECS test!";
exit 1
fi
# Now we can safely enable xtrace
set -o xtrace
# Install a c compiler.
apt-get -qq update < /dev/null > /dev/null
apt-get -q install -y build-essential
export SET_XTRACE_ON=1
cd src
rm -rf .venv
rm -f .evergreen/scripts/test-env.sh || true
rm -f .evergreen/scripts/env.sh || true
bash ./.evergreen/just.sh setup-tests auth_aws ecs-remote
bash .evergreen/just.sh run-tests

View File

@ -0,0 +1,17 @@
#!/bin/bash
# Script run on a remote host to test MONGODB-OIDC.
set -eu
echo "Running MONGODB-OIDC authentication tests on ${OIDC_ENV}..."
if [ ${OIDC_ENV} == "k8s" ]; then
SUB_TEST_NAME=$K8S_VARIANT-remote
else
SUB_TEST_NAME=$OIDC_ENV-remote
sudo apt-get install -y python3-dev build-essential
fi
bash ./.evergreen/just.sh setup-tests auth_oidc $SUB_TEST_NAME
bash ./.evergreen/just.sh run-tests "${@:1}"
echo "Running MONGODB-OIDC authentication tests on ${OIDC_ENV}... done."

45
.evergreen/run-tests.sh Executable file
View File

@ -0,0 +1,45 @@
#!/bin/bash
# Run a test suite that was configured with setup-tests.sh.
set -eu
SCRIPT_DIR=$(dirname ${BASH_SOURCE:-$0})
SCRIPT_DIR="$( cd -- "$SCRIPT_DIR" > /dev/null 2>&1 && pwd )"
ROOT_DIR="$(dirname $SCRIPT_DIR)"
PREV_DIR=$(pwd)
cd $ROOT_DIR
# Try to source the env file.
if [ -f $SCRIPT_DIR/scripts/env.sh ]; then
echo "Sourcing env inputs"
. $SCRIPT_DIR/scripts/env.sh
else
echo "Not sourcing env inputs"
fi
# Handle test inputs.
if [ -f $SCRIPT_DIR/scripts/test-env.sh ]; then
echo "Sourcing test inputs"
. $SCRIPT_DIR/scripts/test-env.sh
else
echo "Missing test inputs, please run 'just setup-tests'"
exit 1
fi
cleanup_tests() {
# Avoid leaving the lock file in a changed state when we change the resolution type.
if [ -n "${TEST_MIN_DEPS:-}" ]; then
git checkout uv.lock || true
fi
cd $PREV_DIR
}
trap "cleanup_tests" SIGINT ERR
# Start the test runner.
echo "Running tests with UV_PYTHON=${UV_PYTHON:-}..."
echo "UV_ARGS=${UV_ARGS}"
uv run ${UV_ARGS} --reinstall-package pymongo .evergreen/scripts/run_tests.py "$@"
echo "Running tests with UV_PYTHON=${UV_PYTHON:-}... done."
cleanup_tests

View File

View File

@ -0,0 +1,41 @@
#!/bin/bash
# Check for regressions in the import time of pymongo.
set -eu
HERE=$(dirname ${BASH_SOURCE:-$0})
source $HERE/env.sh
pushd $HERE/../.. >/dev/null
BASE_SHA="$1"
HEAD_SHA="$2"
# Set up the virtual env.
. $HERE/setup-dev-env.sh
uv venv --seed
source .venv/bin/activate
# Use the previous commit if this was not a PR run.
if [ "$BASE_SHA" == "$HEAD_SHA" ]; then
BASE_SHA=$(git rev-parse HEAD~1)
fi
function get_import_time() {
local log_file
python -m pip install -q ".[aws,encryption,gssapi,ocsp,snappy,zstd]"
# Import once to cache modules
python -c "import pymongo"
log_file="pymongo-$1.log"
python -X importtime -c "import pymongo" 2> $log_file
}
get_import_time $HEAD_SHA
git stash || true
git checkout $BASE_SHA
get_import_time $BASE_SHA
git checkout $HEAD_SHA
git stash apply || true
python tools/compare_import_time.py $HEAD_SHA $BASE_SHA
popd >/dev/null

14
.evergreen/scripts/cleanup.sh Executable file
View File

@ -0,0 +1,14 @@
#!/bin/bash
# Clean up resources at the end of an evergreen run.
set -eu
HERE=$(dirname ${BASH_SOURCE:-$0})
# Try to source the env file.
if [ -f $HERE/env.sh ]; then
echo "Sourcing env file"
source $HERE/env.sh
fi
rm -rf "${DRIVERS_TOOLS}" || true
rm -f $HERE/../../secrets-export.sh || true

View File

@ -0,0 +1,114 @@
#!/bin/bash
# Configure an evergreen test environment.
set -eu
# Get the current unique version of this checkout
# shellcheck disable=SC2154
if [ "${is_patch:-}" = "true" ]; then
# shellcheck disable=SC2154
CURRENT_VERSION="$(git describe)-patch-$version_id"
else
CURRENT_VERSION=latest
fi
PROJECT_DIRECTORY="$(pwd)"
DRIVERS_TOOLS="$(dirname $PROJECT_DIRECTORY)/drivers-tools"
CARGO_HOME=${CARGO_HOME:-${DRIVERS_TOOLS}/.cargo}
UV_TOOL_DIR=$PROJECT_DIRECTORY/.local/uv/tools
UV_CACHE_DIR=$PROJECT_DIRECTORY/.local/uv/cache
DRIVERS_TOOLS_BINARIES="$DRIVERS_TOOLS/.bin"
MONGODB_BINARIES="$DRIVERS_TOOLS/mongodb/bin"
# On Evergreen jobs, "CI" will be set, and we don't want to write to $HOME.
if [ "${CI:-}" == "true" ]; then
PYMONGO_BIN_DIR=${DRIVERS_TOOLS_BINARIES:-}
# We want to use a path that's already on PATH on spawn hosts.
else
PYMONGO_BIN_DIR=$HOME/cli_bin
fi
PATH_EXT="$MONGODB_BINARIES:$DRIVERS_TOOLS_BINARIES:$PYMONGO_BIN_DIR:\$PATH"
# Python has cygwin path problems on Windows. Detect prospective mongo-orchestration home directory
if [ "Windows_NT" = "${OS:-}" ]; then # Magic variable in cygwin
DRIVERS_TOOLS=$(cygpath -m $DRIVERS_TOOLS)
PROJECT_DIRECTORY=$(cygpath -m $PROJECT_DIRECTORY)
CARGO_HOME=$(cygpath -m $CARGO_HOME)
UV_TOOL_DIR=$(cygpath -m "$UV_TOOL_DIR")
UV_CACHE_DIR=$(cygpath -m "$UV_CACHE_DIR")
DRIVERS_TOOLS_BINARIES=$(cygpath -m "$DRIVERS_TOOLS_BINARIES")
MONGODB_BINARIES=$(cygpath -m "$MONGODB_BINARIES")
PYMONGO_BIN_DIR=$(cygpath -m "$PYMONGO_BIN_DIR")
fi
SCRIPT_DIR="$PROJECT_DIRECTORY/.evergreen/scripts"
if [ -f "$SCRIPT_DIR/env.sh" ]; then
echo "Reading $SCRIPT_DIR/env.sh file"
. "$SCRIPT_DIR/env.sh"
exit 0
fi
export MONGO_ORCHESTRATION_HOME="$DRIVERS_TOOLS/.evergreen/orchestration"
export MONGODB_BINARIES="$DRIVERS_TOOLS/mongodb/bin"
cat <<EOT > "$SCRIPT_DIR"/env.sh
export PROJECT_DIRECTORY="$PROJECT_DIRECTORY"
export CURRENT_VERSION="$CURRENT_VERSION"
export DRIVERS_TOOLS="$DRIVERS_TOOLS"
export MONGO_ORCHESTRATION_HOME="$MONGO_ORCHESTRATION_HOME"
export MONGODB_BINARIES="$MONGODB_BINARIES"
export DRIVERS_TOOLS_BINARIES="$DRIVERS_TOOLS_BINARIES"
export PROJECT_DIRECTORY="$PROJECT_DIRECTORY"
export CARGO_HOME="$CARGO_HOME"
export UV_TOOL_DIR="$UV_TOOL_DIR"
export UV_CACHE_DIR="$UV_CACHE_DIR"
export UV_TOOL_BIN_DIR="$DRIVERS_TOOLS_BINARIES"
export PYMONGO_BIN_DIR="$PYMONGO_BIN_DIR"
export PATH="$PATH_EXT"
# shellcheck disable=SC2154
export PROJECT="${project:-mongo-python-driver}"
export PIP_QUIET=1
EOT
# Write the .env file for drivers-tools.
rm -rf $DRIVERS_TOOLS
BRANCH=master
ORG=mongodb-labs
git clone --branch $BRANCH https://github.com/$ORG/drivers-evergreen-tools.git $DRIVERS_TOOLS
cat <<EOT > ${DRIVERS_TOOLS}/.env
SKIP_LEGACY_SHELL=1
DRIVERS_TOOLS="$DRIVERS_TOOLS"
MONGO_ORCHESTRATION_HOME="$MONGO_ORCHESTRATION_HOME"
MONGODB_BINARIES="$MONGODB_BINARIES"
EOT
# Add these expansions to make it easier to call out tests scripts from the EVG yaml
cat <<EOT > expansion.yml
DRIVERS_TOOLS: "$DRIVERS_TOOLS"
PROJECT_DIRECTORY: "$PROJECT_DIRECTORY"
EOT
# If the toolchain is available, symlink binaries to the bin dir. This has to be done
# after drivers-tools is cloned, since we might be using its binary dir.
_bin_path=""
if [ "Windows_NT" == "${OS:-}" ]; then
_bin_path="/cygdrive/c/Python/Current/Scripts"
elif [ "$(uname -s)" == "Darwin" ]; then
_bin_path="/Library/Frameworks/Python.Framework/Versions/Current/bin"
else
_bin_path="/opt/python/Current/bin"
fi
if [ -d "${_bin_path}" ]; then
_suffix=""
if [ "Windows_NT" == "${OS:-}" ]; then
_suffix=".exe"
fi
echo "Symlinking binaries from toolchain"
mkdir -p $PYMONGO_BIN_DIR
ln -s ${_bin_path}/just${_suffix} $PYMONGO_BIN_DIR/just${_suffix}
ln -s ${_bin_path}/uv${_suffix} $PYMONGO_BIN_DIR/uv${_suffix}
ln -s ${_bin_path}/uvx${_suffix} $PYMONGO_BIN_DIR/uvx${_suffix}
fi

View File

@ -0,0 +1,50 @@
#!/usr/bin/env bash
tools="$(realpath -s "../drivers-tools")"
pushd $tools/.evergreen/github_app || exit
owner="mongodb"
repo="mongo-python-driver"
# Bootstrap the app.
echo "bootstrapping"
source utils.sh
bootstrap drivers/comment-bot
# Run the app.
source ./secrets-export.sh
# Get a github access token for the git checkout.
echo "Getting github token..."
token=$(bash ./get-access-token.sh $repo $owner)
if [ -z "${token}" ]; then
echo "Failed to get github access token!"
popd || exit
exit 1
fi
echo "Getting github token... done."
popd || exit
# Make the git checkout and create a new branch.
echo "Creating the git checkout..."
branch="spec-resync-"$(date '+%m-%d-%Y')
git remote set-url origin https://x-access-token:${token}@github.com/$owner/$repo.git
git checkout -b $branch "origin/master"
git add ./test
git commit -am "resyncing specs $(date '+%m-%d-%Y')"
echo "Creating the git checkout... done."
git push origin $branch
resp=$(curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $token" \
-H "X-GitHub-Api-Version: 2022-11-28" \
-d "{\"title\":\"[Spec Resync] $(date '+%m-%d-%Y')\",\"body\":\"$(cat "$1")\",\"head\":\"${branch}\",\"base\":\"master\"}" \
--url https://api.github.com/repos/$owner/$repo/pulls)
echo $resp | jq '.html_url'
echo "Creating the PR... done."
rm -rf $tools

View File

@ -0,0 +1,4 @@
#!/bin/bash
# Download all the task coverage files.
set -eu
aws s3 cp --recursive s3://"$1"/coverage/"$2"/"$3"/coverage/ coverage/

View File

@ -0,0 +1,6 @@
#!/bin/bash
# Entry point for the generate-config pre-commit hook.
set -eu
python .evergreen/scripts/generate_config.py

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,357 @@
from __future__ import annotations
from dataclasses import dataclass
from inspect import getmembers, isfunction
from itertools import cycle, zip_longest
from pathlib import Path
from typing import Any
from shrub.v3.evg_build_variant import BuildVariant
from shrub.v3.evg_command import (
EvgCommandType,
ec2_assume_role,
s3_put,
subprocess_exec,
)
from shrub.v3.evg_project import EvgProject
from shrub.v3.evg_task import EvgTaskRef
from shrub.v3.shrub_service import ShrubService
##############
# Globals
##############
ALL_VERSIONS = ["4.2", "4.4", "5.0", "6.0", "7.0", "8.0", "rapid", "latest"]
CPYTHONS = ["3.10", "3.11", "3.12", "3.13", "3.14t", "3.14"]
PYPYS = ["pypy3.11"]
MIN_SUPPORT_VERSIONS = ["3.9", "pypy3.9", "pypy3.10"]
ALL_PYTHONS = CPYTHONS + PYPYS
MIN_MAX_PYTHON = [CPYTHONS[0], CPYTHONS[-1]]
BATCHTIME_WEEK = 10080
BATCHTIME_DAY = 1440
AUTH_SSLS = [("auth", "ssl"), ("noauth", "ssl"), ("noauth", "nossl")]
TOPOLOGIES = ["standalone", "replica_set", "sharded_cluster"]
C_EXTS = ["without_ext", "with_ext"]
SYNCS = ["sync", "async"]
DISPLAY_LOOKUP = dict(
ssl=dict(ssl="SSL", nossl="NoSSL"),
auth=dict(auth="Auth", noauth="NoAuth"),
topology=dict(
standalone="Standalone", replica_set="Replica Set", sharded_cluster="Sharded Cluster"
),
test_suites=dict(default="Sync", default_async="Async"),
sync={"sync": "Sync", "async": "Async"},
coverage={"1": "cov"},
no_ext={"1": "No C"},
test_min_deps={"1": "Min Deps"},
)
HOSTS = dict()
@dataclass
class Host:
name: str
run_on: str
display_name: str
variables: dict[str, str] | None
# Hosts with toolchains.
HOSTS["rhel8"] = Host("rhel8", "rhel87-small", "RHEL8", dict())
HOSTS["win64"] = Host("win64", "windows-64-vsMulti-small", "Win64", dict())
HOSTS["win-latest"] = Host("win-latest", "windows-2022-latest-small", "WinLatest", dict())
HOSTS["win32"] = Host("win32", "windows-64-vsMulti-small", "Win32", dict())
HOSTS["macos"] = Host("macos", "macos-14", "macOS", dict())
HOSTS["macos-arm64"] = Host("macos-arm64", "macos-14-arm64", "macOS Arm64", dict())
HOSTS["ubuntu22"] = Host("ubuntu22", "ubuntu2204-small", "Ubuntu-22", dict())
HOSTS["ubuntu24"] = Host("ubuntu24", "ubuntu2404-small", "Ubuntu-24", dict())
HOSTS["perf"] = Host("perf", "rhel90-dbx-perf-large", "", dict())
HOSTS["debian11"] = Host("debian11", "debian11-small", "Debian11", dict())
DEFAULT_HOST = HOSTS["rhel8"]
# Other hosts
OTHER_HOSTS = ["RHEL9-FIPS", "RHEL8-zseries", "RHEL8-POWER8", "RHEL8-arm64", "Amazon2023"]
for name, run_on in zip(
OTHER_HOSTS,
[
"rhel92-fips",
"rhel8-zseries-small",
"rhel8-power-small",
"rhel82-arm64-small",
"amazon2023-arm64-latest-large-m8g",
],
):
HOSTS[name] = Host(name, run_on, name, dict())
##############
# Helpers
##############
def create_variant_generic(
tasks: list[str | EvgTaskRef],
display_name: str,
*,
host: Host | str | None = None,
default_run_on="rhel87-small",
expansions: dict | None = None,
**kwargs: Any,
) -> BuildVariant:
"""Create a build variant for the given inputs."""
task_refs = []
if isinstance(host, str):
host = HOSTS[host]
for t in tasks:
if isinstance(t, EvgTaskRef):
task_refs.append(t)
else:
task_refs.append(EvgTaskRef(name=t))
expansions = expansions and expansions.copy() or dict()
if "run_on" in kwargs:
run_on = kwargs.pop("run_on")
elif host:
run_on = [host.run_on]
if host.variables:
expansions.update(host.variables)
else:
run_on = [default_run_on]
if isinstance(run_on, str):
run_on = [run_on]
name = display_name.replace(" ", "-").replace("*-", "").lower()
return BuildVariant(
name=name,
display_name=display_name,
tasks=task_refs,
expansions=expansions or None,
run_on=run_on,
**kwargs,
)
def create_variant(
tasks: list[str | EvgTaskRef],
display_name: str,
*,
version: str | None = None,
host: Host | str | None = None,
expansions: dict | None = None,
**kwargs: Any,
) -> BuildVariant:
expansions = expansions and expansions.copy() or dict()
if version:
expansions["VERSION"] = version
# 8.0+ Windows builds must run on win-latest
if (
"win64" in display_name.lower()
or "win32" in display_name.lower()
and version
and version >= "8.0"
):
kwargs["run_on"] = HOSTS["win-latest"].run_on
return create_variant_generic(
tasks, display_name, version=version, host=host, expansions=expansions, **kwargs
)
def get_versions_from(min_version: str) -> list[str]:
"""Get all server versions starting from a minimum version."""
min_version_float = float(min_version)
rapid_latest = ["rapid", "latest"]
versions = [v for v in ALL_VERSIONS if v not in rapid_latest]
return [v for v in versions if float(v) >= min_version_float] + rapid_latest
def get_versions_until(max_version: str) -> list[str]:
"""Get all server version up to a max version."""
max_version_float = float(max_version)
versions = [v for v in ALL_VERSIONS if v not in ["rapid", "latest"]]
versions = [v for v in versions if float(v) <= max_version_float]
if not len(versions):
raise ValueError(f"No server versions found less <= {max_version}")
return versions
def get_common_name(base: str, sep: str, **kwargs) -> str:
display_name = base
version = kwargs.pop("VERSION", None)
version = version or kwargs.pop("version", None)
if version:
if version not in ["rapid", "latest"]:
version = f"v{version}"
display_name = f"{display_name}{sep}{version}"
for key, value in kwargs.items():
name = value
if key.lower() in ["python", "toolchain_version"]:
if not value.startswith("pypy"):
name = f"Python{value}"
else:
name = f"PyPy{value.replace('pypy', '')}"
elif key.lower() in DISPLAY_LOOKUP and value in DISPLAY_LOOKUP[key.lower()]:
name = DISPLAY_LOOKUP[key.lower()][value]
else:
continue
display_name = f"{display_name}{sep}{name}"
return display_name
def get_variant_name(base: str, host: str | Host | None = None, **kwargs) -> str:
"""Get the display name of a variant."""
display_name = base
if isinstance(host, str):
host = HOSTS[host]
if host is not None:
display_name += f" {host.display_name}"
return get_common_name(display_name, " ", **kwargs)
def get_task_name(base: str, **kwargs):
return get_common_name(base, "-", **kwargs).replace(" ", "-").lower()
def zip_cycle(*iterables, empty_default=None):
"""Get all combinations of the inputs, cycling over the shorter list(s)."""
cycles = [cycle(i) for i in iterables]
for _ in zip_longest(*iterables):
yield tuple(next(i, empty_default) for i in cycles)
def handle_c_ext(c_ext, expansions) -> None:
"""Handle c extension option."""
if c_ext == C_EXTS[0]:
expansions["NO_EXT"] = "1"
def get_standard_auth_ssl(topology):
auth = "auth" if topology == "sharded_cluster" else "noauth"
ssl = "nossl" if topology == "standalone" else "ssl"
return auth, ssl
def get_assume_role(**kwargs):
kwargs.setdefault("command_type", EvgCommandType.SETUP)
kwargs.setdefault("role_arn", "${assume_role_arn}")
return ec2_assume_role(**kwargs)
def get_subprocess_exec(**kwargs):
kwargs.setdefault("binary", "bash")
kwargs.setdefault("working_dir", "src")
kwargs.setdefault("command_type", EvgCommandType.TEST)
return subprocess_exec(**kwargs)
def get_s3_put(**kwargs):
kwargs["aws_key"] = "${AWS_ACCESS_KEY_ID}"
kwargs["aws_secret"] = "${AWS_SECRET_ACCESS_KEY}" # noqa:S105
kwargs["aws_session_token"] = "${AWS_SESSION_TOKEN}" # noqa:S105
kwargs["bucket"] = "${bucket_name}"
kwargs.setdefault("optional", "true")
kwargs.setdefault("permissions", "public-read")
kwargs.setdefault("content_type", "${content_type|application/x-gzip}")
kwargs.setdefault("command_type", EvgCommandType.SETUP)
return s3_put(**kwargs)
def generate_yaml(tasks=None, variants=None):
"""Generate the yaml for a given set of tasks and variants."""
project = EvgProject(tasks=tasks, buildvariants=variants)
out = ShrubService.generate_yaml(project)
# Dedent by two spaces to match what we use in config.yml
lines = [line[2:] for line in out.splitlines()]
print("\n".join(lines))
##################
# Generate Config
##################
def write_variants_to_file(mod):
here = Path(__file__).absolute().parent
target = here.parent / "generated_configs" / "variants.yml"
if target.exists():
target.unlink()
with target.open("w") as fid:
fid.write("buildvariants:\n")
for name, func in sorted(getmembers(mod, isfunction)):
if not name.endswith("_variants"):
continue
if not name.startswith("create_"):
raise ValueError("Variant creators must start with create_")
title = name.replace("create_", "").replace("_variants", "").replace("_", " ").capitalize()
project = EvgProject(tasks=None, buildvariants=func())
out = ShrubService.generate_yaml(project).splitlines()
with target.open("a") as fid:
fid.write(f" # {title} tests\n")
for line in out[1:]:
fid.write(f"{line}\n")
fid.write("\n")
# Remove extra trailing newline:
data = target.read_text().splitlines()
with target.open("w") as fid:
for line in data[:-1]:
fid.write(f"{line}\n")
def write_tasks_to_file(mod):
here = Path(__file__).absolute().parent
target = here.parent / "generated_configs" / "tasks.yml"
if target.exists():
target.unlink()
with target.open("w") as fid:
fid.write("tasks:\n")
for name, func in sorted(getmembers(mod, isfunction)):
if name.startswith("_") or not name.endswith("_tasks"):
continue
if not name.startswith("create_"):
raise ValueError("Task creators must start with create_")
title = name.replace("create_", "").replace("_tasks", "").replace("_", " ").capitalize()
project = EvgProject(tasks=func(), buildvariants=None)
out = ShrubService.generate_yaml(project).splitlines()
with target.open("a") as fid:
fid.write(f" # {title} tests\n")
for line in out[1:]:
fid.write(f"{line}\n")
fid.write("\n")
# Remove extra trailing newline:
data = target.read_text().splitlines()
with target.open("w") as fid:
for line in data[:-1]:
fid.write(f"{line}\n")
def write_functions_to_file(mod):
here = Path(__file__).absolute().parent
target = here.parent / "generated_configs" / "functions.yml"
if target.exists():
target.unlink()
with target.open("w") as fid:
fid.write("functions:\n")
functions = dict()
for name, func in sorted(getmembers(mod, isfunction)):
if name.startswith("_") or not name.endswith("_func"):
continue
if not name.startswith("create_"):
raise ValueError("Function creators must start with create_")
title = name.replace("create_", "").replace("_func", "").replace("_", " ").capitalize()
func_name, cmds = func()
functions = dict()
functions[func_name] = cmds
project = EvgProject(functions=functions, tasks=None, buildvariants=None)
out = ShrubService.generate_yaml(project).splitlines()
with target.open("a") as fid:
fid.write(f" # {title}\n")
for line in out[1:]:
fid.write(f"{line}\n")
fid.write("\n")
# Remove extra trailing newline:
data = target.read_text().splitlines()
with target.open("w") as fid:
for line in data[:-1]:
fid.write(f"{line}\n")

View File

@ -0,0 +1,36 @@
#!/bin/bash
# Install the necessary dependencies.
set -eu
HERE=$(dirname ${BASH_SOURCE:-$0})
pushd "$(dirname "$(dirname $HERE)")" > /dev/null
# Source the env files to pick up common variables.
if [ -f $HERE/env.sh ]; then
. $HERE/env.sh
fi
# Set up the default bin directory.
if [ -z "${PYMONGO_BIN_DIR:-}" ]; then
PYMONGO_BIN_DIR="$HOME/.local/bin"
fi
# Ensure uv is installed.
if ! command -v uv &>/dev/null; then
_BIN_DIR=$PYMONGO_BIN_DIR
mkdir -p ${_BIN_DIR}
echo "Installing uv..."
curl -LsSf https://astral.sh/uv/install.sh | env UV_INSTALL_DIR="$_BIN_DIR" INSTALLER_NO_MODIFY_PATH=1 sh
if [ "Windows_NT" = "${OS:-}" ]; then
chmod +x "$(cygpath -u $_BIN_DIR)/uv.exe"
fi
export PATH="$PYMONGO_BIN_DIR:$PATH"
echo "Installing uv... done."
fi
# Ensure just is installed.
if ! command -v just &>/dev/null; then
uv tool install rust-just
fi
popd > /dev/null

View File

@ -0,0 +1,144 @@
from __future__ import annotations
import os
from utils import (
DRIVERS_TOOLS,
LOGGER,
TMP_DRIVER_FILE,
create_archive,
read_env,
run_command,
write_env,
)
DIRS = dict(
gcp=f"{DRIVERS_TOOLS}/.evergreen/csfle/gcpkms",
azure=f"{DRIVERS_TOOLS}/.evergreen/csfle/azurekms",
)
def _setup_azure_vm(base_env: dict[str, str]) -> None:
LOGGER.info("Setting up Azure VM...")
azure_dir = DIRS["azure"]
env = base_env.copy()
env["AZUREKMS_SRC"] = TMP_DRIVER_FILE
env["AZUREKMS_DST"] = "~/"
run_command(f"{azure_dir}/copy-file.sh", env=env)
env = base_env.copy()
env["AZUREKMS_CMD"] = "tar xf mongo-python-driver.tgz"
run_command(f"{azure_dir}/run-command.sh", env=env)
env["AZUREKMS_CMD"] = "sudo apt-get install -y python3-dev build-essential"
run_command(f"{azure_dir}/run-command.sh", env=env)
env["AZUREKMS_CMD"] = "bash .evergreen/just.sh setup-tests kms azure-remote"
run_command(f"{azure_dir}/run-command.sh", env=env)
LOGGER.info("Setting up Azure VM... done.")
def _setup_gcp_vm(base_env: dict[str, str]) -> None:
LOGGER.info("Setting up GCP VM...")
gcp_dir = DIRS["gcp"]
env = base_env.copy()
env["GCPKMS_SRC"] = TMP_DRIVER_FILE
env["GCPKMS_DST"] = f"{env['GCPKMS_INSTANCENAME']}:"
run_command(f"{gcp_dir}/copy-file.sh", env=env)
env = base_env.copy()
env["GCPKMS_CMD"] = "tar xf mongo-python-driver.tgz"
run_command(f"{gcp_dir}/run-command.sh", env=env)
env["GCPKMS_CMD"] = "sudo apt-get install -y python3-dev build-essential"
run_command(f"{gcp_dir}/run-command.sh", env=env)
env["GCPKMS_CMD"] = "bash ./.evergreen/just.sh setup-tests kms gcp-remote"
run_command(f"{gcp_dir}/run-command.sh", env=env)
LOGGER.info("Setting up GCP VM...")
def _load_kms_config(sub_test_target: str) -> dict[str, str]:
target_dir = DIRS[sub_test_target]
config = read_env(f"{target_dir}/secrets-export.sh")
base_env = os.environ.copy()
for key, value in config.items():
base_env[key] = str(value)
return base_env
def setup_kms(sub_test_name: str) -> None:
if "-" in sub_test_name:
sub_test_target, sub_test_type = sub_test_name.split("-")
else:
sub_test_target = sub_test_name
sub_test_type = ""
assert sub_test_target in ["azure", "gcp"], sub_test_target
assert sub_test_type in ["", "remote", "fail"], sub_test_type
success = sub_test_type != "fail"
kms_dir = DIRS[sub_test_target]
if sub_test_target == "azure":
write_env("TEST_FLE_AZURE_AUTO")
else:
write_env("TEST_FLE_GCP_AUTO")
write_env("SUCCESS", success)
# For remote tests, there is no further work required.
if sub_test_type == "remote":
return
if sub_test_target == "azure":
run_command("./setup-secrets.sh", cwd=kms_dir)
if success:
create_archive()
if sub_test_target == "azure":
os.environ["AZUREKMS_VMNAME_PREFIX"] = "PYTHON_DRIVER"
# Found using "az vm image list --output table"
os.environ[
"AZUREKMS_IMAGE"
] = "Canonical:0001-com-ubuntu-server-jammy:22_04-lts-gen2:latest"
else:
os.environ["GCPKMS_IMAGEFAMILY"] = "debian-12"
run_command("./setup.sh", cwd=kms_dir)
base_env = _load_kms_config(sub_test_target)
if sub_test_target == "azure":
_setup_azure_vm(base_env)
else:
_setup_gcp_vm(base_env)
if sub_test_target == "azure":
config = read_env(f"{kms_dir}/secrets-export.sh")
if success:
write_env("AZUREKMS_VMNAME", config["AZUREKMS_VMNAME"])
write_env("KEY_NAME", config["AZUREKMS_KEYNAME"])
write_env("KEY_VAULT_ENDPOINT", config["AZUREKMS_KEYVAULTENDPOINT"])
def test_kms_send_to_remote(sub_test_name: str) -> None:
env = _load_kms_config(sub_test_name)
if sub_test_name == "azure":
key_name = os.environ["KEY_NAME"]
key_vault_endpoint = os.environ["KEY_VAULT_ENDPOINT"]
env[
"AZUREKMS_CMD"
] = f'KEY_NAME="{key_name}" KEY_VAULT_ENDPOINT="{key_vault_endpoint}" bash ./.evergreen/just.sh run-tests'
else:
env["GCPKMS_CMD"] = "./.evergreen/just.sh run-tests"
cmd = f"{DIRS[sub_test_name]}/run-command.sh"
run_command(cmd, env=env)
def teardown_kms(sub_test_name: str) -> None:
run_command(f"{DIRS[sub_test_name]}/teardown.sh")
if __name__ == "__main__":
setup_kms()

View File

@ -0,0 +1,93 @@
from __future__ import annotations
import os
import sys
import time
import urllib.error
import urllib.request
from pathlib import Path
from shutil import which
from utils import LOGGER, ROOT, run_command, write_env
def make_request(url, timeout=10):
for _ in range(int(timeout)):
try:
urllib.request.urlopen(url) # noqa: S310
return
except urllib.error.HTTPError:
pass
time.sleep(1)
raise TimeoutError(f"Failed to access {url}")
def setup_mod_wsgi(sub_test_name: str) -> None:
env = os.environ.copy()
if sub_test_name == "embedded":
env["MOD_WSGI_CONF"] = "mod_wsgi_test_embedded.conf"
elif sub_test_name == "standalone":
env["MOD_WSGI_CONF"] = "mod_wsgi_test.conf"
else:
raise ValueError("mod_wsgi sub test must be either 'standalone' or 'embedded'")
write_env("MOD_WSGI_CONF", env["MOD_WSGI_CONF"])
apache = which("apache2")
if not apache and Path("/usr/lib/apache2/mpm-prefork/apache2").exists():
apache = "/usr/lib/apache2/mpm-prefork/apache2"
if apache:
apache_config = "apache24ubuntu161404.conf"
else:
apache = which("httpd")
if not apache:
raise ValueError("Could not find apache2 or httpd")
apache_config = "apache22amazon.conf"
python_version = ".".join(str(val) for val in sys.version_info[:2])
mod_wsgi_version = 4
so_file = f"/opt/python/mod_wsgi/python_version/{python_version}/mod_wsgi_version/{mod_wsgi_version}/mod_wsgi.so"
write_env("MOD_WSGI_SO", so_file)
env["MOD_WSGI_SO"] = so_file
env["PYTHONHOME"] = f"/opt/python/{python_version}"
env["PROJECT_DIRECTORY"] = project_directory = str(ROOT)
write_env("APACHE_BINARY", apache)
write_env("APACHE_CONFIG", apache_config)
uri1 = f"http://localhost:8080/interpreter1{project_directory}"
write_env("TEST_URI1", uri1)
uri2 = f"http://localhost:8080/interpreter2{project_directory}"
write_env("TEST_URI2", uri2)
run_command(f"{apache} -k start -f {ROOT}/test/mod_wsgi_test/{apache_config}", env=env)
# Wait for the endpoints to be available.
try:
make_request(uri1, 10)
make_request(uri2, 10)
except Exception as e:
LOGGER.error(Path("error_log").read_text())
raise e
def test_mod_wsgi() -> None:
sys.path.insert(0, ROOT)
from test.mod_wsgi_test.test_client import main, parse_args
uri1 = os.environ["TEST_URI1"]
uri2 = os.environ["TEST_URI2"]
args = f"-n 25000 -t 100 parallel {uri1} {uri2}"
try:
main(*parse_args(args.split()))
args = f"-n 25000 serial {uri1} {uri2}"
main(*parse_args(args.split()))
except Exception as e:
LOGGER.error(Path("error_log").read_text())
raise e
def teardown_mod_wsgi() -> None:
apache = os.environ["APACHE_BINARY"]
apache_config = os.environ["APACHE_CONFIG"]
run_command(f"{apache} -k stop -f {ROOT}/test/mod_wsgi_test/{apache_config}")
if __name__ == "__main__":
setup_mod_wsgi()

View File

@ -0,0 +1,111 @@
from __future__ import annotations
import os
from utils import (
DRIVERS_TOOLS,
TMP_DRIVER_FILE,
create_archive,
read_env,
run_command,
write_env,
)
K8S_NAMES = ["aks", "gke", "eks"]
K8S_REMOTE_NAMES = [f"{n}-remote" for n in K8S_NAMES]
def _get_target_dir(sub_test_name: str) -> str:
if sub_test_name == "default":
target_dir = "auth_oidc"
elif sub_test_name.startswith("azure"):
target_dir = "auth_oidc/azure"
elif sub_test_name.startswith("gcp"):
target_dir = "auth_oidc/gcp"
elif sub_test_name in K8S_NAMES + K8S_REMOTE_NAMES:
target_dir = "auth_oidc/k8s"
else:
raise ValueError(f"Invalid sub test name '{sub_test_name}'")
return f"{DRIVERS_TOOLS}/.evergreen/{target_dir}"
def setup_oidc(sub_test_name: str) -> dict[str, str] | None:
target_dir = _get_target_dir(sub_test_name)
env = os.environ.copy()
if sub_test_name == "eks" and "AWS_ACCESS_KEY_ID" in os.environ:
# Store AWS creds for kubectl access.
for key in ["AWS_ACCESS_KEY_ID", "AWS_SECRET_ACCESS_KEY", "AWS_SESSION_TOKEN"]:
if key in os.environ:
write_env(key, os.environ[key])
if sub_test_name == "azure":
env["AZUREOIDC_VMNAME_PREFIX"] = "PYTHON_DRIVER"
if "-remote" not in sub_test_name:
if sub_test_name == "azure":
# Found using "az vm image list --output table"
env["AZUREOIDC_IMAGE"] = "Canonical:0001-com-ubuntu-server-jammy:22_04-lts-gen2:latest"
else:
env["GCPKMS_IMAGEFAMILY"] = "debian-12"
run_command(f"bash {target_dir}/setup.sh", env=env)
if sub_test_name in K8S_NAMES:
run_command(f"bash {target_dir}/setup-pod.sh {sub_test_name}")
run_command(f"bash {target_dir}/run-self-test.sh")
return None
source_file = None
if sub_test_name == "default":
source_file = f"{target_dir}/secrets-export.sh"
elif sub_test_name in ["azure-remote", "gcp-remote"]:
source_file = "./secrets-export.sh"
if sub_test_name in K8S_REMOTE_NAMES:
return os.environ.copy()
if source_file is None:
return None
config = read_env(source_file)
write_env("MONGODB_URI_SINGLE", config["MONGODB_URI_SINGLE"])
write_env("MONGODB_URI", config["MONGODB_URI"])
write_env("DB_IP", config["MONGODB_URI"])
if sub_test_name == "default":
write_env("OIDC_TOKEN_FILE", config["OIDC_TOKEN_FILE"])
write_env("OIDC_TOKEN_DIR", config["OIDC_TOKEN_DIR"])
if "OIDC_DOMAIN" in config:
write_env("OIDC_DOMAIN", config["OIDC_DOMAIN"])
elif sub_test_name == "azure-remote":
write_env("AZUREOIDC_RESOURCE", config["AZUREOIDC_RESOURCE"])
elif sub_test_name == "gcp-remote":
write_env("GCPOIDC_AUDIENCE", config["GCPOIDC_AUDIENCE"])
return config
def test_oidc_send_to_remote(sub_test_name: str) -> None:
env = os.environ.copy()
target_dir = _get_target_dir(sub_test_name)
create_archive()
if sub_test_name in ["azure", "gcp"]:
upper_name = sub_test_name.upper()
env[f"{upper_name}OIDC_DRIVERS_TAR_FILE"] = TMP_DRIVER_FILE
env[
f"{upper_name}OIDC_TEST_CMD"
] = f"OIDC_ENV={sub_test_name} ./.evergreen/run-mongodb-oidc-test.sh"
elif sub_test_name in K8S_NAMES:
env["K8S_DRIVERS_TAR_FILE"] = TMP_DRIVER_FILE
env["K8S_TEST_CMD"] = "OIDC_ENV=k8s ./.evergreen/run-mongodb-oidc-test.sh"
run_command(f"bash {target_dir}/run-driver-test.sh", env=env)
def teardown_oidc(sub_test_name: str) -> None:
target_dir = _get_target_dir(sub_test_name)
# For k8s, make sure an error while tearing down the pod doesn't prevent
# the Altas server teardown.
error = None
if sub_test_name in K8S_NAMES:
try:
run_command(f"bash {target_dir}/teardown-pod.sh")
except Exception as e:
error = e
run_command(f"bash {target_dir}/teardown.sh")
if error:
raise error

View File

@ -0,0 +1,15 @@
#!/bin/bash
# We use the requester expansion to determine whether the data is from a mainline evergreen run or not
set -eu
# shellcheck disable=SC2154
if [ "${requester}" == "commit" ]; then
echo "is_mainline: true" >> expansion.yml
else
echo "is_mainline: false" >> expansion.yml
fi
# We parse the username out of the order_id as patches append that in and SPS does not need that information
# shellcheck disable=SC2154
echo "parsed_order_id: $(echo "${revision_order_id}" | awk -F'_' '{print $NF}')" >> expansion.yml

View File

@ -0,0 +1,25 @@
#!/bin/bash
# We use the requester expansion to determine whether the data is from a mainline evergreen run or not
set -eu
# Submit the performance data to the SPS endpoint
# shellcheck disable=SC2154
response=$(curl -s -w "\nHTTP_STATUS:%{http_code}" -X 'POST' \
"https://performance-monitoring-api.corp.mongodb.com/raw_perf_results/cedar_report?project=${project_id}&version=${version_id}&variant=${build_variant}&order=${parsed_order_id}&task_name=${task_name}&task_id=${task_id}&execution=${execution}&mainline=${is_mainline}" \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d @results.json)
http_status=$(echo "$response" | grep "HTTP_STATUS" | awk -F':' '{print $2}')
response_body=$(echo "$response" | sed '/HTTP_STATUS/d')
# We want to throw an error if the data was not successfully submitted
if [ "$http_status" -ne 200 ]; then
echo "Error: Received HTTP status $http_status"
echo "Response Body: $response_body"
exit 1
fi
echo "Response Body: $response_body"
echo "HTTP Status: $http_status"

View File

@ -0,0 +1,150 @@
from __future__ import annotations
import argparse
import os
import pathlib
import subprocess
from argparse import Namespace
from subprocess import CalledProcessError
JIRA_FILTER = "https://jira.mongodb.org/issues/?jql=labels%20%3D%20automated-sync%20AND%20status%20!%3D%20Closed"
def resync_specs(directory: pathlib.Path, errored: dict[str, str]) -> None:
"""Actually sync the specs"""
print("Beginning to sync specs")
for spec in os.scandir(directory):
if not spec.is_dir():
continue
if spec.name in ["asynchronous"]:
continue
try:
subprocess.run(
["bash", "./.evergreen/resync-specs.sh", spec.name], # noqa: S603, S607
capture_output=True,
text=True,
check=True,
)
except CalledProcessError as exc:
errored[spec.name] = exc.stderr
print("Done syncing specs")
def apply_patches(errored):
print("Beginning to apply patches")
subprocess.run(
["bash", "./.evergreen/remove-unimplemented-tests.sh"], # noqa: S603, S607
check=True,
)
try:
# Avoid shell=True by passing arguments as a list.
# Note: glob expansion doesn't work in shell=False, so we use a list of files.
patches = [str(p) for p in pathlib.Path("./.evergreen/spec-patch/").glob("*")]
if patches:
subprocess.run(
[ # noqa: S603, S607
"git",
"apply",
"-R",
"--allow-empty",
"--whitespace=fix",
*patches,
],
check=True,
stderr=subprocess.PIPE,
)
except CalledProcessError as exc:
errored["applying patches"] = exc.stderr
def check_new_spec_directories(directory: pathlib.Path) -> list[str]:
"""Check to see if there are any directories in the spec repo that don't exist in pymongo/test"""
spec_dir = pathlib.Path(os.environ["MDB_SPECS"]) / "source"
spec_set = {
entry.name.replace("-", "_")
for entry in os.scandir(spec_dir)
if entry.is_dir()
and (pathlib.Path(entry.path) / "tests").is_dir()
and len(list(os.scandir(pathlib.Path(entry.path) / "tests"))) > 1
}
test_set = {entry.name.replace("-", "_") for entry in os.scandir(directory) if entry.is_dir()}
known_mappings = {
"ocsp_support": "ocsp",
"client_side_operations_timeout": "csot",
"mongodb_handshake": "handshake",
"load_balancers": "load_balancer",
"connection_monitoring_and_pooling": "connection_monitoring",
"command_logging_and_monitoring": "command_logging",
"initial_dns_seedlist_discovery": "srv_seedlist",
"server_discovery_and_monitoring": "sdam_monitoring",
}
for k, v in known_mappings.items():
if k in spec_set:
spec_set.remove(k)
spec_set.add(v)
return list(spec_set - test_set)
def write_summary(errored: dict[str, str], new: list[str], filename: str | None) -> None:
"""Generate the PR description"""
pr_body = ""
# Avoid shell=True and complex pipes by using Python to process git output
process = subprocess.run(
["git", "diff", "--name-only"], # noqa: S603, S607
capture_output=True,
text=True,
check=True,
)
changed_files = process.stdout.strip().splitlines()
succeeded_set = set()
for f in changed_files:
parts = f.split("/")
if len(parts) > 1:
succeeded_set.add(parts[1])
succeeded = sorted(succeeded_set)
if len(succeeded) > 0:
pr_body += "The following specs were changed:\n -"
pr_body += "\n -".join(succeeded)
pr_body += "\n"
if len(errored) > 0:
pr_body += "\n\nThe following spec syncs encountered errors:"
for k, v in errored.items():
pr_body += f"\n -{k}\n```{v}\n```"
pr_body += "\n"
if len(new) > 0:
pr_body += "\n\nThe following directories are in the specification repository and not in our test directory:\n -"
pr_body += "\n -".join(new)
pr_body += "\n"
if pr_body != "":
pr_body = f"Jira tickets: {JIRA_FILTER}\n\n" + pr_body
if filename is None:
print(f"\n{pr_body}")
else:
with open(filename, "w") as f:
# replacements made for proper json
f.write(pr_body.replace("\n", "\\n").replace("\t", "\\t"))
def main(args: Namespace):
directory = pathlib.Path("./test")
errored: dict[str, str] = {}
resync_specs(directory, errored)
apply_patches(errored)
new = check_new_spec_directories(directory)
write_summary(errored, new, args.filename)
if __name__ == "__main__":
parser = argparse.ArgumentParser(
description="Python Script to resync all specs and generate summary for PR."
)
parser.add_argument(
"--filename",
help="Name of file for the summary to be written into.",
default=None,
)
args = parser.parse_args()
main(args)

View File

@ -0,0 +1,43 @@
#!/usr/bin/env bash
# Run spec syncing script and create PR
set -eu
# SETUP
SRC_URL="https://github.com/mongodb/specifications.git"
# needs to be set for resync-specs.sh
SPEC_SRC="$(realpath "../specifications")"
SCRIPT="$(realpath "./.evergreen/resync-specs.sh")"
# Clone the spec repo if the directory does not exist
if [[ ! -d $SPEC_SRC ]]; then
git clone $SRC_URL $SPEC_SRC
if [[ $? -ne 0 ]]; then
echo "Error: Failed to clone repository."
exit 1
fi
fi
# Set environment variable to the cloned spec repo for resync-specs.sh
export MDB_SPECS="$SPEC_SRC"
# Check that resync-specs.sh exists and is executable
if [[ ! -x $SCRIPT ]]; then
echo "Error: $SCRIPT not found or is not executable."
exit 1
fi
PR_DESC="spec_sync.txt"
# run python script that actually does all the resyncing
if ! [ -n "${CI:-}" ]
then
# we're running locally
python3 ./.evergreen/scripts/resync-all-specs.py
else
/opt/devtools/bin/python3.11 ./.evergreen/scripts/resync-all-specs.py --filename "$PR_DESC"
if [[ -f $PR_DESC ]]; then
# changes were made -> call scrypt to create PR for us
.evergreen/scripts/create-spec-pr.sh "$PR_DESC"
rm "$PR_DESC"
fi
fi

View File

@ -0,0 +1,26 @@
#!/bin/bash
# Get the debug data for an evergreen task.
set -eu
. ${DRIVERS_TOOLS}/.evergreen/get-distro.sh || true
get_distro || true
echo $DISTRO
echo $MARCH
echo $OS
set -x
uname -a || true
ls /etc/*release* || true
cc --version || true
gcc --version || true
clang --version || true
gcov --version || true
lcov --version || true
llvm-cov --version || true
echo $PATH
ls -la /usr/local/Cellar/llvm/*/bin/ || true
ls -la /usr/local/Cellar/ || true
scan-build --version || true
genhtml --version || true
valgrind --version || true
set +x

View File

@ -0,0 +1,13 @@
#!/bin/bash
set -eu
HERE=$(dirname ${BASH_SOURCE:-$0})
# Try to source the env file.
if [ -f $HERE/env.sh ]; then
echo "Sourcing env file"
source $HERE/env.sh
fi
uv run $HERE/run_server.py "$@"

View File

@ -0,0 +1,59 @@
from __future__ import annotations
import os
from typing import Any
from utils import DRIVERS_TOOLS, ROOT, get_test_options, run_command
def set_env(name: str, value: Any = "1") -> None:
os.environ[name] = str(value)
def start_server():
opts, extra_opts = get_test_options(
"Run a MongoDB server. All given flags will be passed to run-mongodb.sh in DRIVERS_TOOLS.",
require_sub_test_name=False,
allow_extra_opts=True,
)
test_name = opts.test_name
# drivers-evergreen-tools expects the version variable to be named MONGODB_VERSION.
if "VERSION" in os.environ:
os.environ["MONGODB_VERSION"] = os.environ["VERSION"]
if test_name == "auth_aws":
set_env("AUTH_AWS")
elif test_name == "load_balancer":
set_env("LOAD_BALANCER")
elif test_name == "search_index":
os.environ["TOPOLOGY"] = "replica_set"
os.environ["MONGODB_VERSION"] = "7.0"
if not os.environ.get("TEST_CRYPT_SHARED"):
set_env("SKIP_CRYPT_SHARED")
if opts.ssl:
extra_opts.append("--ssl")
if test_name != "ocsp":
certs = ROOT / "test/certificates"
set_env("TLS_CERT_KEY_FILE", certs / "client.pem")
set_env("TLS_PEM_KEY_FILE", certs / "server.pem")
set_env("TLS_CA_FILE", certs / "ca.pem")
if opts.auth:
extra_opts.append("--auth")
if opts.verbose:
extra_opts.append("-v")
elif opts.quiet:
extra_opts.append("-q")
cmd = ["bash", f"{DRIVERS_TOOLS}/.evergreen/run-mongodb.sh", "start", *extra_opts]
run_command(cmd, cwd=DRIVERS_TOOLS)
if __name__ == "__main__":
start_server()

View File

@ -0,0 +1,228 @@
from __future__ import annotations
import json
import logging
import os
import platform
import shlex
import shutil
import subprocess
import sys
from datetime import datetime
from pathlib import Path
from shutil import which
try:
import importlib_metadata
except ImportError:
from importlib import metadata as importlib_metadata
import pytest
from utils import DRIVERS_TOOLS, LOGGER, ROOT, run_command
AUTH = os.environ.get("AUTH", "noauth")
SSL = os.environ.get("SSL", "nossl")
UV_ARGS = os.environ.get("UV_ARGS", "")
TEST_PERF = os.environ.get("TEST_PERF")
GREEN_FRAMEWORK = os.environ.get("GREEN_FRAMEWORK")
TEST_ARGS = os.environ.get("TEST_ARGS", "").split()
TEST_NAME = os.environ.get("TEST_NAME")
SUB_TEST_NAME = os.environ.get("SUB_TEST_NAME")
def list_packages():
packages = set()
for distribution in importlib_metadata.distributions():
if distribution.name:
packages.add(distribution.name)
print("Package Version URL")
print("------------------- ----------- ----------------------------------------------------")
for name in sorted(packages):
distribution = importlib_metadata.distribution(name)
url = ""
if distribution.origin is not None:
url = distribution.origin.url
print(f"{name:20s}{distribution.version:12s}{url}")
print("------------------- ----------- ----------------------------------------------------\n")
def handle_perf(start_time: datetime):
end_time = datetime.now()
elapsed_secs = (end_time - start_time).total_seconds()
with open("results.json") as fid:
results = json.load(fid)
LOGGER.info("results.json:\n%s", json.dumps(results, indent=2))
results = dict(
status="PASS",
exit_code=0,
test_file="BenchMarkTests",
start=int(start_time.timestamp()),
end=int(end_time.timestamp()),
elapsed=elapsed_secs,
)
report = dict(failures=0, results=[results])
LOGGER.info("report.json\n%s", json.dumps(report, indent=2))
with open("report.json", "w", newline="\n") as fid:
json.dump(report, fid)
def handle_green_framework() -> None:
if GREEN_FRAMEWORK == "gevent":
from gevent import monkey
monkey.patch_all()
# Never run async tests with a framework.
if len(TEST_ARGS) <= 1:
TEST_ARGS.extend(["-m", "not default_async and default"])
else:
for i in range(len(TEST_ARGS) - 1):
if "-m" in TEST_ARGS[i]:
TEST_ARGS[i + 1] = f"not default_async and {TEST_ARGS[i + 1]}"
LOGGER.info(f"Running tests with {GREEN_FRAMEWORK}...")
def handle_c_ext() -> None:
if platform.python_implementation() != "CPython":
return
sys.path.insert(0, str(ROOT / "tools"))
from fail_if_no_c import main as fail_if_no_c
fail_if_no_c()
def handle_pymongocrypt() -> None:
import pymongocrypt
LOGGER.info(f"pymongocrypt version: {pymongocrypt.__version__})")
LOGGER.info(f"libmongocrypt version: {pymongocrypt.libmongocrypt_version()})")
def handle_aws_lambda() -> None:
env = os.environ.copy()
target_dir = ROOT / "test/lambda"
env["TEST_LAMBDA_DIRECTORY"] = str(target_dir)
env.setdefault("AWS_REGION", "us-east-1")
dirs = ["pymongo", "gridfs", "bson"]
# Remove the original .so files.
for dname in dirs:
so_paths = [f"{f.parent.name}/{f.name}" for f in (ROOT / dname).glob("*.so")]
for so_path in list(so_paths):
Path(so_path).unlink()
# Build the c extensions.
docker = which("docker") or which("podman")
if not docker:
raise ValueError("Could not find docker!")
image = "quay.io/pypa/manylinux2014_x86_64:latest"
run_command(
f'{docker} run --rm -v "{ROOT}:/src" --platform linux/amd64 {image} /src/test/lambda/build_internal.sh'
)
for dname in dirs:
target = ROOT / "test/lambda/mongodb" / dname
shutil.rmtree(target, ignore_errors=True)
shutil.copytree(ROOT / dname, target)
# Remove the new so files from the ROOT directory.
for dname in dirs:
so_paths = [f"{f.parent.name}/{f.name}" for f in (ROOT / dname).glob("*.so")]
for so_path in list(so_paths):
Path(so_path).unlink()
script_name = "run-deployed-lambda-aws-tests.sh"
run_command(f"bash {DRIVERS_TOOLS}/.evergreen/aws_lambda/{script_name}", env=env)
def run() -> None:
# Add diagnostic for python version.
print("Running with python", sys.version)
# List the installed packages.
list_packages()
# Handle green framework first so they can patch modules.
if GREEN_FRAMEWORK:
handle_green_framework()
# Ensure C extensions if applicable.
if not os.environ.get("NO_EXT"):
handle_c_ext()
if os.environ.get("PYMONGOCRYPT_LIB"):
handle_pymongocrypt()
LOGGER.info(f"Test setup:\n{AUTH=}\n{SSL=}\n{UV_ARGS=}\n{TEST_ARGS=}")
# Record the start time for a perf test.
if TEST_PERF:
start_time = datetime.now()
# Run mod_wsgi tests using the helper.
if TEST_NAME == "mod_wsgi":
from mod_wsgi_tester import test_mod_wsgi
test_mod_wsgi()
return
# Send kms tests to run remotely.
if TEST_NAME == "kms" and SUB_TEST_NAME in ["azure", "gcp"]:
from kms_tester import test_kms_send_to_remote
test_kms_send_to_remote(SUB_TEST_NAME)
return
# Handle doctests.
if TEST_NAME == "doctest":
from sphinx.cmd.build import main
result = main("-E -b doctest doc ./doc/_build/doctest".split())
sys.exit(result)
# Send ecs tests to run remotely.
if TEST_NAME == "auth_aws" and SUB_TEST_NAME == "ecs":
run_command(f"{DRIVERS_TOOLS}/.evergreen/auth_aws/aws_setup.sh ecs")
return
# Send OIDC tests to run remotely.
if (
TEST_NAME == "auth_oidc"
and SUB_TEST_NAME != "default"
and not SUB_TEST_NAME.endswith("-remote")
):
from oidc_tester import test_oidc_send_to_remote
test_oidc_send_to_remote(SUB_TEST_NAME)
return
# Run deployed aws lambda tests.
if TEST_NAME == "aws_lambda":
handle_aws_lambda()
return
if os.environ.get("DEBUG_LOG"):
TEST_ARGS.extend(f"-o log_cli_level={logging.DEBUG}".split())
if os.environ.get("COVERAGE"):
binary = sys.executable.replace(os.sep, "/")
cmd = f"{binary} -m coverage run -m pytest {' '.join(TEST_ARGS)} {' '.join(sys.argv[1:])}"
result = subprocess.run(shlex.split(cmd), check=False) # noqa: S603
cmd = f"{binary} -m coverage report"
subprocess.run(shlex.split(cmd), check=False) # noqa: S603
if result.returncode != 0:
print(result.stderr)
sys.exit(result.returncode)
# Run local tests.
ret = pytest.main(TEST_ARGS + sys.argv[1:])
if ret != 0:
sys.exit(ret)
# Handle perf test post actions.
if TEST_PERF:
handle_perf(start_time)
if __name__ == "__main__":
run()

View File

@ -0,0 +1,58 @@
#!/bin/bash
# Set up development environment.
set -eu
HERE=$(dirname ${BASH_SOURCE:-$0})
HERE="$( cd -- "$HERE" > /dev/null 2>&1 && pwd )"
ROOT=$(dirname "$(dirname $HERE)")
# Source the env files to pick up common variables.
if [ -f $HERE/env.sh ]; then
. $HERE/env.sh
fi
# Get variables defined in test-env.sh.
if [ -f $HERE/test-env.sh ]; then
. $HERE/test-env.sh
fi
# Ensure dependencies are installed.
bash $HERE/install-dependencies.sh
# Handle the value for UV_PYTHON.
. $HERE/setup-uv-python.sh
# Only run the next part if not running on CI.
if [ -z "${CI:-}" ]; then
# Add the default install path to the path if needed.
if [ -z "${PYMONGO_BIN_DIR:-}" ]; then
export PATH="$PATH:$HOME/.local/bin"
fi
# Set up venv, making sure c extensions build unless disabled.
if [ -z "${NO_EXT:-}" ]; then
export PYMONGO_C_EXT_MUST_BUILD=1
fi
(
cd $ROOT && uv sync
)
# Set up build utilities on Windows spawn hosts.
if [ -f $HOME/.visualStudioEnv.sh ]; then
set +u
SSH_TTY=1 source $HOME/.visualStudioEnv.sh
set -u
fi
# Only set up pre-commit if we are in a git checkout.
if [ -f $HERE/.git ]; then
if ! command -v pre-commit &>/dev/null; then
uv tool install pre-commit
fi
if [ ! -f .git/hooks/pre-commit ]; then
uvx pre-commit install
fi
fi
fi

View File

@ -0,0 +1,55 @@
#!/bin/bash
# Set up the system on an evergreen host.
set -eu
HERE=$(dirname ${BASH_SOURCE:-$0})
pushd "$(dirname "$(dirname $HERE)")"
echo "Setting up system..."
bash .evergreen/scripts/configure-env.sh
source .evergreen/scripts/env.sh
bash $DRIVERS_TOOLS/.evergreen/setup.sh
popd
# Run spawn host-specific tasks.
if [ -z "${CI:-}" ]; then
bash $HERE/setup-dev-env.sh
fi
# Enable core dumps if enabled on the machine
# Copied from https://github.com/mongodb/mongo/blob/master/etc/evergreen.yml
if [ -f /proc/self/coredump_filter ]; then
# Set the shell process (and its children processes) to dump ELF headers (bit 4),
# anonymous shared mappings (bit 1), and anonymous private mappings (bit 0).
echo 0x13 >/proc/self/coredump_filter
if [ -f /sbin/sysctl ]; then
# Check that the core pattern is set explicitly on our distro image instead
# of being the OS's default value. This ensures that coredump names are consistent
# across distros and can be picked up by Evergreen.
core_pattern=$(/sbin/sysctl -n "kernel.core_pattern")
if [ "$core_pattern" = "dump_%e.%p.core" ]; then
echo "Enabling coredumps"
ulimit -c unlimited
fi
fi
fi
if [ "$(uname -s)" = "Darwin" ]; then
core_pattern_mac=$(/usr/sbin/sysctl -n "kern.corefile")
if [ "$core_pattern_mac" = "dump_%N.%P.core" ]; then
echo "Enabling coredumps"
ulimit -c unlimited
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

@ -0,0 +1,26 @@
#!/bin/bash
# Set up the test environment, including secrets and services.
set -eu
# Supported/used environment variables:
# AUTH Set to enable authentication. Defaults to "noauth"
# SSL Set to enable SSL. Defaults to "nossl"
# GREEN_FRAMEWORK The green framework to test with, if any.
# COVERAGE If non-empty, run the test suite with coverage.
# COMPRESSORS If non-empty, install appropriate compressor.
# LIBMONGOCRYPT_URL The URL to download libmongocrypt.
# TEST_CRYPT_SHARED If non-empty, install crypt_shared lib.
# MONGODB_API_VERSION The mongodb api version to use in tests.
# MONGODB_URI If non-empty, use as the MONGODB_URI in tests.
# USE_ACTIVE_VENV If non-empty, use the active virtual environment.
SCRIPT_DIR=$(dirname ${BASH_SOURCE:-$0})
# Try to source the env file.
if [ -f $SCRIPT_DIR/env.sh ]; then
source $SCRIPT_DIR/env.sh
fi
echo "Setting up tests with args \"$*\"..."
uv run ${USE_ACTIVE_VENV:+--active} "$SCRIPT_DIR/setup_tests.py" "$@"
echo "Setting up tests with args \"$*\"... done."

View File

@ -0,0 +1,53 @@
#!/bin/bash
# Set up the UV_PYTHON variable.
set -eu
HERE=$(dirname ${BASH_SOURCE:-$0})
HERE="$( cd -- "$HERE" > /dev/null 2>&1 && pwd )"
# Use min supported version by default.
_python="3.10"
# Source the env files to pick up common variables.
if [ -f $HERE/env.sh ]; then
. $HERE/env.sh
fi
# Get variables defined in test-env.sh.
if [ -f $HERE/test-env.sh ]; then
. $HERE/test-env.sh
fi
if [ -z "${UV_PYTHON:-}" ]; then
set -x
# Translate a TOOLCHAIN_VERSION to UV_PYTHON.
if [ -n "${TOOLCHAIN_VERSION:-}" ]; then
_python=$TOOLCHAIN_VERSION
if [ "$(uname -s)" = "Darwin" ]; then
if [[ "$_python" == *"t"* ]]; then
binary_name="python3t"
framework_dir="PythonT"
else
binary_name="python3"
framework_dir="Python"
fi
_python=$(echo "$_python" | sed 's/t//g')
_python="/Library/Frameworks/$framework_dir.Framework/Versions/$_python/bin/$binary_name"
elif [ "Windows_NT" = "${OS:-}" ]; then
_python=$(echo $_python | cut -d. -f1,2 | sed 's/\.//g; s/t//g')
if [[ "$TOOLCHAIN_VERSION" == *"t"* ]]; then
_exe="python${TOOLCHAIN_VERSION}.exe"
else
_exe="python.exe"
fi
if [ -n "${IS_WIN32:-}" ]; then
_python="C:/python/32/Python${_python}/${_exe}"
else
_python="C:/python/Python${_python}/${_exe}"
fi
elif [ -d "/opt/python/$_python/bin" ]; then
_python="/opt/python/$_python/bin/python3"
fi
fi
export UV_PYTHON="$_python"
fi

View File

@ -0,0 +1,491 @@
from __future__ import annotations
import base64
import os
import platform
import shutil
import stat
from pathlib import Path
from urllib import request
from utils import (
DRIVERS_TOOLS,
ENV_FILE,
HERE,
LOGGER,
PLATFORM,
ROOT,
TEST_SUITE_MAP,
Distro,
get_test_options,
read_env,
run_command,
write_env,
)
# Passthrough environment variables.
PASS_THROUGH_ENV = [
"GREEN_FRAMEWORK",
"NO_EXT",
"MONGODB_API_VERSION",
"DEBUG_LOG",
"UV_PYTHON",
"REQUIRE_FIPS",
"IS_WIN32",
]
# Map the test name to test extra.
EXTRAS_MAP = {
"auth_aws": "aws",
"auth_oidc": "aws",
"encryption": "encryption",
"enterprise_auth": "gssapi",
"kms": "encryption",
"ocsp": "ocsp",
"pyopenssl": "ocsp",
}
# Map the test name to test group.
GROUP_MAP = dict(mockupdb="mockupdb", perf="perf")
# The python version used for perf tests.
PERF_PYTHON_VERSION = "3.10.11"
def is_set(var: str) -> bool:
value = os.environ.get(var, "")
return len(value.strip()) > 0
def get_distro() -> Distro:
name = ""
version_id = ""
arch = platform.machine()
with open("/etc/os-release") as fid:
for line in fid.readlines():
line = line.replace('"', "") # noqa: PLW2901
if line.startswith("NAME="):
_, _, name = line.strip().partition("=")
if line.startswith("VERSION_ID="):
_, _, version_id = line.strip().partition("=")
return Distro(name=name, version_id=version_id, arch=arch)
def setup_libmongocrypt():
target = ""
if PLATFORM == "windows":
# PYTHON-2808 Ensure this machine has the CA cert for google KMS.
if is_set("TEST_FLE_GCP_AUTO"):
run_command('powershell.exe "Invoke-WebRequest -URI https://oauth2.googleapis.com/"')
target = "windows-test"
elif PLATFORM == "darwin":
target = "macos"
else:
distro = get_distro()
if distro.name.startswith("Debian"):
target = f"debian{distro.version_id}"
elif distro.name.startswith("Ubuntu"):
if distro.version_id == "20.04":
target = "debian11"
elif distro.version_id == "22.04":
target = "debian12"
elif distro.version_id == "24.04":
target = "debian13"
elif distro.name.startswith("Red Hat"):
if distro.version_id.startswith("7"):
target = "rhel-70-64-bit"
elif distro.version_id.startswith("8"):
if distro.arch == "aarch64":
target = "rhel-82-arm64"
else:
target = "rhel-80-64-bit"
if not is_set("LIBMONGOCRYPT_URL"):
if not target:
raise ValueError("Cannot find libmongocrypt target for current platform!")
url = f"https://s3.amazonaws.com/mciuploads/libmongocrypt/{target}/master/latest/libmongocrypt.tar.gz"
else:
url = os.environ["LIBMONGOCRYPT_URL"]
shutil.rmtree(HERE / "libmongocrypt", ignore_errors=True)
LOGGER.info(f"Fetching {url}...")
with request.urlopen(request.Request(url), timeout=15.0) as response: # noqa: S310
if response.status == 200:
with Path("libmongocrypt.tar.gz").open("wb") as f:
f.write(response.read())
Path("libmongocrypt").mkdir()
run_command("tar -xzf libmongocrypt.tar.gz -C libmongocrypt")
LOGGER.info(f"Fetching {url}... done.")
run_command("ls -la libmongocrypt")
run_command("ls -la libmongocrypt/nocrypto")
if PLATFORM == "windows":
# libmongocrypt's windows dll is not marked executable.
run_command("chmod +x libmongocrypt/nocrypto/bin/mongocrypt.dll")
def load_config_from_file(path: str | Path) -> dict[str, str]:
config = read_env(path)
for key, value in config.items():
write_env(key, value)
return config
def get_secrets(name: str) -> dict[str, str]:
secrets_dir = Path(f"{DRIVERS_TOOLS}/.evergreen/secrets_handling")
run_command(f"bash {secrets_dir.as_posix()}/setup-secrets.sh {name}", cwd=secrets_dir)
return load_config_from_file(secrets_dir / "secrets-export.sh")
def handle_test_env() -> None:
opts, _ = get_test_options("Set up the test environment and services.")
test_name = opts.test_name
sub_test_name = opts.sub_test_name
AUTH = "auth" if opts.auth else "noauth"
SSL = "ssl" if opts.ssl else "nossl"
TEST_ARGS = ""
# Start compiling the args we'll pass to uv.
UV_ARGS = ["--extra test --no-group dev"]
# If USE_ACTIVE_VENV is set, add --active to UV_ARGS so run-tests.sh uses the active venv.
if is_set("USE_ACTIVE_VENV"):
UV_ARGS.append("--active")
test_title = test_name
if sub_test_name:
test_title += f" {sub_test_name}"
# Create the test env file with the initial set of values.
with ENV_FILE.open("w", newline="\n") as fid:
fid.write("#!/usr/bin/env bash\n")
fid.write("set +x\n")
ENV_FILE.chmod(ENV_FILE.stat().st_mode | stat.S_IEXEC)
write_env("PIP_QUIET") # Quiet by default.
write_env("PIP_PREFER_BINARY") # Prefer binary dists by default.
# Set an environment variable for the test name and sub test name.
write_env(f"TEST_{test_name.upper()}")
write_env("TEST_NAME", test_name)
write_env("SUB_TEST_NAME", sub_test_name)
# Handle pass through env vars.
for var in PASS_THROUGH_ENV:
if is_set(var) or getattr(opts, var.lower(), ""):
write_env(var, os.environ.get(var, getattr(opts, var.lower(), "")))
if extra := EXTRAS_MAP.get(test_name, ""):
UV_ARGS.append(f"--extra {extra}")
if group := GROUP_MAP.get(test_name, ""):
UV_ARGS.append(f"--group {group}")
if opts.test_min_deps:
UV_ARGS.append("--resolution=lowest-direct")
if test_name == "auth_oidc":
from oidc_tester import setup_oidc
config = setup_oidc(sub_test_name)
if not config:
AUTH = "noauth"
if test_name in ["aws_lambda", "search_index"]:
env = os.environ.copy()
env["MONGODB_VERSION"] = "7.0"
env["LAMBDA_STACK_NAME"] = "dbx-python-lambda"
write_env("LAMBDA_STACK_NAME", env["LAMBDA_STACK_NAME"])
run_command(
f"bash {DRIVERS_TOOLS}/.evergreen/atlas/setup-atlas-cluster.sh",
env=env,
cwd=DRIVERS_TOOLS,
)
if test_name == "search_index":
AUTH = "auth"
if test_name == "ocsp":
SSL = "ssl"
write_env("AUTH", AUTH)
write_env("SSL", SSL)
LOGGER.info(f"Setting up '{test_title}' with {AUTH=} and {SSL=}...")
if test_name == "aws_lambda":
UV_ARGS.append("--group pip")
# Store AWS creds if they were given.
if "AWS_ACCESS_KEY_ID" in os.environ:
for key in ["AWS_ACCESS_KEY_ID", "AWS_SECRET_ACCESS_KEY", "AWS_SESSION_TOKEN"]:
if key in os.environ:
write_env(key, os.environ[key])
if AUTH != "noauth":
if test_name == "auth_oidc":
DB_USER = config["OIDC_ADMIN_USER"]
DB_PASSWORD = config["OIDC_ADMIN_PWD"]
elif test_name == "search_index":
config = read_env(f"{DRIVERS_TOOLS}/.evergreen/atlas/secrets-export.sh")
DB_USER = config["DRIVERS_ATLAS_LAMBDA_USER"]
DB_PASSWORD = config["DRIVERS_ATLAS_LAMBDA_PASSWORD"]
write_env("MONGODB_URI", config["MONGODB_URI"])
else:
DB_USER = "bob"
DB_PASSWORD = "pwd123" # noqa: S105
write_env("DB_USER", DB_USER)
write_env("DB_PASSWORD", DB_PASSWORD)
LOGGER.info("Added auth, DB_USER: %s", DB_USER)
if is_set("MONGODB_URI"):
write_env("PYMONGO_MUST_CONNECT", "true")
if opts.disable_test_commands:
write_env("PYMONGO_DISABLE_TEST_COMMANDS", "1")
if test_name == "enterprise_auth":
config = get_secrets("drivers/enterprise_auth")
if PLATFORM == "windows":
LOGGER.info("Setting GSSAPI_PASS")
write_env("GSSAPI_PASS", config["SASL_PASS"])
write_env("GSSAPI_CANONICALIZE", "true")
else:
# BUILD-3830
krb_conf = ROOT / ".evergreen/krb5.conf.empty"
krb_conf.touch()
write_env("KRB5_CONFIG", krb_conf)
LOGGER.info("Writing keytab")
keytab = base64.b64decode(config["KEYTAB_BASE64"])
keytab_file = ROOT / ".evergreen/drivers.keytab"
with keytab_file.open("wb") as fid:
fid.write(keytab)
principal = config["PRINCIPAL"]
LOGGER.info("Running kinit")
os.environ["KRB5_CONFIG"] = str(krb_conf)
cmd = f"kinit -k -t {keytab_file} -p {principal}"
run_command(cmd)
LOGGER.info("Setting GSSAPI variables")
write_env("GSSAPI_HOST", config["SASL_HOST"])
write_env("GSSAPI_PORT", config["SASL_PORT"])
write_env("GSSAPI_PRINCIPAL", config["PRINCIPAL"])
if test_name == "doctest":
UV_ARGS.append("--extra docs")
if test_name == "load_balancer":
SINGLE_MONGOS_LB_URI = os.environ.get(
"SINGLE_MONGOS_LB_URI", "mongodb://127.0.0.1:8000/?loadBalanced=true"
)
MULTI_MONGOS_LB_URI = os.environ.get(
"MULTI_MONGOS_LB_URI", "mongodb://127.0.0.1:8001/?loadBalanced=true"
)
if SSL != "nossl":
SINGLE_MONGOS_LB_URI += "&tls=true"
MULTI_MONGOS_LB_URI += "&tls=true"
write_env("SINGLE_MONGOS_LB_URI", SINGLE_MONGOS_LB_URI)
write_env("MULTI_MONGOS_LB_URI", MULTI_MONGOS_LB_URI)
if not DRIVERS_TOOLS:
raise RuntimeError("Missing DRIVERS_TOOLS")
cmd = f'bash "{DRIVERS_TOOLS}/.evergreen/run-load-balancer.sh" start'
run_command(cmd)
if test_name == "mod_wsgi":
from mod_wsgi_tester import setup_mod_wsgi
setup_mod_wsgi(sub_test_name)
if test_name == "ocsp":
if sub_test_name:
os.environ["OCSP_SERVER_TYPE"] = sub_test_name
for name in ["OCSP_SERVER_TYPE", "ORCHESTRATION_FILE"]:
if name not in os.environ:
raise ValueError(f"Please set {name}")
server_type = os.environ["OCSP_SERVER_TYPE"]
orch_file = os.environ["ORCHESTRATION_FILE"]
ocsp_algo = orch_file.split("-")[0]
if server_type == "no-responder":
tls_should_succeed = "false" if "mustStaple-disableStapling" in orch_file else "true"
else:
tls_should_succeed = "true" if "valid" in server_type else "false"
write_env("OCSP_TLS_SHOULD_SUCCEED", tls_should_succeed)
write_env("CA_FILE", f"{DRIVERS_TOOLS}/.evergreen/ocsp/{ocsp_algo}/ca.pem")
if server_type != "no-responder":
env = os.environ.copy()
env["SERVER_TYPE"] = server_type
env["OCSP_ALGORITHM"] = ocsp_algo
run_command(f"bash {DRIVERS_TOOLS}/.evergreen/ocsp/setup.sh", env=env)
# The mock OCSP responder MUST BE started before the mongod as the mongod expects that
# a responder will be available upon startup.
version = os.environ.get("VERSION", "latest")
cmd = [
"bash",
f"{DRIVERS_TOOLS}/.evergreen/run-mongodb.sh",
"start",
"--ssl",
"--version",
version,
]
if opts.verbose:
cmd.append("-v")
elif opts.quiet:
cmd.append("-q")
run_command(cmd, cwd=DRIVERS_TOOLS)
if SSL != "nossl":
if not DRIVERS_TOOLS:
raise RuntimeError("Missing DRIVERS_TOOLS")
write_env("CLIENT_PEM", f"{DRIVERS_TOOLS}/.evergreen/x509gen/client.pem")
write_env("CA_PEM", f"{DRIVERS_TOOLS}/.evergreen/x509gen/ca.pem")
compressors = os.environ.get("COMPRESSORS") or opts.compressor
if compressors == "snappy":
UV_ARGS.append("--extra snappy")
elif compressors == "zstd":
UV_ARGS.append("--extra zstd")
if test_name in ["encryption", "kms"]:
# Check for libmongocrypt download.
if not (ROOT / "libmongocrypt").exists():
setup_libmongocrypt()
if not opts.test_min_deps:
UV_ARGS.append(
"--with pymongocrypt@git+https://github.com/mongodb/libmongocrypt@master#subdirectory=bindings/python"
)
# Use the nocrypto build to avoid dependency issues with older windows/python versions.
BASE = ROOT / "libmongocrypt/nocrypto"
if PLATFORM == "linux":
if (BASE / "lib/libmongocrypt.so").exists():
PYMONGOCRYPT_LIB = BASE / "lib/libmongocrypt.so"
else:
PYMONGOCRYPT_LIB = BASE / "lib64/libmongocrypt.so"
elif PLATFORM == "darwin":
PYMONGOCRYPT_LIB = BASE / "lib/libmongocrypt.dylib"
else:
PYMONGOCRYPT_LIB = BASE / "bin/mongocrypt.dll"
if not PYMONGOCRYPT_LIB.exists():
raise RuntimeError("Cannot find libmongocrypt shared object file")
write_env("PYMONGOCRYPT_LIB", PYMONGOCRYPT_LIB.as_posix())
# PATH is updated by configure-env.sh for access to mongocryptd.
if test_name == "encryption":
if not DRIVERS_TOOLS:
raise RuntimeError("Missing DRIVERS_TOOLS")
csfle_dir = Path(f"{DRIVERS_TOOLS}/.evergreen/csfle")
run_command(f"bash {csfle_dir.as_posix()}/setup-secrets.sh", cwd=csfle_dir)
load_config_from_file(csfle_dir / "secrets-export.sh")
run_command(f"bash {csfle_dir.as_posix()}/start-servers.sh")
if sub_test_name == "pyopenssl":
UV_ARGS.append("--extra ocsp")
if opts.crypt_shared:
config = read_env(f"{DRIVERS_TOOLS}/mo-expansion.sh")
CRYPT_SHARED_DIR = Path(config["CRYPT_SHARED_LIB_PATH"]).parent.as_posix()
LOGGER.info("Using crypt_shared_dir %s", CRYPT_SHARED_DIR)
if PLATFORM == "windows":
write_env("PATH", f"{CRYPT_SHARED_DIR}:$PATH")
else:
write_env(
"DYLD_FALLBACK_LIBRARY_PATH",
f"{CRYPT_SHARED_DIR}:${{DYLD_FALLBACK_LIBRARY_PATH:-}}",
)
write_env("LD_LIBRARY_PATH", f"{CRYPT_SHARED_DIR}:${{LD_LIBRARY_PATH:-}}")
if test_name == "kms":
from kms_tester import setup_kms
setup_kms(sub_test_name)
if test_name == "auth_aws" and sub_test_name != "ecs-remote":
auth_aws_dir = f"{DRIVERS_TOOLS}/.evergreen/auth_aws"
if "AWS_ROLE_SESSION_NAME" in os.environ:
write_env("AWS_ROLE_SESSION_NAME")
if sub_test_name != "ecs":
aws_setup = f"{auth_aws_dir}/aws_setup.sh"
run_command(f"bash {aws_setup} {sub_test_name}")
creds = read_env(f"{auth_aws_dir}/test-env.sh")
for name, value in creds.items():
write_env(name, value)
else:
run_command(f"bash {auth_aws_dir}/setup-secrets.sh")
if test_name == "atlas_connect":
secrets = get_secrets("drivers/atlas_connect")
# Write file with Atlas X509 client certificate:
decoded = base64.b64decode(secrets["ATLAS_X509_DEV_CERT_BASE64"]).decode("utf8")
cert_file = ROOT / ".evergreen/atlas_x509_dev_client_certificate.pem"
with cert_file.open("w") as file:
file.write(decoded)
write_env(
"ATLAS_X509_DEV_WITH_CERT",
secrets["ATLAS_X509_DEV"] + "&tlsCertificateKeyFile=" + str(cert_file),
)
# We do not want the default client_context to be initialized.
write_env("DISABLE_CONTEXT")
if test_name == "numpy":
UV_ARGS.append("--with numpy")
if test_name == "perf":
data_dir = ROOT / "specifications/source/benchmarking/data"
if not data_dir.exists():
run_command("git clone --depth 1 https://github.com/mongodb/specifications.git")
run_command("tar xf extended_bson.tgz", cwd=data_dir)
run_command("tar xf parallel.tgz", cwd=data_dir)
run_command("tar xf single_and_multi_document.tgz", cwd=data_dir)
write_env("TEST_PATH", str(data_dir))
write_env("OUTPUT_FILE", str(ROOT / "results.json"))
# Overwrite the UV_PYTHON from the env.sh file.
write_env("UV_PYTHON", "")
UV_ARGS.append(f"--python={PERF_PYTHON_VERSION}")
# PYTHON-4769 Run perf_test.py directly otherwise pytest's test collection negatively
# affects the benchmark results.
if sub_test_name == "sync":
TEST_ARGS = f"test/performance/perf_test.py {TEST_ARGS}"
else:
TEST_ARGS = f"test/performance/async_perf_test.py {TEST_ARGS}"
# Add coverage if requested.
# Only cover CPython. PyPy reports suspiciously low coverage.
if opts.cov and platform.python_implementation() == "CPython":
# Keep in sync with combine-coverage.sh.
# coverage >=5 is needed for relative_files=true.
UV_ARGS.append("--group coverage")
write_env("COVERAGE")
if opts.green_framework:
framework = opts.green_framework or os.environ["GREEN_FRAMEWORK"]
UV_ARGS.append(f"--group {framework}")
if framework == "gevent" and opts.test_min_deps:
# PYTHON-5729. This can be removed when the min supported gevent is moved to 25.9.1.
UV_ARGS.append('--with "setuptools==81.0"')
else:
TEST_ARGS = f"-v --durations=5 {TEST_ARGS}"
TEST_SUITE = TEST_SUITE_MAP.get(test_name)
if TEST_SUITE:
TEST_ARGS = f"-m {TEST_SUITE} {TEST_ARGS}"
write_env("TEST_ARGS", TEST_ARGS)
write_env("UV_ARGS", " ".join(UV_ARGS))
LOGGER.info(f"Setting up test '{test_title}' with {AUTH=} and {SSL=}... done.")
if __name__ == "__main__":
handle_test_env()

View File

@ -0,0 +1,14 @@
#!/bin/bash
# Stop a server that was started using run-mongodb.sh in DRIVERS_TOOLS.
set -eu
HERE=$(dirname ${BASH_SOURCE:-$0})
HERE="$( cd -- "$HERE" > /dev/null 2>&1 && pwd )"
# Try to source the env file.
if [ -f $HERE/env.sh ]; then
echo "Sourcing env file"
source $HERE/env.sh
fi
bash ${DRIVERS_TOOLS}/.evergreen/run-mongodb.sh stop

View File

@ -0,0 +1,24 @@
#!/bin/bash
# Tear down any services that were used by tests.
set -eu
SCRIPT_DIR=$(dirname ${BASH_SOURCE:-$0})
# Try to source the env file.
if [ -f $SCRIPT_DIR/env.sh ]; then
echo "Sourcing env inputs"
. $SCRIPT_DIR/env.sh
else
echo "Not sourcing env inputs"
fi
# Handle test inputs.
if [ -f $SCRIPT_DIR/test-env.sh ]; then
echo "Sourcing test inputs"
. $SCRIPT_DIR/test-env.sh
else
echo "Missing test inputs, please run 'just setup-tests'"
fi
# Teardown the test runner.
uv run $SCRIPT_DIR/teardown_tests.py

View File

@ -0,0 +1,64 @@
from __future__ import annotations
import os
import shutil
import sys
from pathlib import Path
from utils import DRIVERS_TOOLS, LOGGER, ROOT, run_command
TEST_NAME = os.environ.get("TEST_NAME", "unconfigured")
SUB_TEST_NAME = os.environ.get("SUB_TEST_NAME")
LOGGER.info(f"Tearing down tests of type '{TEST_NAME}'...")
# Shut down csfle servers if applicable.
if TEST_NAME == "encryption":
run_command(f"bash {DRIVERS_TOOLS}/.evergreen/csfle/stop-servers.sh")
# Shut down load balancer if applicable.
elif TEST_NAME == "load-balancer":
run_command(f"bash {DRIVERS_TOOLS}/.evergreen/run-load-balancer.sh stop")
# Tear down kms VM if applicable.
elif TEST_NAME == "kms" and SUB_TEST_NAME in ["azure", "gcp"]:
from kms_tester import teardown_kms
teardown_kms(SUB_TEST_NAME)
# Tear down OIDC if applicable.
elif TEST_NAME == "auth_oidc":
from oidc_tester import teardown_oidc
teardown_oidc(SUB_TEST_NAME)
# Tear down ocsp if applicable.
elif TEST_NAME == "ocsp":
run_command(f"bash {DRIVERS_TOOLS}/.evergreen/ocsp/teardown.sh")
# Tear down atlas cluster if applicable.
if TEST_NAME in ["aws_lambda", "search_index"]:
run_command(f"bash {DRIVERS_TOOLS}/.evergreen/atlas/teardown-atlas-cluster.sh")
# Tear down auth_aws if applicable.
# We do not run web-identity hosts on macos, because the hosts lack permissions,
# so there is no reason to run the teardown, which would error with a 401.
elif TEST_NAME == "auth_aws" and sys.platform != "darwin":
run_command(f"bash {DRIVERS_TOOLS}/.evergreen/auth_aws/teardown.sh")
# Tear down perf if applicable.
elif TEST_NAME == "perf":
shutil.rmtree(ROOT / "specifications", ignore_errors=True)
Path(os.environ["OUTPUT_FILE"]).unlink(missing_ok=True)
# Tear down mog_wsgi if applicable.
elif TEST_NAME == "mod_wsgi":
from mod_wsgi_tester import teardown_mod_wsgi
teardown_mod_wsgi()
# Tear down coverage if applicable.
if os.environ.get("COVERAGE"):
shutil.rmtree(".pytest_cache", ignore_errors=True)
LOGGER.info(f"Tearing down tests of type '{TEST_NAME}'... done.")

View File

@ -0,0 +1,57 @@
#!/bin/bash
# shellcheck disable=SC2154
# Upload a coverate report to codecov.
set -eu
HERE=$(dirname ${BASH_SOURCE:-$0})
ROOT=$(dirname "$(dirname $HERE)")
pushd $ROOT > /dev/null
export FNAME=coverage.xml
REQUESTER=${requester:-}
if [ ! -f ".coverage" ]; then
echo "There are no coverage results, not running codecov"
exit 0
fi
if [[ "${REQUESTER}" == "github_pr" || "${REQUESTER}" == "commit" ]]; then
echo "Uploading codecov for $REQUESTER..."
else
echo "Error: requester must be 'github_pr' or 'commit', got '${REQUESTER}'" >&2
exit 1
fi
printf 'sha: %s\n' "$github_commit"
printf 'flag: %s-%s\n' "$build_variant" "$task_name"
printf 'file: %s\n' "$FNAME"
uv tool run --with "coverage[toml]" coverage xml
codecov_args=(
upload-process
--report-type coverage
--disable-search
--fail-on-error
--git-service github
--token "${CODECOV_TOKEN}"
--sha "${github_commit}"
--flag "${build_variant}-${task_name}"
--file "${FNAME}"
)
if [ -n "${github_pr_number:-}" ]; then
printf 'branch: %s:%s\n' "$github_author" "$github_pr_head_branch"
printf 'pr: %s\n' "$github_pr_number"
uv tool run --from codecov-cli codecovcli \
"${codecov_args[@]}" \
--pr "${github_pr_number}" \
--branch "${github_author}:${github_pr_head_branch}"
else
printf 'branch: %s\n' "$branch_name"
uv tool run --from codecov-cli codecovcli \
"${codecov_args[@]}" \
--branch "${branch_name}"
fi
echo "Uploading codecov for $REQUESTER... done."
popd > /dev/null

View File

@ -0,0 +1,4 @@
#!/bin/bash
# Upload a coverate report to s3.
set -eu
aws s3 cp htmlcov/ s3://"$1"/coverage/"$2"/"$3"/htmlcov/ --recursive --acl public-read --region us-east-1

228
.evergreen/scripts/utils.py Normal file
View File

@ -0,0 +1,228 @@
from __future__ import annotations
import argparse
import dataclasses
import logging
import os
import shlex
import subprocess
import sys
from pathlib import Path
from typing import Any
HERE = Path(__file__).absolute().parent
ROOT = HERE.parent.parent
DRIVERS_TOOLS = os.environ.get("DRIVERS_TOOLS", "").replace(os.sep, "/")
TMP_DRIVER_FILE = "/tmp/mongo-python-driver.tgz" # noqa: S108
LOGGER = logging.getLogger("test")
logging.basicConfig(level=logging.INFO, format="%(levelname)-8s %(message)s")
ENV_FILE = HERE / "test-env.sh"
PLATFORM = "windows" if os.name == "nt" else sys.platform.lower()
@dataclasses.dataclass
class Distro:
name: str
version_id: str
arch: str
# Map the test name to a test suite.
TEST_SUITE_MAP = {
"atlas_connect": "atlas_connect",
"auth_aws": "auth_aws",
"auth_oidc": "auth_oidc",
"default": "",
"default_async": "default_async",
"default_sync": "default",
"encryption": "encryption",
"enterprise_auth": "auth",
"search_index": "search_index",
"kms": "kms",
"load_balancer": "load_balancer",
"mockupdb": "mockupdb",
"ocsp": "ocsp",
"perf": "perf",
"numpy": "",
}
# Tests that require a sub test suite.
SUB_TEST_REQUIRED = ["auth_aws", "auth_oidc", "kms", "mod_wsgi", "perf"]
EXTRA_TESTS = ["mod_wsgi", "aws_lambda", "doctest"]
# Tests that do not use run-mongodb directly.
NO_RUN_ORCHESTRATION = [
"auth_oidc",
"atlas_connect",
"aws_lambda",
"mockupdb",
"ocsp",
]
# Mapping of env variables to options
OPTION_TO_ENV_VAR = {"cov": "COVERAGE", "crypt_shared": "TEST_CRYPT_SHARED"}
def get_test_options(
description, require_sub_test_name=True, allow_extra_opts=False
) -> tuple[argparse.Namespace, list[str]]:
parser = argparse.ArgumentParser(
description=description, formatter_class=argparse.RawDescriptionHelpFormatter
)
if require_sub_test_name:
parser.add_argument(
"test_name",
choices=sorted(list(TEST_SUITE_MAP) + EXTRA_TESTS),
nargs="?",
default="default",
help="The optional name of the test suite to set up, typically the same name as a pytest marker.",
)
parser.add_argument(
"sub_test_name", nargs="?", help="The optional sub test name, for example 'azure'."
)
else:
parser.add_argument(
"test_name",
choices=set(list(TEST_SUITE_MAP) + EXTRA_TESTS) - set(NO_RUN_ORCHESTRATION),
nargs="?",
default="default",
help="The optional name of the test suite to be run, which informs the server configuration.",
)
parser.add_argument(
"--verbose", "-v", action="store_true", help="Whether to log at the DEBUG level."
)
parser.add_argument(
"--quiet", "-q", action="store_true", help="Whether to log at the WARNING level."
)
parser.add_argument("--auth", action="store_true", help="Whether to add authentication.")
parser.add_argument("--ssl", action="store_true", help="Whether to add TLS configuration.")
parser.add_argument(
"--test-min-deps", action="store_true", help="Test against minimum dependency versions"
)
# Add the test modifiers.
if require_sub_test_name:
parser.add_argument(
"--debug-log", action="store_true", help="Enable pymongo standard logging."
)
parser.add_argument("--cov", action="store_true", help="Add test coverage.")
parser.add_argument(
"--green-framework",
nargs=1,
choices=["gevent"],
help="Optional green framework to test against.",
)
parser.add_argument(
"--compressor",
nargs=1,
choices=["zlib", "zstd", "snappy"],
help="Optional compression algorithm.",
)
parser.add_argument("--crypt-shared", action="store_true", help="Test with crypt_shared.")
parser.add_argument("--no-ext", action="store_true", help="Run without c extensions.")
parser.add_argument(
"--mongodb-api-version", choices=["1"], help="MongoDB stable API version to use."
)
parser.add_argument(
"--disable-test-commands", action="store_true", help="Disable test commands."
)
# Get the options.
if not allow_extra_opts:
opts, extra_opts = parser.parse_args(), []
else:
opts, extra_opts = parser.parse_known_args()
# Convert list inputs to strings.
for name in vars(opts):
value = getattr(opts, name)
if isinstance(value, list):
setattr(opts, name, value[0])
# Handle validation and environment variable overrides.
test_name = opts.test_name
sub_test_name = opts.sub_test_name if require_sub_test_name else ""
if require_sub_test_name and test_name in SUB_TEST_REQUIRED and not sub_test_name:
raise ValueError(f"Test '{test_name}' requires a sub_test_name")
handle_env_overrides(parser, opts)
if "auth" in test_name:
opts.auth = True
# 'auth_aws ecs' shouldn't have extra auth set.
if test_name == "auth_aws" and sub_test_name == "ecs":
opts.auth = False
if opts.verbose:
LOGGER.setLevel(logging.DEBUG)
elif opts.quiet:
LOGGER.setLevel(logging.WARNING)
return opts, extra_opts
def handle_env_overrides(parser: argparse.ArgumentParser, opts: argparse.Namespace) -> None:
# Get the options, and then allow environment variable overrides.
for key in vars(opts):
if key in OPTION_TO_ENV_VAR:
env_var = OPTION_TO_ENV_VAR[key]
else:
env_var = key.upper()
if env_var in os.environ:
if parser.get_default(key) != getattr(opts, key):
LOGGER.info("Overriding env var '%s' with cli option", env_var)
elif env_var == "AUTH":
opts.auth = os.environ.get("AUTH") == "auth"
elif env_var == "SSL":
ssl_opt = os.environ.get("SSL", "")
opts.ssl = ssl_opt and ssl_opt.lower() != "nossl"
elif isinstance(getattr(opts, key), bool):
if os.environ[env_var]:
setattr(opts, key, True)
else:
setattr(opts, key, os.environ[env_var])
def read_env(path: Path | str) -> dict[str, str]:
config = dict()
with Path(path).open() as fid:
for line in fid.readlines():
if "=" not in line:
continue
name, _, value = line.strip().partition("=")
if value.startswith(('"', "'")):
value = value[1:-1]
name = name.replace("export ", "")
config[name] = value
return config
def write_env(name: str, value: Any = "1") -> None:
with ENV_FILE.open("a", newline="\n") as fid:
# Remove any existing quote chars.
value = str(value).replace('"', "")
fid.write(f'export {name}="{value}"\n')
def run_command(cmd: str | list[str], **kwargs: Any) -> None:
if isinstance(cmd, list):
cmd = " ".join(cmd)
LOGGER.info("Running command '%s'...", cmd)
kwargs.setdefault("check", True)
# Prevent overriding the python used by other tools.
env = kwargs.pop("env", os.environ).copy()
if "UV_PYTHON" in env:
del env["UV_PYTHON"]
kwargs["env"] = env
try:
subprocess.run(shlex.split(cmd), **kwargs) # noqa: PLW1510, S603
except subprocess.CalledProcessError as e:
LOGGER.error(e.output)
LOGGER.error(str(e))
sys.exit(e.returncode)
LOGGER.info("Running command '%s'... done.", cmd)
def create_archive() -> str:
run_command("git add .", cwd=ROOT)
run_command('git commit --no-verify -m "add files"', check=False, cwd=ROOT)
run_command(f"git archive -o {TMP_DRIVER_FILE} HEAD", cwd=ROOT)
return TMP_DRIVER_FILE

18
.evergreen/setup-spawn-host.sh Executable file
View File

@ -0,0 +1,18 @@
#!/bin/bash
# Set up a remote evergreen spawn host.
set -eu
if [ -z "$1" ]
then
echo "Must supply a spawn host URL!"
fi
target=$1
user=${target%@*}
remote_dir=/home/$user/mongo-python-driver
echo "Copying files to $target..."
rsync -az -e ssh --exclude '.git' --filter=':- .gitignore' -r . $target:$remote_dir
echo "Copying files to $target... done"
ssh $target "$remote_dir/.evergreen/scripts/setup-system.sh"

View File

@ -0,0 +1,24 @@
diff --git a/test/connection_monitoring/pool-create-min-size-error.json b/test/connection_monitoring/pool-create-min-size-error.json
index 1c744b85..509b2a23 100644
--- a/test/connection_monitoring/pool-create-min-size-error.json
+++ b/test/connection_monitoring/pool-create-min-size-error.json
@@ -49,15 +49,15 @@
"type": "ConnectionCreated",
"address": 42
},
+ {
+ "type": "ConnectionPoolCleared",
+ "address": 42
+ },
{
"type": "ConnectionClosed",
"address": 42,
"connectionId": 42,
"reason": "error"
- },
- {
- "type": "ConnectionPoolCleared",
- "address": 42
}
],
"ignore": [

View File

@ -0,0 +1,440 @@
diff --git a/test/unified-test-format/invalid/entity-client-observeTracingMessages-additionalProperties.json b/test/unified-test-format/invalid/entity-client-observeTracingMessages-additionalProperties.json
new file mode 100644
index 00000000..aa8046d2
--- /dev/null
+++ b/test/unified-test-format/invalid/entity-client-observeTracingMessages-additionalProperties.json
@@ -0,0 +1,20 @@
+{
+ "description": "entity-client-observeTracingMessages-additionalProperties",
+ "schemaVersion": "1.26",
+ "createEntities": [
+ {
+ "client": {
+ "id": "client0",
+ "observeTracingMessages": {
+ "foo": "bar"
+ }
+ }
+ }
+ ],
+ "tests": [
+ {
+ "description": "observeTracingMessages must not have additional properties'",
+ "operations": []
+ }
+ ]
+}
diff --git a/test/unified-test-format/invalid/entity-client-observeTracingMessages-additionalPropertyType.json b/test/unified-test-format/invalid/entity-client-observeTracingMessages-additionalPropertyType.json
new file mode 100644
index 00000000..0b3a65f5
--- /dev/null
+++ b/test/unified-test-format/invalid/entity-client-observeTracingMessages-additionalPropertyType.json
@@ -0,0 +1,20 @@
+{
+ "description": "entity-client-observeTracingMessages-additionalPropertyType",
+ "schemaVersion": "1.26",
+ "createEntities": [
+ {
+ "client": {
+ "id": "client0",
+ "observeTracingMessages": {
+ "enableCommandPayload": 0
+ }
+ }
+ }
+ ],
+ "tests": [
+ {
+ "description": "observeTracingMessages enableCommandPayload must be boolean",
+ "operations": []
+ }
+ ]
+}
diff --git a/test/unified-test-format/invalid/entity-client-observeTracingMessages-type.json b/test/unified-test-format/invalid/entity-client-observeTracingMessages-type.json
new file mode 100644
index 00000000..de3ef39a
--- /dev/null
+++ b/test/unified-test-format/invalid/entity-client-observeTracingMessages-type.json
@@ -0,0 +1,18 @@
+{
+ "description": "entity-client-observeTracingMessages-type",
+ "schemaVersion": "1.26",
+ "createEntities": [
+ {
+ "client": {
+ "id": "client0",
+ "observeTracingMessages": "foo"
+ }
+ }
+ ],
+ "tests": [
+ {
+ "description": "observeTracingMessages must be an object",
+ "operations": []
+ }
+ ]
+}
diff --git a/test/unified-test-format/invalid/expectedTracingSpans-additionalProperties.json b/test/unified-test-format/invalid/expectedTracingSpans-additionalProperties.json
new file mode 100644
index 00000000..5947a286
--- /dev/null
+++ b/test/unified-test-format/invalid/expectedTracingSpans-additionalProperties.json
@@ -0,0 +1,30 @@
+{
+ "description": "expectedTracingSpans-additionalProperties",
+ "schemaVersion": "1.26",
+ "createEntities": [
+ {
+ "client": {
+ "id": "client0"
+ }
+ }
+ ],
+ "tests": [
+ {
+ "description": "additional property foo not allowed in expectTracingMessages",
+ "operations": [],
+ "expectTracingMessages": {
+ "client": "client0",
+ "ignoreExtraSpans": false,
+ "spans": [
+ {
+ "name": "command",
+ "tags": {
+ "db.system": "mongodb"
+ }
+ }
+ ],
+ "foo": 0
+ }
+ }
+ ]
+}
diff --git a/test/unified-test-format/invalid/expectedTracingSpans-clientType.json b/test/unified-test-format/invalid/expectedTracingSpans-clientType.json
new file mode 100644
index 00000000..2fe7faea
--- /dev/null
+++ b/test/unified-test-format/invalid/expectedTracingSpans-clientType.json
@@ -0,0 +1,28 @@
+{
+ "description": "expectedTracingSpans-clientType",
+ "schemaVersion": "1.26",
+ "createEntities": [
+ {
+ "client": {
+ "id": "client0"
+ }
+ }
+ ],
+ "tests": [
+ {
+ "description": "client type must be string",
+ "operations": [],
+ "expectTracingMessages": {
+ "client": 0,
+ "spans": [
+ {
+ "name": "command",
+ "tags": {
+ "db.system": "mongodb"
+ }
+ }
+ ]
+ }
+ }
+ ]
+}
diff --git a/test/unified-test-format/invalid/expectedTracingSpans-emptyNestedSpan.json b/test/unified-test-format/invalid/expectedTracingSpans-emptyNestedSpan.json
new file mode 100644
index 00000000..8a98d5ba
--- /dev/null
+++ b/test/unified-test-format/invalid/expectedTracingSpans-emptyNestedSpan.json
@@ -0,0 +1,29 @@
+{
+ "description": "expectedTracingSpans-emptyNestedSpan",
+ "schemaVersion": "1.26",
+ "createEntities": [
+ {
+ "client": {
+ "id": "client0"
+ }
+ }
+ ],
+ "tests": [
+ {
+ "description": "nested spans must not have fewer than 1 items'",
+ "operations": [],
+ "expectTracingMessages": {
+ "client": "client0",
+ "spans": [
+ {
+ "name": "command",
+ "tags": {
+ "db.system": "mongodb"
+ },
+ "nested": []
+ }
+ ]
+ }
+ }
+ ]
+}
diff --git a/test/unified-test-format/invalid/expectedTracingSpans-invalidNestedSpan.json b/test/unified-test-format/invalid/expectedTracingSpans-invalidNestedSpan.json
new file mode 100644
index 00000000..79a86744
--- /dev/null
+++ b/test/unified-test-format/invalid/expectedTracingSpans-invalidNestedSpan.json
@@ -0,0 +1,31 @@
+{
+ "description": "expectedTracingSpans-invalidNestedSpan",
+ "schemaVersion": "1.26",
+ "createEntities": [
+ {
+ "client": {
+ "id": "client0"
+ }
+ }
+ ],
+ "tests": [
+ {
+ "description": "nested span must have required property name",
+ "operations": [],
+ "expectTracingMessages": {
+ "client": "client0",
+ "spans": [
+ {
+ "name": "command",
+ "tags": {
+ "db.system": "mongodb"
+ },
+ "nested": [
+ {}
+ ]
+ }
+ ]
+ }
+ }
+ ]
+}
diff --git a/test/unified-test-format/invalid/expectedTracingSpans-missingPropertyClient.json b/test/unified-test-format/invalid/expectedTracingSpans-missingPropertyClient.json
new file mode 100644
index 00000000..2fb1cd5b
--- /dev/null
+++ b/test/unified-test-format/invalid/expectedTracingSpans-missingPropertyClient.json
@@ -0,0 +1,27 @@
+{
+ "description": "expectedTracingSpans-missingPropertyClient",
+ "schemaVersion": "1.26",
+ "createEntities": [
+ {
+ "client": {
+ "id": "client0"
+ }
+ }
+ ],
+ "tests": [
+ {
+ "description": "missing required property client",
+ "operations": [],
+ "expectTracingMessages": {
+ "spans": [
+ {
+ "name": "command",
+ "tags": {
+ "db.system": "mongodb"
+ }
+ }
+ ]
+ }
+ }
+ ]
+}
diff --git a/test/unified-test-format/invalid/expectedTracingSpans-missingPropertySpans.json b/test/unified-test-format/invalid/expectedTracingSpans-missingPropertySpans.json
new file mode 100644
index 00000000..acd10307
--- /dev/null
+++ b/test/unified-test-format/invalid/expectedTracingSpans-missingPropertySpans.json
@@ -0,0 +1,20 @@
+{
+ "description": "expectedTracingSpans-missingPropertySpans",
+ "schemaVersion": "1.26",
+ "createEntities": [
+ {
+ "client": {
+ "id": "client0"
+ }
+ }
+ ],
+ "tests": [
+ {
+ "description": "missing required property spans",
+ "operations": [],
+ "expectTracingMessages": {
+ "client": "client0"
+ }
+ }
+ ]
+}
diff --git a/test/unified-test-format/invalid/expectedTracingSpans-spanMalformedAdditionalProperties.json b/test/unified-test-format/invalid/expectedTracingSpans-spanMalformedAdditionalProperties.json
new file mode 100644
index 00000000..17299f86
--- /dev/null
+++ b/test/unified-test-format/invalid/expectedTracingSpans-spanMalformedAdditionalProperties.json
@@ -0,0 +1,28 @@
+{
+ "description": "expectedTracingSpans-spanMalformedAdditionalProperties",
+ "schemaVersion": "1.26",
+ "createEntities": [
+ {
+ "client": {
+ "id": "client0"
+ }
+ }
+ ],
+ "tests": [
+ {
+ "description": "Span must not have additional properties",
+ "operations": [],
+ "expectTracingMessages": {
+ "client": "client0",
+ "spans": [
+ {
+ "name": "foo",
+ "tags": {},
+ "nested": [],
+ "foo": "bar"
+ }
+ ]
+ }
+ }
+ ]
+}
diff --git a/test/unified-test-format/invalid/expectedTracingSpans-spanMalformedMissingName.json b/test/unified-test-format/invalid/expectedTracingSpans-spanMalformedMissingName.json
new file mode 100644
index 00000000..0257cd9b
--- /dev/null
+++ b/test/unified-test-format/invalid/expectedTracingSpans-spanMalformedMissingName.json
@@ -0,0 +1,27 @@
+{
+ "description": "expectedTracingSpans-spanMalformedMissingName",
+ "schemaVersion": "1.26",
+ "createEntities": [
+ {
+ "client": {
+ "id": "client0"
+ }
+ }
+ ],
+ "tests": [
+ {
+ "description": "missing required span name",
+ "operations": [],
+ "expectTracingMessages": {
+ "client": "client0",
+ "spans": [
+ {
+ "tags": {
+ "db.system": "mongodb"
+ }
+ }
+ ]
+ }
+ }
+ ]
+}
diff --git a/test/unified-test-format/invalid/expectedTracingSpans-spanMalformedMissingTags.json b/test/unified-test-format/invalid/expectedTracingSpans-spanMalformedMissingTags.json
new file mode 100644
index 00000000..a09ca31c
--- /dev/null
+++ b/test/unified-test-format/invalid/expectedTracingSpans-spanMalformedMissingTags.json
@@ -0,0 +1,25 @@
+{
+ "description": "expectedTracingSpans-spanMalformedMissingTags",
+ "schemaVersion": "1.26",
+ "createEntities": [
+ {
+ "client": {
+ "id": "client0"
+ }
+ }
+ ],
+ "tests": [
+ {
+ "description": "missing required span tags",
+ "operations": [],
+ "expectTracingMessages": {
+ "client": "client0",
+ "spans": [
+ {
+ "name": "foo"
+ }
+ ]
+ }
+ }
+ ]
+}
diff --git a/test/unified-test-format/invalid/expectedTracingSpans-spanMalformedNestedMustBeArray.json b/test/unified-test-format/invalid/expectedTracingSpans-spanMalformedNestedMustBeArray.json
new file mode 100644
index 00000000..ccff0410
--- /dev/null
+++ b/test/unified-test-format/invalid/expectedTracingSpans-spanMalformedNestedMustBeArray.json
@@ -0,0 +1,27 @@
+{
+ "description": "expectedTracingSpans-spanMalformedNestedMustBeArray",
+ "schemaVersion": "1.26",
+ "createEntities": [
+ {
+ "client": {
+ "id": "client0"
+ }
+ }
+ ],
+ "tests": [
+ {
+ "description": "nested spans must be an array",
+ "operations": [],
+ "expectTracingMessages": {
+ "client": "client0",
+ "spans": [
+ {
+ "name": "foo",
+ "tags": {},
+ "nested": {}
+ }
+ ]
+ }
+ }
+ ]
+}
diff --git a/test/unified-test-format/invalid/expectedTracingSpans-spanMalformedTagsMustBeObject.json b/test/unified-test-format/invalid/expectedTracingSpans-spanMalformedTagsMustBeObject.json
new file mode 100644
index 00000000..72af1c29
--- /dev/null
+++ b/test/unified-test-format/invalid/expectedTracingSpans-spanMalformedTagsMustBeObject.json
@@ -0,0 +1,26 @@
+{
+ "description": "expectedTracingSpans-spanMalformedNestedMustBeObject",
+ "schemaVersion": "1.26",
+ "createEntities": [
+ {
+ "client": {
+ "id": "client0"
+ }
+ }
+ ],
+ "tests": [
+ {
+ "description": "span tags must be an object",
+ "operations": [],
+ "expectTracingMessages": {
+ "client": "client0",
+ "spans": [
+ {
+ "name": "foo",
+ "tags": []
+ }
+ ]
+ }
+ }
+ ]
+}

View File

@ -0,0 +1,26 @@
diff --git a/test/auth/legacy/connection-string.json b/test/auth/legacy/connection-string.json
index 3a099c813..8982b61d5 100644
--- a/test/auth/legacy/connection-string.json
+++ b/test/auth/legacy/connection-string.json
@@ -440,6 +440,21 @@
}
}
},
+ {
+ "description": "should throw an exception if username provided (MONGODB-AWS)",
+ "uri": "mongodb://user@localhost.com/?authMechanism=MONGODB-AWS",
+ "valid": false
+ },
+ {
+ "description": "should throw an exception if username and password provided (MONGODB-AWS)",
+ "uri": "mongodb://user:pass@localhost.com/?authMechanism=MONGODB-AWS",
+ "valid": false
+ },
+ {
+ "description": "should throw an exception if AWS_SESSION_TOKEN provided (MONGODB-AWS)",
+ "uri": "mongodb://localhost/?authMechanism=MONGODB-AWS&authMechanismProperties=AWS_SESSION_TOKEN:token",
+ "valid": false
+ },
{
"description": "should recognise the mechanism with test environment (MONGODB-OIDC)",
"uri": "mongodb://localhost/?authMechanism=MONGODB-OIDC&authMechanismProperties=ENVIRONMENT:test",

View File

@ -0,0 +1,50 @@
diff --git a/test/connection_logging/connection-logging.json b/test/connection_logging/connection-logging.json
index 5799e834..72103b3c 100644
--- a/test/connection_logging/connection-logging.json
+++ b/test/connection_logging/connection-logging.json
@@ -446,6 +446,22 @@
}
}
},
+ {
+ "level": "debug",
+ "component": "connection",
+ "data": {
+ "message": "Connection pool cleared",
+ "serverHost": {
+ "$$type": "string"
+ },
+ "serverPort": {
+ "$$type": [
+ "int",
+ "long"
+ ]
+ }
+ }
+ },
{
"level": "debug",
"component": "connection",
@@ -498,22 +514,6 @@
]
}
}
- },
- {
- "level": "debug",
- "component": "connection",
- "data": {
- "message": "Connection pool cleared",
- "serverHost": {
- "$$type": "string"
- },
- "serverPort": {
- "$$type": [
- "int",
- "long"
- ]
- }
- }
}
]
}

View File

@ -0,0 +1,815 @@
diff --git a/test/sessions/snapshot-sessions.json b/test/sessions/snapshot-sessions.json
index 260f8b6f4..8f806ea75 100644
--- a/test/sessions/snapshot-sessions.json
+++ b/test/sessions/snapshot-sessions.json
@@ -988,6 +988,810 @@
}
}
]
+ },
+ {
+ "description": "Find operation with snapshot and snapshot time",
+ "operations": [
+ {
+ "name": "find",
+ "object": "collection0",
+ "arguments": {
+ "session": "session0",
+ "filter": {}
+ },
+ "expectResult": [
+ {
+ "_id": 1,
+ "x": 11
+ },
+ {
+ "_id": 2,
+ "x": 11
+ }
+ ]
+ },
+ {
+ "name": "getSnapshotTime",
+ "object": "session0",
+ "saveResultAsEntity": "savedSnapshotTime"
+ },
+ {
+ "name": "insertOne",
+ "object": "collection0",
+ "arguments": {
+ "document": {
+ "_id": 3,
+ "x": 33
+ }
+ }
+ },
+ {
+ "name": "createEntities",
+ "object": "testRunner",
+ "arguments": {
+ "entities": [
+ {
+ "session": {
+ "id": "session2",
+ "client": "client0",
+ "sessionOptions": {
+ "snapshot": true,
+ "snapshotTime": "savedSnapshotTime"
+ }
+ }
+ }
+ ]
+ }
+ },
+ {
+ "name": "find",
+ "object": "collection0",
+ "arguments": {
+ "session": "session2",
+ "filter": {}
+ },
+ "expectResult": [
+ {
+ "_id": 1,
+ "x": 11
+ },
+ {
+ "_id": 2,
+ "x": 11
+ }
+ ]
+ },
+ {
+ "name": "find",
+ "object": "collection0",
+ "arguments": {
+ "session": "session2",
+ "filter": {}
+ },
+ "expectResult": [
+ {
+ "_id": 1,
+ "x": 11
+ },
+ {
+ "_id": 2,
+ "x": 11
+ }
+ ]
+ },
+ {
+ "name": "find",
+ "object": "collection0",
+ "arguments": {
+ "filter": {}
+ },
+ "expectResult": [
+ {
+ "_id": 1,
+ "x": 11
+ },
+ {
+ "_id": 2,
+ "x": 11
+ },
+ {
+ "_id": 3,
+ "x": 33
+ }
+ ]
+ }
+ ],
+ "expectEvents": [
+ {
+ "client": "client0",
+ "events": [
+ {
+ "commandStartedEvent": {
+ "command": {
+ "find": "collection0",
+ "readConcern": {
+ "level": "snapshot",
+ "atClusterTime": {
+ "$$exists": false
+ }
+ }
+ },
+ "databaseName": "database0"
+ }
+ },
+ {
+ "commandStartedEvent": {
+ "command": {
+ "find": "collection0",
+ "readConcern": {
+ "level": "snapshot",
+ "atClusterTime": {
+ "$$matchesEntity": "savedSnapshotTime"
+ }
+ }
+ },
+ "databaseName": "database0"
+ }
+ },
+ {
+ "commandStartedEvent": {
+ "command": {
+ "find": "collection0",
+ "readConcern": {
+ "level": "snapshot",
+ "atClusterTime": {
+ "$$matchesEntity": "savedSnapshotTime"
+ }
+ }
+ },
+ "databaseName": "database0"
+ }
+ },
+ {
+ "commandStartedEvent": {
+ "command": {
+ "find": "collection0",
+ "readConcern": {
+ "$$exists": false
+ }
+ },
+ "databaseName": "database0"
+ }
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "description": "Distinct operation with snapshot and snapshot time",
+ "operations": [
+ {
+ "name": "distinct",
+ "object": "collection0",
+ "arguments": {
+ "session": "session0",
+ "filter": {},
+ "fieldName": "x"
+ },
+ "expectResult": [
+ 11
+ ]
+ },
+ {
+ "name": "getSnapshotTime",
+ "object": "session0",
+ "saveResultAsEntity": "savedSnapshotTime"
+ },
+ {
+ "name": "insertOne",
+ "object": "collection0",
+ "arguments": {
+ "document": {
+ "_id": 3,
+ "x": 33
+ }
+ }
+ },
+ {
+ "name": "createEntities",
+ "object": "testRunner",
+ "arguments": {
+ "entities": [
+ {
+ "session": {
+ "id": "session2",
+ "client": "client0",
+ "sessionOptions": {
+ "snapshot": true,
+ "snapshotTime": "savedSnapshotTime"
+ }
+ }
+ }
+ ]
+ }
+ },
+ {
+ "name": "distinct",
+ "object": "collection0",
+ "arguments": {
+ "session": "session2",
+ "filter": {},
+ "fieldName": "x"
+ },
+ "expectResult": [
+ 11
+ ]
+ },
+ {
+ "name": "distinct",
+ "object": "collection0",
+ "arguments": {
+ "session": "session2",
+ "filter": {},
+ "fieldName": "x"
+ },
+ "expectResult": [
+ 11
+ ]
+ },
+ {
+ "name": "distinct",
+ "object": "collection0",
+ "arguments": {
+ "filter": {},
+ "fieldName": "x"
+ },
+ "expectResult": [
+ 11,
+ 33
+ ]
+ }
+ ],
+ "expectEvents": [
+ {
+ "client": "client0",
+ "events": [
+ {
+ "commandStartedEvent": {
+ "command": {
+ "distinct": "collection0",
+ "readConcern": {
+ "level": "snapshot",
+ "atClusterTime": {
+ "$$exists": false
+ }
+ }
+ },
+ "databaseName": "database0"
+ }
+ },
+ {
+ "commandStartedEvent": {
+ "command": {
+ "distinct": "collection0",
+ "readConcern": {
+ "level": "snapshot",
+ "atClusterTime": {
+ "$$matchesEntity": "savedSnapshotTime"
+ }
+ }
+ },
+ "databaseName": "database0"
+ }
+ },
+ {
+ "commandStartedEvent": {
+ "command": {
+ "distinct": "collection0",
+ "readConcern": {
+ "level": "snapshot",
+ "atClusterTime": {
+ "$$matchesEntity": "savedSnapshotTime"
+ }
+ }
+ },
+ "databaseName": "database0"
+ }
+ },
+ {
+ "commandStartedEvent": {
+ "command": {
+ "distinct": "collection0",
+ "readConcern": {
+ "$$exists": false
+ }
+ },
+ "databaseName": "database0"
+ }
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "description": "Aggregate operation with snapshot and snapshot time",
+ "operations": [
+ {
+ "name": "aggregate",
+ "object": "collection0",
+ "arguments": {
+ "session": "session0",
+ "pipeline": [
+ {
+ "$match": {
+ "_id": 1
+ }
+ }
+ ]
+ },
+ "expectResult": [
+ {
+ "_id": 1,
+ "x": 11
+ }
+ ]
+ },
+ {
+ "name": "getSnapshotTime",
+ "object": "session0",
+ "saveResultAsEntity": "savedSnapshotTime"
+ },
+ {
+ "name": "findOneAndUpdate",
+ "object": "collection0",
+ "arguments": {
+ "filter": {
+ "_id": 1
+ },
+ "update": {
+ "$inc": {
+ "x": 1
+ }
+ },
+ "returnDocument": "After"
+ },
+ "expectResult": {
+ "_id": 1,
+ "x": 12
+ }
+ },
+ {
+ "name": "createEntities",
+ "object": "testRunner",
+ "arguments": {
+ "entities": [
+ {
+ "session": {
+ "id": "session2",
+ "client": "client0",
+ "sessionOptions": {
+ "snapshot": true,
+ "snapshotTime": "savedSnapshotTime"
+ }
+ }
+ }
+ ]
+ }
+ },
+ {
+ "name": "aggregate",
+ "object": "collection0",
+ "arguments": {
+ "session": "session2",
+ "pipeline": [
+ {
+ "$match": {
+ "_id": 1
+ }
+ }
+ ]
+ },
+ "expectResult": [
+ {
+ "_id": 1,
+ "x": 11
+ }
+ ]
+ },
+ {
+ "name": "aggregate",
+ "object": "collection0",
+ "arguments": {
+ "session": "session2",
+ "pipeline": [
+ {
+ "$match": {
+ "_id": 1
+ }
+ }
+ ]
+ },
+ "expectResult": [
+ {
+ "_id": 1,
+ "x": 11
+ }
+ ]
+ },
+ {
+ "name": "aggregate",
+ "object": "collection0",
+ "arguments": {
+ "pipeline": [
+ {
+ "$match": {
+ "_id": 1
+ }
+ }
+ ]
+ },
+ "expectResult": [
+ {
+ "_id": 1,
+ "x": 12
+ }
+ ]
+ }
+ ],
+ "expectEvents": [
+ {
+ "client": "client0",
+ "events": [
+ {
+ "commandStartedEvent": {
+ "command": {
+ "aggregate": "collection0",
+ "readConcern": {
+ "level": "snapshot",
+ "atClusterTime": {
+ "$$exists": false
+ }
+ }
+ },
+ "databaseName": "database0"
+ }
+ },
+ {
+ "commandStartedEvent": {
+ "command": {
+ "aggregate": "collection0",
+ "readConcern": {
+ "level": "snapshot",
+ "atClusterTime": {
+ "$$matchesEntity": "savedSnapshotTime"
+ }
+ }
+ },
+ "databaseName": "database0"
+ }
+ },
+ {
+ "commandStartedEvent": {
+ "command": {
+ "aggregate": "collection0",
+ "readConcern": {
+ "level": "snapshot",
+ "atClusterTime": {
+ "$$matchesEntity": "savedSnapshotTime"
+ }
+ }
+ },
+ "databaseName": "database0"
+ }
+ },
+ {
+ "commandStartedEvent": {
+ "command": {
+ "aggregate": "collection0",
+ "readConcern": {
+ "$$exists": false
+ }
+ },
+ "databaseName": "database0"
+ }
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "description": "countDocuments operation with snapshot and snapshot time",
+ "operations": [
+ {
+ "name": "countDocuments",
+ "object": "collection0",
+ "arguments": {
+ "session": "session0",
+ "filter": {}
+ },
+ "expectResult": 2
+ },
+ {
+ "name": "getSnapshotTime",
+ "object": "session0",
+ "saveResultAsEntity": "savedSnapshotTime"
+ },
+ {
+ "name": "insertOne",
+ "object": "collection0",
+ "arguments": {
+ "document": {
+ "_id": 3,
+ "x": 33
+ }
+ }
+ },
+ {
+ "name": "createEntities",
+ "object": "testRunner",
+ "arguments": {
+ "entities": [
+ {
+ "session": {
+ "id": "session2",
+ "client": "client0",
+ "sessionOptions": {
+ "snapshot": true,
+ "snapshotTime": "savedSnapshotTime"
+ }
+ }
+ }
+ ]
+ }
+ },
+ {
+ "name": "countDocuments",
+ "object": "collection0",
+ "arguments": {
+ "session": "session2",
+ "filter": {}
+ },
+ "expectResult": 2
+ },
+ {
+ "name": "countDocuments",
+ "object": "collection0",
+ "arguments": {
+ "session": "session2",
+ "filter": {}
+ },
+ "expectResult": 2
+ },
+ {
+ "name": "countDocuments",
+ "object": "collection0",
+ "arguments": {
+ "filter": {}
+ },
+ "expectResult": 3
+ }
+ ],
+ "expectEvents": [
+ {
+ "client": "client0",
+ "events": [
+ {
+ "commandStartedEvent": {
+ "command": {
+ "aggregate": "collection0",
+ "readConcern": {
+ "level": "snapshot",
+ "atClusterTime": {
+ "$$exists": false
+ }
+ }
+ },
+ "databaseName": "database0"
+ }
+ },
+ {
+ "commandStartedEvent": {
+ "command": {
+ "aggregate": "collection0",
+ "readConcern": {
+ "level": "snapshot",
+ "atClusterTime": {
+ "$$matchesEntity": "savedSnapshotTime"
+ }
+ }
+ },
+ "databaseName": "database0"
+ }
+ },
+ {
+ "commandStartedEvent": {
+ "command": {
+ "aggregate": "collection0",
+ "readConcern": {
+ "level": "snapshot",
+ "atClusterTime": {
+ "$$matchesEntity": "savedSnapshotTime"
+ }
+ }
+ },
+ "databaseName": "database0"
+ }
+ },
+ {
+ "commandStartedEvent": {
+ "command": {
+ "aggregate": "collection0",
+ "readConcern": {
+ "$$exists": false
+ }
+ },
+ "databaseName": "database0"
+ }
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "description": "Mixed operation with snapshot and snapshotTime",
+ "operations": [
+ {
+ "name": "find",
+ "object": "collection0",
+ "arguments": {
+ "session": "session0",
+ "filter": {
+ "_id": 1
+ }
+ },
+ "expectResult": [
+ {
+ "_id": 1,
+ "x": 11
+ }
+ ]
+ },
+ {
+ "name": "getSnapshotTime",
+ "object": "session0",
+ "saveResultAsEntity": "savedSnapshotTime"
+ },
+ {
+ "name": "findOneAndUpdate",
+ "object": "collection0",
+ "arguments": {
+ "filter": {
+ "_id": 1
+ },
+ "update": {
+ "$inc": {
+ "x": 1
+ }
+ },
+ "returnDocument": "After"
+ },
+ "expectResult": {
+ "_id": 1,
+ "x": 12
+ }
+ },
+ {
+ "name": "createEntities",
+ "object": "testRunner",
+ "arguments": {
+ "entities": [
+ {
+ "session": {
+ "id": "session2",
+ "client": "client0",
+ "sessionOptions": {
+ "snapshot": true,
+ "snapshotTime": "savedSnapshotTime"
+ }
+ }
+ }
+ ]
+ }
+ },
+ {
+ "name": "find",
+ "object": "collection0",
+ "arguments": {
+ "filter": {
+ "_id": 1
+ }
+ },
+ "expectResult": [
+ {
+ "_id": 1,
+ "x": 12
+ }
+ ]
+ },
+ {
+ "name": "aggregate",
+ "object": "collection0",
+ "arguments": {
+ "pipeline": [
+ {
+ "$match": {
+ "_id": 1
+ }
+ }
+ ],
+ "session": "session2"
+ },
+ "expectResult": [
+ {
+ "_id": 1,
+ "x": 11
+ }
+ ]
+ },
+ {
+ "name": "distinct",
+ "object": "collection0",
+ "arguments": {
+ "fieldName": "x",
+ "filter": {},
+ "session": "session2"
+ },
+ "expectResult": [
+ 11
+ ]
+ }
+ ],
+ "expectEvents": [
+ {
+ "client": "client0",
+ "events": [
+ {
+ "commandStartedEvent": {
+ "command": {
+ "find": "collection0",
+ "readConcern": {
+ "level": "snapshot",
+ "atClusterTime": {
+ "$$exists": false
+ }
+ }
+ }
+ }
+ },
+ {
+ "commandStartedEvent": {
+ "command": {
+ "find": "collection0",
+ "readConcern": {
+ "$$exists": false
+ }
+ }
+ }
+ },
+ {
+ "commandStartedEvent": {
+ "command": {
+ "aggregate": "collection0",
+ "readConcern": {
+ "level": "snapshot",
+ "atClusterTime": {
+ "$$matchesEntity": "savedSnapshotTime"
+ }
+ }
+ }
+ }
+ },
+ {
+ "commandStartedEvent": {
+ "command": {
+ "distinct": "collection0",
+ "readConcern": {
+ "level": "snapshot",
+ "atClusterTime": {
+ "$$matchesEntity": "savedSnapshotTime"
+ }
+ }
+ }
+ }
+ }
+ ]
+ }
+ ]
}
]
}

View File

@ -0,0 +1,460 @@
diff --git a/test/client-side-encryption/spec/unified/accessToken-azure.json b/test/client-side-encryption/spec/unified/accessToken-azure.json
new file mode 100644
index 00000000..510d8795
--- /dev/null
+++ b/test/client-side-encryption/spec/unified/accessToken-azure.json
@@ -0,0 +1,186 @@
+{
+ "description": "accessToken-azure",
+ "schemaVersion": "1.28",
+ "runOnRequirements": [
+ {
+ "minServerVersion": "4.1.10",
+ "csfle": {
+ "minLibmongocryptVersion": "1.6.0"
+ }
+ }
+ ],
+ "createEntities": [
+ {
+ "client": {
+ "id": "client",
+ "autoEncryptOpts": {
+ "keyVaultNamespace": "keyvault.datakeys",
+ "kmsProviders": {
+ "azure": {
+ "accessToken": {
+ "$$placeholder": 1
+ }
+ }
+ }
+ }
+ }
+ },
+ {
+ "database": {
+ "id": "db",
+ "client": "client",
+ "databaseName": "db"
+ }
+ },
+ {
+ "collection": {
+ "id": "coll",
+ "database": "db",
+ "collectionName": "coll"
+ }
+ },
+ {
+ "clientEncryption": {
+ "id": "clientEncryption",
+ "clientEncryptionOpts": {
+ "keyVaultClient": "client",
+ "keyVaultNamespace": "keyvault.datakeys",
+ "kmsProviders": {
+ "azure": {
+ "accessToken": {
+ "$$placeholder": 1
+ }
+ }
+ }
+ }
+ }
+ }
+ ],
+ "initialData": [
+ {
+ "databaseName": "db",
+ "collectionName": "coll",
+ "documents": [],
+ "createOptions": {
+ "validator": {
+ "$jsonSchema": {
+ "properties": {
+ "secret": {
+ "encrypt": {
+ "keyId": [
+ {
+ "$binary": {
+ "base64": "AZURE+AAAAAAAAAAAAAAAA==",
+ "subType": "04"
+ }
+ }
+ ],
+ "bsonType": "string",
+ "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic"
+ }
+ }
+ },
+ "bsonType": "object"
+ }
+ }
+ }
+ },
+ {
+ "databaseName": "keyvault",
+ "collectionName": "datakeys",
+ "documents": [
+ {
+ "_id": {
+ "$binary": {
+ "base64": "AZURE+AAAAAAAAAAAAAAAA==",
+ "subType": "04"
+ }
+ },
+ "keyAltNames": [
+ "my-key"
+ ],
+ "keyMaterial": {
+ "$binary": {
+ "base64": "n+HWZ0ZSVOYA3cvQgP7inN4JSXfOH85IngmeQxRpQHjCCcqT3IFqEWNlrsVHiz3AELimHhX4HKqOLWMUeSIT6emUDDoQX9BAv8DR1+E1w4nGs/NyEneac78EYFkK3JysrFDOgl2ypCCTKAypkn9CkAx1if4cfgQE93LW4kczcyHdGiH36CIxrCDGv1UzAvERN5Qa47DVwsM6a+hWsF2AAAJVnF0wYLLJU07TuRHdMrrphPWXZsFgyV+lRqJ7DDpReKNO8nMPLV/mHqHBHGPGQiRdb9NoJo8CvokGz4+KE8oLwzKf6V24dtwZmRkrsDV4iOhvROAzz+Euo1ypSkL3mw==",
+ "subType": "00"
+ }
+ },
+ "creationDate": {
+ "$date": {
+ "$numberLong": "1552949630483"
+ }
+ },
+ "updateDate": {
+ "$date": {
+ "$numberLong": "1552949630483"
+ }
+ },
+ "status": {
+ "$numberInt": "0"
+ },
+ "masterKey": {
+ "provider": "azure",
+ "keyVaultEndpoint": "key-vault-csfle.vault.azure.net",
+ "keyName": "key-name-csfle"
+ }
+ }
+ ]
+ }
+ ],
+ "tests": [
+ {
+ "description": "Auto encrypt using access token Azure credentials",
+ "operations": [
+ {
+ "name": "insertOne",
+ "arguments": {
+ "document": {
+ "_id": 1,
+ "secret": "string0"
+ }
+ },
+ "object": "coll"
+ }
+ ],
+ "outcome": [
+ {
+ "documents": [
+ {
+ "_id": 1,
+ "secret": {
+ "$binary": {
+ "base64": "AQGVERPgAAAAAAAAAAAAAAAC5DbBSwPwfSlBrDtRuglvNvCXD1KzDuCKY2P+4bRFtHDjpTOE2XuytPAUaAbXf1orsPq59PVZmsbTZbt2CB8qaQ==",
+ "subType": "06"
+ }
+ }
+ }
+ ],
+ "collectionName": "coll",
+ "databaseName": "db"
+ }
+ ]
+ },
+ {
+ "description": "Explicit encrypt using access token Azure credentials",
+ "operations": [
+ {
+ "name": "encrypt",
+ "object": "clientEncryption",
+ "arguments": {
+ "value": "string0",
+ "opts": {
+ "keyAltName": "my-key",
+ "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic"
+ }
+ },
+ "expectResult": {
+ "$binary": {
+ "base64": "AQGVERPgAAAAAAAAAAAAAAAC5DbBSwPwfSlBrDtRuglvNvCXD1KzDuCKY2P+4bRFtHDjpTOE2XuytPAUaAbXf1orsPq59PVZmsbTZbt2CB8qaQ==",
+ "subType": "06"
+ }
+ }
+ }
+ ]
+ }
+ ]
+}
diff --git a/test/client-side-encryption/spec/unified/accessToken-gcp.json b/test/client-side-encryption/spec/unified/accessToken-gcp.json
new file mode 100644
index 00000000..f5cf8914
--- /dev/null
+++ b/test/client-side-encryption/spec/unified/accessToken-gcp.json
@@ -0,0 +1,188 @@
+{
+ "description": "accessToken-gcp",
+ "schemaVersion": "1.28",
+ "runOnRequirements": [
+ {
+ "minServerVersion": "4.1.10",
+ "csfle": {
+ "minLibmongocryptVersion": "1.6.0"
+ }
+ }
+ ],
+ "createEntities": [
+ {
+ "client": {
+ "id": "client",
+ "autoEncryptOpts": {
+ "keyVaultNamespace": "keyvault.datakeys",
+ "kmsProviders": {
+ "gcp": {
+ "accessToken": {
+ "$$placeholder": 1
+ }
+ }
+ }
+ }
+ }
+ },
+ {
+ "database": {
+ "id": "db",
+ "client": "client",
+ "databaseName": "db"
+ }
+ },
+ {
+ "collection": {
+ "id": "coll",
+ "database": "db",
+ "collectionName": "coll"
+ }
+ },
+ {
+ "clientEncryption": {
+ "id": "clientEncryption",
+ "clientEncryptionOpts": {
+ "keyVaultClient": "client",
+ "keyVaultNamespace": "keyvault.datakeys",
+ "kmsProviders": {
+ "gcp": {
+ "accessToken": {
+ "$$placeholder": 1
+ }
+ }
+ }
+ }
+ }
+ }
+ ],
+ "initialData": [
+ {
+ "databaseName": "db",
+ "collectionName": "coll",
+ "documents": [],
+ "createOptions": {
+ "validator": {
+ "$jsonSchema": {
+ "properties": {
+ "secret": {
+ "encrypt": {
+ "keyId": [
+ {
+ "$binary": {
+ "base64": "GCP+AAAAAAAAAAAAAAAAAA==",
+ "subType": "04"
+ }
+ }
+ ],
+ "bsonType": "string",
+ "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic"
+ }
+ }
+ },
+ "bsonType": "object"
+ }
+ }
+ }
+ },
+ {
+ "databaseName": "keyvault",
+ "collectionName": "datakeys",
+ "documents": [
+ {
+ "_id": {
+ "$binary": {
+ "base64": "GCP+AAAAAAAAAAAAAAAAAA==",
+ "subType": "04"
+ }
+ },
+ "keyAltNames": [
+ "my-key"
+ ],
+ "keyMaterial": {
+ "$binary": {
+ "base64": "CiQAIgLj0WyktnB4dfYHo5SLZ41K4ASQrjJUaSzl5vvVH0G12G0SiQEAjlV8XPlbnHDEDFbdTO4QIe8ER2/172U1ouLazG0ysDtFFIlSvWX5ZnZUrRMmp/R2aJkzLXEt/zf8Mn4Lfm+itnjgo5R9K4pmPNvvPKNZX5C16lrPT+aA+rd+zXFSmlMg3i5jnxvTdLHhg3G7Q/Uv1ZIJskKt95bzLoe0tUVzRWMYXLIEcohnQg==",
+ "subType": "00"
+ }
+ },
+ "creationDate": {
+ "$date": {
+ "$numberLong": "1552949630483"
+ }
+ },
+ "updateDate": {
+ "$date": {
+ "$numberLong": "1552949630483"
+ }
+ },
+ "status": {
+ "$numberInt": "0"
+ },
+ "masterKey": {
+ "provider": "gcp",
+ "projectId": "devprod-drivers",
+ "location": "global",
+ "keyRing": "key-ring-csfle",
+ "keyName": "key-name-csfle"
+ }
+ }
+ ]
+ }
+ ],
+ "tests": [
+ {
+ "description": "Auto encrypt using access token GCP credentials",
+ "operations": [
+ {
+ "name": "insertOne",
+ "arguments": {
+ "document": {
+ "_id": 1,
+ "secret": "string0"
+ }
+ },
+ "object": "coll"
+ }
+ ],
+ "outcome": [
+ {
+ "documents": [
+ {
+ "_id": 1,
+ "secret": {
+ "$binary": {
+ "base64": "ARgj/gAAAAAAAAAAAAAAAAACwFd+Y5Ojw45GUXNvbcIpN9YkRdoHDHkR4kssdn0tIMKlDQOLFkWFY9X07IRlXsxPD8DcTiKnl6XINK28vhcGlg==",
+ "subType": "06"
+ }
+ }
+ }
+ ],
+ "collectionName": "coll",
+ "databaseName": "db"
+ }
+ ]
+ },
+ {
+ "description": "Explicit encrypt using access token GCP credentials",
+ "operations": [
+ {
+ "name": "encrypt",
+ "object": "clientEncryption",
+ "arguments": {
+ "value": "string0",
+ "opts": {
+ "keyAltName": "my-key",
+ "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic"
+ }
+ },
+ "expectResult": {
+ "$binary": {
+ "base64": "ARgj/gAAAAAAAAAAAAAAAAACwFd+Y5Ojw45GUXNvbcIpN9YkRdoHDHkR4kssdn0tIMKlDQOLFkWFY9X07IRlXsxPD8DcTiKnl6XINK28vhcGlg==",
+ "subType": "06"
+ }
+ }
+ }
+ ]
+ }
+ ]
+}
diff --git a/test/unified-test-format/invalid/clientEncryptionOpts-kmsProviders-azure-accessToken-type.json b/test/unified-test-format/invalid/clientEncryptionOpts-kmsProviders-azure-accessToken-type.json
new file mode 100644
index 00000000..8fe5c150
--- /dev/null
+++ b/test/unified-test-format/invalid/clientEncryptionOpts-kmsProviders-azure-accessToken-type.json
@@ -0,0 +1,31 @@
+{
+ "description": "clientEncryptionOpts-kmsProviders-azure-accessToken-type",
+ "schemaVersion": "1.28",
+ "createEntities": [
+ {
+ "client": {
+ "id": "client0"
+ }
+ },
+ {
+ "clientEncryption": {
+ "id": "clientEncryption0",
+ "clientEncryptionOpts": {
+ "keyVaultClient": "client0",
+ "keyVaultNamespace": "keyvault.datakeys",
+ "kmsProviders": {
+ "azure": {
+ "accessToken": 0
+ }
+ }
+ }
+ }
+ }
+ ],
+ "tests": [
+ {
+ "description": "",
+ "operations": []
+ }
+ ]
+}
diff --git a/test/unified-test-format/invalid/clientEncryptionOpts-kmsProviders-gcp-accessToken-type.json b/test/unified-test-format/invalid/clientEncryptionOpts-kmsProviders-gcp-accessToken-type.json
new file mode 100644
index 00000000..2284e26c
--- /dev/null
+++ b/test/unified-test-format/invalid/clientEncryptionOpts-kmsProviders-gcp-accessToken-type.json
@@ -0,0 +1,31 @@
+{
+ "description": "clientEncryptionOpts-kmsProviders-gcp-accessToken-type",
+ "schemaVersion": "1.28",
+ "createEntities": [
+ {
+ "client": {
+ "id": "client0"
+ }
+ },
+ {
+ "clientEncryption": {
+ "id": "clientEncryption0",
+ "clientEncryptionOpts": {
+ "keyVaultClient": "client0",
+ "keyVaultNamespace": "keyvault.datakeys",
+ "kmsProviders": {
+ "gcp": {
+ "accessToken": 0
+ }
+ }
+ }
+ }
+ }
+ ],
+ "tests": [
+ {
+ "description": "",
+ "operations": []
+ }
+ ]
+}

20
.evergreen/sync-spawn-host.sh Executable file
View File

@ -0,0 +1,20 @@
#!/bin/bash
# Synchronize local files to a remote Evergreen spawn host.
set -eu
if [ -z "$1" ]
then
echo "Must supply a spawn host URL!"
fi
target=$1
user=${target%@*}
remote_dir=/home/$user/mongo-python-driver
echo "Copying files to $target..."
rsync -az -e ssh --exclude '.git' --filter=':- .gitignore' -r . $target:$remote_dir
echo "Copying files to $target... done."
echo "Syncing files to $target..."
# shellcheck disable=SC2034
fswatch -o . | while read f; do rsync -hazv -e ssh --exclude '.git' --filter=':- .gitignore' -r . $target:/home/$user/mongo-python-driver; done
echo "Syncing files to $target... done."

4
.git-blame-ignore-revs Normal file
View File

@ -0,0 +1,4 @@
# Initial pre-commit reformat
5578999a90e439fbca06fc0ffc98f4d04e96f7b4
# pyupgrade and ruff
0092b0af79378abf35b6db73a082ecb91af1d973

1
.github/CODEOWNERS vendored Normal file
View File

@ -0,0 +1 @@
* @mongodb/dbx-python

44
.github/copilot-instructions.md vendored Normal file
View File

@ -0,0 +1,44 @@
When reviewing code, focus on:
## Security Critical Issues
- Check for hardcoded secrets, API keys, or credentials.
- Check for instances of potential method call injection, dynamic code execution, symbol injection or other code injection vulnerabilities.
## Performance Red Flags
- Spot inefficient loops and algorithmic issues.
- Check for memory leaks and resource cleanup.
## Code Quality Essentials
- Methods should be focused and appropriately sized. If a method is doing too much, suggest refactorings to split it up.
- Use clear, descriptive naming conventions.
- Avoid encapsulation violations and ensure proper separation of concerns.
- All public classes, modules, and methods should have clear documentation in Sphinx format.
## PyMongo-specific Concerns
- Do not review files within `pymongo/synchronous` or files in `test/` that also have a file of the same name in `test/asynchronous` unless the reviewed changes include a `_IS_SYNC` statement. PyMongo generates these files from `pymongo/asynchronous` and `test/asynchronous` using `tools/synchro.py`.
- All asynchronous functions must not call any blocking I/O.
## Review Style
- Be specific and actionable in feedback.
- Explain the "why" behind recommendations.
- Acknowledge good patterns when you see them.
- Ask clarifying questions when code intent is unclear.
Always prioritize security vulnerabilities and performance issues that could impact users.
Always suggest changes to improve readability and testability. For example, this suggestion seeks to make the code more readable, reusable, and testable:
```python
# Instead of:
if user.email and "@" in user.email and len(user.email) > 5:
submit_button.enabled = True
else:
submit_button.enabled = False
# Consider:
def valid_email(email):
return email and "@" in email and len(email) > 5
submit_button.enabled = valid_email(user.email)
```

18
.github/dependabot.yml vendored Normal file
View File

@ -0,0 +1,18 @@
version: 2
updates:
# GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
cooldown:
default-days: 7
groups:
actions:
patterns:
- "*"
# Python
- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "weekly"

33
.github/pull_request_template.md vendored Normal file
View File

@ -0,0 +1,33 @@
<!-- Thanks for contributing! -->
<!-- Please ensure that the title of the PR is in the following form:
[JIRA TICKET]: Issue Title
If you are an external contributor and there is no JIRA ticket associated with your change, then use your best judgement
for the PR title. A MongoDB employee will create a JIRA ticket and edit the name and links as appropriate.
Note on AI Contributions:
We only accept pull requests that are authored and submitted by human contributors who fully understand the changes they are proposing.
All contributions must be written and understood by human contributors. Please read about our policy in our contributing guide.
-->
[JIRA TICKET]
## Changes in this PR
<!-- What changes did you make to the code? What new APIs (public or private) were added, removed, or edited to generate
the desired outcome explained in the above summary? -->
## Test Plan
<!-- How did you test the code? If you added unit tests, you can say that. If you didnt introduce unit tests, explain why.
All code should be tested in some way so please list what your validation strategy was. -->
## Checklist
<!-- Do not delete the items provided on this checklist. -->
### Checklist for Author
- [ ] Did you update the changelog (if necessary)?
- [ ] Is there test coverage?
- [ ] Is any followup work tracked in a JIRA ticket? If so, add link(s).
### Checklist for Reviewer
- [ ] Does the title of the PR reference a JIRA Ticket?
- [ ] Do you fully understand the implementation? (Would you be comfortable explaining how this code works to someone else?)
- [ ] Is all relevant documentation (README or docstring) updated?

5
.github/reviewers.txt vendored Normal file
View File

@ -0,0 +1,5 @@
# List of reviewers for auto-assignment of reviews.
caseyclements
blink1073
Jibola
NoahStapp

68
.github/workflows/codeql.yml vendored Normal file
View File

@ -0,0 +1,68 @@
name: "CodeQL"
on:
push:
branches: [ "master", "v*"]
tags: ['*']
pull_request:
workflow_call:
inputs:
ref:
required: true
type: string
schedule:
- cron: '17 10 * * 2'
concurrency:
group: codeql-${{ github.ref }}
cancel-in-progress: true
jobs:
analyze:
name: Analyze (${{ matrix.language }})
runs-on: "ubuntu-latest"
timeout-minutes: 360
permissions:
# required for all workflows
security-events: write
strategy:
fail-fast: false
matrix:
include:
- language: c-cpp
build-mode: manual
- language: python
build-mode: none
- language: actions
build-mode: none
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
ref: ${{ inputs.ref }}
persist-credentials: false
- uses: actions/setup-python@v6
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@5d4e8d1aca955e8d8589aabd499c5cae939e33c7 # v4
with:
languages: ${{ matrix.language }}
build-mode: ${{ matrix.build-mode }}
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
queries: security-extended
config: |
paths-ignore:
- 'doc/**'
- 'tools/**'
- 'test/**'
- if: matrix.build-mode == 'manual'
run: |
pip install -e .
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@5d4e8d1aca955e8d8589aabd499c5cae939e33c7 # v4
with:
category: "/language:${{matrix.language}}"

View File

@ -0,0 +1,57 @@
name: Create Release Branch
on:
workflow_dispatch:
inputs:
branch_name:
description: The name of the new branch
required: true
version:
description: The version to set on the branch
required: true
base_ref:
description: The base reference for the branch
push_changes:
description: Whether to push the changes
default: "true"
concurrency:
group: create-branch-${{ github.ref }}
cancel-in-progress: true
defaults:
run:
shell: bash -eux {0}
jobs:
create-branch:
environment: release
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write
outputs:
version: ${{ steps.pre-publish.outputs.version }}
steps:
- uses: mongodb-labs/drivers-github-tools/secure-checkout@v3
with:
app_id: ${{ vars.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}
- uses: mongodb-labs/drivers-github-tools/setup@v3
with:
aws_role_arn: ${{ secrets.AWS_ROLE_ARN }}
aws_region_name: ${{ vars.AWS_REGION_NAME }}
aws_secret_id: ${{ secrets.AWS_SECRET_ID }}
artifactory_username: ${{ vars.ARTIFACTORY_USERNAME }}
- name: Get hatch
run: pip install hatch
- uses: mongodb-labs/drivers-github-tools/create-branch@v3
id: create-branch
with:
branch_name: ${{ inputs.branch_name }}
version: ${{ inputs.version }}
base_ref: ${{ inputs.base_ref }}
push_changes: ${{ inputs.push_changes }}
version_bump_script: hatch version
evergreen_project: mongo-python-driver-release
release_workflow_path: ./.github/workflows/release-python.yml

148
.github/workflows/dist.yml vendored Normal file
View File

@ -0,0 +1,148 @@
name: Python Dist
on:
push:
tags:
- "[0-9]+.[0-9]+.[0-9]+"
- "[0-9]+.[0-9]+.[0-9]+.post[0-9]+"
- "[0-9]+.[0-9]+.[0-9]+[a-b][0-9]+"
- "[0-9]+.[0-9]+.[0-9]+rc[0-9]+"
workflow_dispatch:
pull_request:
workflow_call:
inputs:
ref:
required: true
type: string
concurrency:
group: dist-${{ github.ref }}
cancel-in-progress: true
defaults:
run:
shell: bash -eux {0}
jobs:
build_wheels:
name: Build wheels for ${{ matrix.buildplat[1] }}
runs-on: ${{ matrix.buildplat[0] }}
strategy:
# Ensure that a wheel builder finishes even if another fails
fail-fast: false
matrix:
# Github Actions doesn't support pairing matrix values together, let's improvise
# https://github.com/github/feedback/discussions/7835#discussioncomment-1769026
buildplat:
- [ubuntu-latest, "manylinux_x86_64", "cp3*-manylinux_x86_64"]
- [ubuntu-latest, "manylinux_aarch64", "cp3*-manylinux_aarch64"]
- [ubuntu-latest, "manylinux_ppc64le", "cp3*-manylinux_ppc64le"]
- [ubuntu-latest, "manylinux_s390x", "cp3*-manylinux_s390x"]
- [ubuntu-latest, "manylinux_i686", "cp3*-manylinux_i686"]
- [windows-2022, "win_amd6", "cp3*-win_amd64"]
- [windows-2022, "win32", "cp3*-win32"]
- [windows-11-arm, "win_arm64", "cp3*-win_arm64"]
- [macos-14, "macos", "cp*-macosx_*"]
steps:
- name: Checkout pymongo
uses: actions/checkout@v6
with:
fetch-depth: 0
persist-credentials: false
ref: ${{ inputs.ref }}
- uses: actions/setup-python@v6
with:
cache: 'pip'
python-version: 3.11
cache-dependency-path: 'pyproject.toml'
allow-prereleases: true
- name: Set up QEMU
if: runner.os == 'Linux'
uses: docker/setup-qemu-action@ce360397dd3f832beb865e1373c09c0e9f86d70a # v4.0.0
with:
# setup-qemu-action by default uses `tonistiigi/binfmt:latest` image,
# which is out of date. This causes seg faults during build.
# Here we manually fix the version.
image: tonistiigi/binfmt:qemu-v8.1.5
platforms: all
- name: Install cibuildwheel
# Note: the default manylinux is manylinux_2_28
run: |
python -m pip install -U pip
python -m pip install "cibuildwheel>=3.2.0,<4"
- name: Build wheels
env:
CIBW_BUILD: ${{ matrix.buildplat[2] }}
run: python -m cibuildwheel --output-dir wheelhouse
- name: Assert all versions in wheelhouse
if: ${{ ! startsWith(matrix.buildplat[1], 'macos') }}
run: |
ls wheelhouse/*cp39*.whl
ls wheelhouse/*cp310*.whl
ls wheelhouse/*cp311*.whl
ls wheelhouse/*cp312*.whl
ls wheelhouse/*cp313*.whl
ls wheelhouse/*cp314*.whl
# Free-threading builds:
ls wheelhouse/*cp314t*.whl
- uses: actions/upload-artifact@v7
with:
name: wheel-${{ matrix.buildplat[1] }}
path: ./wheelhouse/*.whl
if-no-files-found: error
make_sdist:
name: Make SDist
runs-on: macos-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
persist-credentials: false
ref: ${{ inputs.ref }}
- uses: actions/setup-python@v6
with:
# Build sdist on lowest supported Python
python-version: "3.9"
- name: Build SDist
run: |
set -ex
python -m pip install -U pip build
python -m build --sdist .
- name: Test SDist
run: |
python -m pip install dist/*.gz
cd ..
python -c "from pymongo import has_c; assert has_c()"
- uses: actions/upload-artifact@v7
with:
name: "sdist"
path: ./dist/*.tar.gz
collect_dist:
runs-on: ubuntu-latest
needs: [build_wheels, make_sdist]
name: Download Wheels
steps:
- name: Download all workflow run artifacts
uses: actions/download-artifact@v8
- name: Flatten directory
working-directory: .
run: |
find . -mindepth 2 -type f -exec mv {} . \;
find . -type d -empty -delete
- uses: actions/upload-artifact@v7
with:
name: all-dist-${{ github.run_id }}
path: "./*"

117
.github/workflows/release-python.yml vendored Normal file
View File

@ -0,0 +1,117 @@
name: Release
on:
workflow_dispatch:
inputs:
following_version:
description: "The post (dev) version to set"
dry_run:
description: "Dry Run?"
default: false
type: boolean
schedule:
- cron: '30 5 * * *'
env:
# Changes per repo
PRODUCT_NAME: PyMongo
# Changes per branch
EVERGREEN_PROJECT: mongo-python-driver
# Constant
# inputs will be empty on a scheduled run. so, we only set dry_run
# to 'false' when the input is set to 'false'.
DRY_RUN: ${{ ! contains(inputs.dry_run, 'false') }}
FOLLOWING_VERSION: ${{ inputs.following_version || '' }}
defaults:
run:
shell: bash -eux {0}
jobs:
pre-publish:
environment: release
runs-on: ubuntu-latest
if: github.repository_owner == 'mongodb' || github.event_name == 'workflow_dispatch'
permissions:
id-token: write
contents: write
outputs:
version: ${{ steps.pre-publish.outputs.version }}
steps:
- uses: mongodb-labs/drivers-github-tools/secure-checkout@v3
with:
app_id: ${{ vars.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}
- uses: mongodb-labs/drivers-github-tools/setup@v3
with:
aws_role_arn: ${{ secrets.AWS_ROLE_ARN }}
aws_region_name: ${{ vars.AWS_REGION_NAME }}
aws_secret_id: ${{ secrets.AWS_SECRET_ID }}
- uses: mongodb-labs/drivers-github-tools/python/pre-publish@v3
id: pre-publish
with:
dry_run: ${{ env.DRY_RUN }}
build-dist:
needs: [pre-publish]
uses: ./.github/workflows/dist.yml
with:
ref: ${{ needs.pre-publish.outputs.version }}
static-scan:
needs: [pre-publish]
uses: ./.github/workflows/codeql.yml
permissions:
security-events: write
with:
ref: ${{ needs.pre-publish.outputs.version }}
publish:
needs: [build-dist, static-scan]
name: Upload release to PyPI
runs-on: ubuntu-latest
environment: release
permissions:
id-token: write
steps:
- name: Download all the dists
uses: actions/download-artifact@v8
with:
name: all-dist-${{ github.run_id }}
path: dist/
- name: Publish package distributions to TestPyPI
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # release/v1
with:
repository-url: https://test.pypi.org/legacy/
skip-existing: true
attestations: ${{ env.DRY_RUN }}
- name: Publish package distributions to PyPI
if: startsWith(env.DRY_RUN, 'false')
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # release/v1
post-publish:
needs: [publish]
runs-on: ubuntu-latest
environment: release
permissions:
id-token: write
contents: write
attestations: write
security-events: write
steps:
- uses: mongodb-labs/drivers-github-tools/secure-checkout@v3
with:
app_id: ${{ vars.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}
- uses: mongodb-labs/drivers-github-tools/setup@v3
with:
aws_role_arn: ${{ secrets.AWS_ROLE_ARN }}
aws_region_name: ${{ vars.AWS_REGION_NAME }}
aws_secret_id: ${{ secrets.AWS_SECRET_ID }}
- uses: mongodb-labs/drivers-github-tools/python/post-publish@v3
with:
following_version: ${{ env.FOLLOWING_VERSION }}
product_name: ${{ env.PRODUCT_NAME }}
evergreen_project: ${{ env.EVERGREEN_PROJECT }}
token: ${{ github.token }}
dry_run: ${{ env.DRY_RUN }}

104
.github/workflows/sbom.yml vendored Normal file
View File

@ -0,0 +1,104 @@
name: Generate SBOM
# This workflow uses cyclonedx-py and publishes an sbom.json artifact.
# It runs on manual trigger or when package files change on main branch,
# and creates a PR with the updated SBOM.
# Internal documentation: go/sbom-scope
on:
workflow_dispatch: {}
push:
branches: ['master']
paths:
- 'requirements.txt'
- 'requirements/**.txt'
- '!requirements/docs.txt'
- '!requirements/test.txt'
permissions:
contents: write
pull-requests: write
jobs:
sbom:
name: Generate SBOM and Create PR
runs-on: ubuntu-latest
concurrency:
group: sbom-${{ github.ref }}
cancel-in-progress: false
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.10"
- name: Generate SBOM
run: |
python -m venv .venv
source .venv/bin/activate
python tools/generate_sbom_requirements.py
pip install -r sbom-requirements.txt
pip install .
pip uninstall -y pip setuptools
deactivate
python -m venv .venv-sbom
source .venv-sbom/bin/activate
pip install cyclonedx-bom==7.2.1
cyclonedx-py environment --spec-version 1.5 --output-format JSON --output-file sbom.json .venv
# Add PURL for pymongo (local package doesn't get PURL automatically)
jq '(.components[] | select(.name == "pymongo" and .purl == null)) |= (. + {purl: ("pkg:pypi/pymongo@" + .version)})' sbom.json > sbom.tmp.json && mv sbom.tmp.json sbom.json
- name: Download CycloneDX CLI
run: |
curl -L -s -o /tmp/cyclonedx "https://github.com/CycloneDX/cyclonedx-cli/releases/download/v0.29.1/cyclonedx-linux-x64"
chmod +x /tmp/cyclonedx
- name: Validate SBOM
run: /tmp/cyclonedx validate --input-file sbom.json --fail-on-errors
- name: Cleanup
if: always()
run: rm -rf .venv .venv-sbom sbom-requirements.txt
- name: Upload SBOM artifact
uses: actions/upload-artifact@v7
with:
name: sbom
path: sbom.json
if-no-files-found: error
- name: Create Pull Request
uses: peter-evans/create-pull-request@c0f553fe549906ede9cf27b5156039d195d2ece0 # v8
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: 'chore: Update SBOM after dependency changes'
branch: auto-update-sbom-${{ github.run_id }}
delete-branch: true
title: 'Automation: Update SBOM'
body: |
## Automated SBOM Update
This PR was automatically generated because dependency manifest files changed.
### Changes
- Updated `sbom.json` to reflect current dependencies
### Verification
The SBOM was generated using cyclonedx-py v7.2.1 with the current Python environment.
### Triggered by
- Commit: ${{ github.sha }}
- Workflow run: ${{ github.run_id }}
---
_This PR was created automatically by the [SBOM workflow](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})_
labels: |
sbom
automated
dependencies

311
.github/workflows/test-python.yml vendored Normal file
View File

@ -0,0 +1,311 @@
name: Python Tests
on:
push:
branches: ["master", "v**"]
pull_request:
workflow_dispatch:
concurrency:
group: tests-${{ github.ref }}
cancel-in-progress: true
defaults:
run:
shell: bash -eux {0}
permissions:
contents: read
jobs:
static:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: Install uv
uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7
with:
enable-cache: true
python-version: "3.10"
- name: Install just
run: uv tool install rust-just
- name: Install Python dependencies
run: |
just install
- name: Run linters
run: |
just lint-manual
- name: Run compilation
run: |
export PYMONGO_C_EXT_MUST_BUILD=1
pip install -v -e .
python tools/fail_if_no_c.py
- name: Run typecheck
run: |
just typing
- run: |
sudo apt-get install -y cppcheck
- run: |
cppcheck --force bson
cppcheck pymongo
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
# Tests currently only pass on ubuntu on GitHub Actions.
os: [ubuntu-latest]
python-version: ["3.10", "pypy-3.11", "3.13t"]
mongodb-version: ["8.0"]
name: CPython ${{ matrix.python-version }}-${{ matrix.os }}
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: Install uv
uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7
with:
enable-cache: true
python-version: ${{ matrix.python-version }}
- id: setup-mongodb
uses: mongodb-labs/drivers-evergreen-tools@master
with:
version: "${{ matrix.mongodb-version }}"
- name: Run tests
run: uv run --extra test pytest -v
coverage:
# This enables a coverage report for a given PR, which will be augmented by
# the combined codecov report uploaded in Evergreen.
runs-on: ubuntu-latest
name: Coverage
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: Install uv
uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7
with:
enable-cache: true
python-version: "3.10"
- id: setup-mongodb
uses: mongodb-labs/drivers-evergreen-tools@master
with:
version: "8.0"
- name: Install just
run: uv tool install rust-just
- name: Setup tests
run: COVERAGE=1 just setup-tests
- name: Run tests
run: just run-tests
- name: Generate xml report
run: uv tool run --with "coverage[toml]" coverage xml
- name: Upload test results to Codecov
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
doctest:
runs-on: ubuntu-latest
name: DocTest
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: Install uv
uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7
with:
enable-cache: true
python-version: "3.10"
- name: Install just
run: uv tool install rust-just
- id: setup-mongodb
uses: mongodb-labs/drivers-evergreen-tools@master
with:
version: "8.0"
- name: Install dependencies
run: just install
- name: Run tests
run: |
just setup-tests doctest
just run-tests
docs:
name: Docs Checks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: Install uv
uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7
with:
enable-cache: true
python-version: "3.10"
- name: Install just
run: uv tool install rust-just
- name: Install dependencies
run: just install
- name: Build docs
run: just docs
linkcheck:
name: Link Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: Install uv
uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7
with:
enable-cache: true
python-version: "3.10"
- name: Install just
run: uv tool install rust-just
- name: Install dependencies
run: just install
- name: Build docs
run: just docs-linkcheck
typing:
name: Typing Tests
runs-on: ubuntu-latest
strategy:
matrix:
python: ["3.10", "3.11"]
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: Install uv
uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7
with:
enable-cache: true
python-version: "${{matrix.python}}"
- name: Install just
run: uv tool install rust-just
- name: Install dependencies
run: |
just install
- name: Run typecheck
run: |
just typing
integration_tests:
runs-on: ubuntu-latest
name: Integration Tests
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: Install uv
uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7
with:
enable-cache: true
python-version: "3.10"
- name: Install just
run: uv tool install rust-just
- name: Install dependencies
run: |
just install
- id: setup-mongodb
uses: mongodb-labs/drivers-evergreen-tools@master
- name: Run tests
run: |
just integration-tests
- id: setup-mongodb-ssl
uses: mongodb-labs/drivers-evergreen-tools@master
with:
ssl: true
- name: Run tests
run: |
just integration-tests
make_sdist:
runs-on: ubuntu-latest
name: "Make an sdist"
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- uses: actions/setup-python@v6
with:
cache: 'pip'
cache-dependency-path: 'pyproject.toml'
# Build sdist on lowest supported Python
python-version: "3.9"
- name: Build SDist
shell: bash
run: |
pip install build
python -m build --sdist
- uses: actions/upload-artifact@v7
with:
name: "sdist"
path: dist/*.tar.gz
test_sdist:
runs-on: ubuntu-latest
needs: [make_sdist]
name: Install from SDist and Test
timeout-minutes: 20
steps:
- name: Download sdist
uses: actions/download-artifact@v8
with:
path: sdist/
- name: Unpack SDist
shell: bash
run: |
cd sdist
ls
mkdir test
tar --strip-components=1 -zxf *.tar.gz -C ./test
ls test
- uses: actions/setup-python@v6
with:
cache: 'pip'
cache-dependency-path: 'sdist/test/pyproject.toml'
# Test sdist on lowest supported Python
python-version: "3.9"
- id: setup-mongodb
uses: mongodb-labs/drivers-evergreen-tools@master
- name: Run connect test from sdist
shell: bash
run: |
cd sdist/test
ls
which python
pip install -e ".[test]"
PYMONGO_MUST_CONNECT=1 pytest -v -k client_context
test_minimum:
permissions:
contents: read
runs-on: ubuntu-latest
name: Test minimum dependencies and Python
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: Install uv
uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7
with:
python-version: "3.9"
- id: setup-mongodb
uses: mongodb-labs/drivers-evergreen-tools@master
with:
version: "8.0"
- name: Run tests
shell: bash
run: |
uv venv
source .venv/bin/activate
uv pip install -e ".[test]" --resolution=lowest-direct --force-reinstall
pytest -v test/test_srv_polling.py test/test_dns.py test/asynchronous/test_srv_polling.py test/asynchronous/test_dns.py

21
.github/workflows/zizmor.yml vendored Normal file
View File

@ -0,0 +1,21 @@
name: GitHub Actions Security Analysis with zizmor 🌈
on:
push:
branches: ["master"]
pull_request:
branches: ["**"]
jobs:
zizmor:
name: zizmor latest via Cargo
runs-on: ubuntu-latest
permissions:
security-events: write
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
persist-credentials: false
- name: Run zizmor 🌈
uses: zizmorcore/zizmor-action@71321a20a9ded102f6e9ce5718a2fcec2c4f70d8 # v0.5.2

7
.github/zizmor.yml vendored Normal file
View File

@ -0,0 +1,7 @@
rules:
unpinned-uses:
config:
policies:
actions/*: ref-pin
mongodb-labs/drivers-github-tools/*: ref-pin
mongodb-labs/drivers-evergreen-tools: ref-pin

35
.gitignore vendored
View File

@ -9,9 +9,38 @@ build/
doc/_build/
dist/
tools/settings.py
drivers-evergreen-tools
pymongo.egg-info/
*.so
nosetests.xml
setup.cfg
*.egg
*.egg*
.tox
mongocryptd.pid
.idea/
.vscode/
.nova/
.temp/
venv/
secrets-export.sh
libmongocrypt.tar.gz
libmongocrypt/
.venv
expansion.yml
*expansions.yml
.evergreen/scripts/env.sh
.evergreen/scripts/test-env.sh
specifications/
results.json
.evergreen/atlas_x509_dev_client_certificate.pem
# Lambda temp files
test/lambda/.aws-sam
test/lambda/mongodb/pymongo/*
test/lambda/mongodb/gridfs/*
test/lambda/mongodb/bson/*
test/lambda/*.json
# test results and logs
xunit-results/
coverage.xml
server.log
.coverage

135
.pre-commit-config.yaml Normal file
View File

@ -0,0 +1,135 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-added-large-files
- id: check-case-conflict
- id: check-toml
- id: check-json
- id: check-yaml
exclude: template.yaml
- id: debug-statements
- id: end-of-file-fixer
exclude: WHEEL
exclude_types: [json]
- id: forbid-new-submodules
- id: trailing-whitespace
exclude: .patch
exclude_types: [json]
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.1.3
hooks:
- id: ruff
args: ["--fix", "--show-fixes"]
- id: ruff-format
- repo: local
hooks:
- id: synchro
name: synchro
entry: bash ./tools/synchro.sh
language: python
require_serial: true
fail_fast: true
additional_dependencies:
- ruff==0.1.3
- unasync
- repo: https://github.com/adamchainz/blacken-docs
rev: "1.16.0"
hooks:
- id: blacken-docs
additional_dependencies:
- black==22.3.0
- repo: https://github.com/pre-commit/pygrep-hooks
rev: "v1.10.0"
hooks:
- id: rst-backticks
- id: rst-directive-colons
- id: rst-inline-touching-normal
- repo: https://github.com/rstcheck/rstcheck
rev: v6.2.0
hooks:
- id: rstcheck
additional_dependencies: [sphinx]
args: ["--ignore-directives=doctest,testsetup,todo,automodule","--ignore-substitutions=release", "--report-level=error"]
# We use the Python version instead of the original version which seems to require Docker
# https://github.com/koalaman/shellcheck-precommit
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.9.0.6
hooks:
- id: shellcheck
name: shellcheck
args: ["--severity=warning"]
stages: [manual]
- repo: https://github.com/PyCQA/doc8
rev: v1.1.1
hooks:
- id: doc8
args: ["--ignore=D001"] # ignore line length
stages: [manual]
- repo: https://github.com/sirosen/check-jsonschema
rev: 0.29.0
hooks:
- id: check-github-workflows
- id: check-github-actions
- id: check-dependabot
- repo: https://github.com/ariebovenberg/slotscheck
rev: v0.19.0
hooks:
- id: slotscheck
files: \.py$
exclude: "^(test|tools)/"
stages: [manual]
args: ["--no-strict-imports"]
- repo: https://github.com/codespell-project/codespell
rev: "v2.2.6"
hooks:
- id: codespell
# Examples of errors or updates to justify the exceptions:
# - test/test_on_demand_csfle.py:44: FLE ==> FILE
# - test/test_bson.py:1043: fo ==> of, for, to, do, go
# - test/bson_corpus/decimal128-4.json:98: Infinit ==> Infinite
# - test/test_bson.py:267: isnt ==> isn't
# - test/versioned-api/crud-api-version-1-strict.json:514: nin ==> inn, min, bin, nine
# - test/test_client.py:188: te ==> the, be, we, to
args: ["-L", "fle,fo,infinit,isnt,nin,te,aks"]
- repo: local
hooks:
- id: executable-shell
name: executable-shell
entry: chmod +x
language: system
types: [shell]
exclude: |
(?x)(
.evergreen/retry-with-backoff.sh
)
- id: generate-config
name: generate-config
entry: .evergreen/scripts/generate-config.sh
language: python
require_serial: true
additional_dependencies: ["shrub.py>=3.10.0", "pyyaml>=6.0.2"]
- id: uv-lock
name: uv-lock
entry: uv lock
language: python
require_serial: true
files: ^(uv\.lock|pyproject\.toml|requirements.txt|requirements/.*\.txt)$
pass_filenames: false
fail_fast: true
additional_dependencies:
- "uv>=0.8.4"

24
.readthedocs.yaml Normal file
View File

@ -0,0 +1,24 @@
# .readthedocs.yaml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
# Required
version: 2
# Build documentation in the doc/ directory with Sphinx
sphinx:
configuration: doc/conf.py
fail_on_warning: true
# Set the version of Python and requirements required to build the docs.
python:
install:
# Install pymongo itself.
- method: pip
path: .
- requirements: requirements/docs.txt
build:
os: ubuntu-22.04
tools:
python: "3.11"

View File

@ -1,18 +0,0 @@
language: python
python:
- 2.5
- 2.6
- 2.7
- 3.2
- 3.3
- pypy
services:
- mongodb
script: python setup.py test
install:
#Temporary solution for Travis CI mutiprocessing issue #155
- sudo rm -rf /dev/shm && sudo ln -s /run/shm /dev/shm

580
CONTRIBUTING.md Normal file
View File

@ -0,0 +1,580 @@
# Contributing to PyMongo
PyMongo has a large
[community](https://pymongo.readthedocs.io/en/stable/contributors.html)
and contributions are always encouraged. Contributions can be as simple
as minor tweaks to the documentation. Please read these guidelines
before sending a pull request.
## Bugfixes and New Features
Before starting to write code, look for existing
[tickets](https://jira.mongodb.org/browse/PYTHON) or [create
one](https://jira.mongodb.org/browse/PYTHON) for your specific issue or
feature request. That way you avoid working on something that might not
be of interest or that has already been addressed.
## Supported Interpreters
PyMongo supports CPython 3.9+ and PyPy3.9+. Language features not
supported by all interpreters can not be used.
## Style Guide
PyMongo follows [PEP8](http://www.python.org/dev/peps/pep-0008/)
including 4 space indents and 79 character line limits.
## General Guidelines
- Avoid backward breaking changes if at all possible.
- Write inline documentation for new classes and methods.
- We use [uv](https://docs.astral.sh/uv/) for python environment management and packaging.
- We use [just](https://just.systems/man/en/) as our task runner.
- Write tests and make sure they pass (make sure you have a mongod
running on the default port, then execute `just test` from the cmd
line to run the test suite).
- Add yourself to doc/contributors.rst `:)`
## Authoring a Pull Request
**Our Pull Request Policy is based on this** [Code Review Developer
Guide](https://google.github.io/eng-practices/review)
The expectation for any code author is to provide all the context needed
in the space of a pull request for any engineer to feel equipped to
review the code. Depending on the type of change, do your best to
highlight important new functions or objects you've introduced in the
code; think complex functions or new abstractions. Whilst it may seem
like more work for you to adjust your pull request, the reality is your
likelihood for getting review sooner shoots up.
**Self Review Guidelines to follow**
- If the PR is too large, split it if possible.
- Use 250 LoC (excluding test data and config changes) as a
rule-of-thumb.
- Moving and changing code should be in separate PRs or commits.
- Moving: Taking large code blobs and transplanting
them to another file. There\'s generally no (or very
little) actual code changed other than a cut and
paste. It can even be extended to large deletions.
- Changing: Adding code changes (be that refactors or
functionality additions/subtractions).
- These two, when mixed, can muddy understanding and
sometimes make it harder for reviewers to keep track
of things.
- Prefer explaining with code comments instead of PR comments.
**Provide background**
- The PR description and linked tickets should answer the "what" and
"why" of the change. The code change explains the "how".
**Follow the Template**
- Please do not deviate from the template we make; it is there for a
lot of reasons. If it is a one line fix, we still need to have
context on what and why it is needed.
- If making a versioning change, please let that be known. See examples below:
- `versionadded:: 3.11`
- `versionchanged:: 3.5`
### AI-Generated Contributions Policy
#### Our Stance
We only accept pull requests that are authored and submitted by human contributors who fully understand the changes they are proposing. Pull requests that are not clearly owned and understood by a human contributor may be closed. **All contributions must be submitted, reviewed, and understood by human contributors.**
##### Why This Policy Exists
At MongoDB, we understand the power and prevalence of AI tools in software development. With that being said, many MongoDB libraries are foundational tools used in production systems worldwide. The nature of these libraries requires:
- **Deep domain expertise**: MongoDB's wire protocol, BSON specification, connection pooling, authentication mechanisms, and concurrency patterns require an understanding that AI alone cannot substantiate.
- **Long-term maintainability**: Contributors need to be able to explain *why* code is written a certain way, explain design decisions, and be available to iterate on their contributions.
- **Security responsibility**: Authentication, credential handling, and TLS implementation cannot be left to probabilistic code generation.
##### What This Means for Contributors
**Required:**
- Full understanding of every line of code you submit
- Ability to explain and defend your implementation choices
- Willingness to iterate and maintain your contributions
**Encouraged:**
- Using AI assistants as learning tools to understand concepts
- IDE autocomplete features that suggest standard patterns
- AI help for brainstorming approaches (but write the code yourself)
- Writing code using AI tools, reviewing each line and revising code as necessary.
**Not allowed:**
- Submitting PRs generated solely by AI tools
- Copy-pasting AI-generated code without full understanding
##### Disclosure
If you used AI assistance in any way during your contribution, please disclose what the AI assistant was used for in your PR description. We would love to know what tools developers have found useful in iterating in their day to day.
##### Questions?
If you're unsure whether your contribution complies with this policy, please ask for guidance within the scope of the PR and clarify any uncertainty. We're happy to guide contributors toward successful contributions.
---
*This policy helps us maintain the reliability, security, and trustworthiness that production applications depend on. Thank you for understanding and for contributing thoughtfully to PyMongo.*
## Running Linters
PyMongo uses [pre-commit](https://pypi.org/project/pre-commit/) for
managing linting of the codebase. `pre-commit` performs various checks
on all files in PyMongo and uses tools that help follow a consistent
code style within the codebase.
To set up `pre-commit` locally, run:
```bash
brew install pre-commit
pre-commit install
```
To run `pre-commit` manually, run:
```bash
pre-commit run --all-files
```
To run a manual hook like `ruff` manually, run:
```bash
pre-commit run --all-files --hook-stage manual ruff
```
Typically we use `just` to run the linters, e.g.
```bash
just install # this will install a venv with pre-commit installed, and install the pre-commit hook.
just typing-mypy
just run lint-manual
```
## Documentation
To contribute to the [API documentation](https://pymongo.readthedocs.io/en/stable/) just make your
changes to the inline documentation of the appropriate [source code](https://github.com/mongodb/mongo-python-driver) or
[rst file](https://github.com/mongodb/mongo-python-driver/tree/master/doc) in
a branch and submit a [pull request](https://help.github.com/articles/using-pull-requests). You
might also use the GitHub
[Edit](https://github.com/blog/844-forking-with-the-edit-button) button.
We use [reStructuredText](https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html) for all
documentation including narrative docs, and the [Sphinx docstring format](https://sphinx-rtd-tutorial.readthedocs.io/en/latest/docstrings.html).
You can build the documentation locally by running:
```bash
just docs
```
When updating docs, it can be helpful to run the live docs server as:
```bash
just docs-serve
```
Browse to the link provided, and then as you make changes to docstrings or narrative docs,
the pages will re-render and the browser will automatically refresh.
## Running Tests Locally
- Run `just install` to set a local virtual environment, or you can manually
create a virtual environment and run `pytest` directly. If you want to use a specific
version of Python, set `UV_PYTHON` before running `just install`.
- Ensure you have started the appropriate Mongo Server(s). You can run `just run-server` with optional args
to set up the server. All given options will be passed to
[`run-mongodb.sh`](https://github.com/mongodb-labs/drivers-evergreen-tools/blob/master/.evergreen/run-mongodb.sh). Run `$DRIVERS_TOOLS/.evergreen/run-mongodb.sh start -h`
for a full list of options.
- Run `just test` or `pytest` to run all of the tests.
- Append `test/<mod_name>.py::<class_name>::<test_name>` to run
specific tests. You can omit the `<test_name>` to test a full class
and the `<class_name>` to test a full module. For example:
`just test test/test_change_stream.py::TestUnifiedChangeStreamsErrors::test_change_stream_errors_on_ElectionInProgress`.
- Use the `-k` argument to select tests by pattern.
- Run `just test-coverage` to run tests with coverage and display a report. After running tests with coverage, use `just coverage-html` to generate an HTML report in `htmlcov/index.html`.
## Running tests that require secrets, services, or other configuration
### Prerequisites
- Clone `drivers-evergreen-tools`:
`git clone git@github.com:mongodb-labs/drivers-evergreen-tools.git`.
- Run `export DRIVERS_TOOLS=$PWD/drivers-evergreen-tools`. This can be put into a `.bashrc` file
for convenience.
- Some tests require access to [Drivers test secrets](https://github.com/mongodb-labs/drivers-evergreen-tools/tree/master/.evergreen/secrets_handling#secrets-handling).
### Usage
- Run `just run-server` with optional args to set up the server.
- Run `just setup-tests` with optional args to set up the test environment, secrets, etc.
See `just setup-tests -h` for a full list of available options.
- Run `just run-tests` to run the tests in an appropriate Python environment.
- When done, run `just teardown-tests` to clean up and `just stop-server` to stop the server.
### SSL tests
- Run `just run-server --ssl` to start the server with TLS enabled.
- Run `just setup-tests --ssl`.
- Run `just run-tests`.
Note: for general testing purposes with an TLS-enabled server, you can use the following (this should ONLY be used
for local testing):
```python
from pymongo import MongoClient
client = MongoClient(
"mongodb://localhost:27017?tls=true&tlsAllowInvalidCertificates=true"
)
```
If you want to use the actual certificate file then set `tlsCertificateKeyFile` to the local path
to `<repo_roo>/test/certificates/client.pem` and `tlsCAFile` to the local path to `<repo_roo>/test/certificates/ca.pem`.
### Encryption tests
- Run `just run-server` to start the server.
- Run `just setup-tests encryption`.
- Run the tests with `just run-tests`.
To test with `encryption` and `PyOpenSSL`, use `just setup-tests encryption pyopenssl`.
### PyOpenSSL tests
- Run `just run-server` to start the server.
- Run `just setup-tests default_sync pyopenssl`.
- Run the tests with `just run-tests`.
Note: `PyOpenSSL` is not used in async tests, but you can use `just setup-tests default_async pyopenssl`
to verify that PyMongo falls back to the standard library `OpenSSL`.
### Load balancer tests
- Install `haproxy` (available as `brew install haproxy` on macOS).
- Start the server with `just run-server load_balancer`.
- Set up the test with `just setup-tests load_balancer`.
- Run the tests with `just run-tests`.
### AWS auth tests
- Run `just run-server auth_aws` to start the server.
- Run `just setup-tests auth_aws <aws-test-type>` to set up the AWS test.
- Run the tests with `just run-tests`.
### OIDC auth tests
- Run `just setup-tests auth_oidc <oidc-test-type>` to set up the OIDC test.
- Run the tests with `just run-tests`.
The supported types are [`default`, `azure`, `gcp`, `eks`, `aks`, and `gke`].
For the `eks` test, you will need to set up access to the `drivers-test-secrets-role`, see the [Wiki](https://wiki.corp.mongodb.com/spaces/DRIVERS/pages/239737385/Using+AWS+Secrets+Manager+to+Store+Testing+Secrets).
### KMS tests
For KMS tests that are run locally, and expected to fail, in this case using `azure`:
- Run `just run-server`.
- Run `just setup-tests kms azure-fail`.
- Run `just run-tests`.
For KMS tests that run remotely and are expected to pass, in this case using `gcp`:
- Run `just setup-tests kms gcp`.
- Run `just run-tests`.
### Enterprise Auth tests
Note: these tests can only be run from an Evergreen host.
- Run `just run-server enterprise_auth`.
- Run `just setup-tests enterprise_auth`.
- Run `just run-tests`.
### Atlas Connect tests
- Run `just setup-tests atlas_connect`.
- Run `just run-tests`.
### Search Index tests
- Run `just run-server search_index`.
- Run `just setup-tests search_index`.
- Run `just run-tests`.
### MockupDB tests
- Run `just setup-tests mockupdb`.
- Run `just run-tests`.
### Doc tests
The doc tests require a running server.
- Run `just run-server`.
- Run `just setup-tests doctest`.
- Run `just run-tests`.
### Free-threaded Python Tests
In the evergreen builds, the tests are configured to use the free-threaded python from the toolchain.
Locally you can run:
- Run `just run-server`.
- Run `just setup-tests`.
- Run `UV_PYTHON=3.14t just run-tests`.
### AWS Lambda tests
You will need to set up access to the `drivers-test-secrets-role`, see the [Wiki](https://wiki.corp.mongodb.com/spaces/DRIVERS/pages/239737385/Using+AWS+Secrets+Manager+to+Store+Testing+Secrets).
- Run `just setup-tests aws_lambda`.
- Run `just run-tests`.
### mod_wsgi tests
Note: these tests can only be run from an Evergreen Linux host that has the Python toolchain.
- Run `just run-server`.
- Run `just setup-tests mod_wsgi <mode>`.
- Run `just run-tests`.
The `mode` can be `standalone` or `embedded`. For the `replica_set` version of the tests, use
`TOPOLOGY=replica_set just run-server`.
### OCSP tests
- Export the orchestration file, e.g. `export ORCHESTRATION_FILE=rsa-basic-tls-ocsp-disableStapling.json`.
This corresponds to a config file in `$DRIVERS_TOOLS/.evergreen/orchestration/configs/servers`.
MongoDB servers on MacOS and Windows do not staple OCSP responses and only support RSA.
NOTE: because the mock ocsp responder MUST be started prior to the server starting, the ocsp tests start the server
as part of `setup-tests`.
- Run `just setup-tests ocsp <sub test>` (options are "valid", "revoked", "valid-delegate", "revoked-delegate").
- Run `just run-tests`
If you are running one of the `no-responder` tests, omit the `run-server` step.
### Perf Tests
- Start the appropriate server, e.g. `just run-server --version=v8.0-perf --ssl`.
- Set up the tests with `sync` or `async`: `just setup-tests perf sync`.
- Run the tests: `just run-tests`.
## Enable Debug Logs
- Use `-o log_cli_level="DEBUG" -o log_cli=1` with `just test` or `pytest` to output all debug logs to the terminal. **Warning**: This will output a huge amount of logs.
- Add `log_cli=1` and `log_cli_level="DEBUG"` to the `tool.pytest.ini_options` section in `pyproject.toml` to enable debug logs in this manner by default on your machine.
- Set `DEBUG_LOG=1` and run `just setup-tests`, `just-test`, or `pytest` to enable debug logs only for failed tests.
- Finally, you can use `just setup-tests --debug-log`.
- For evergreen patch builds, you can use `evergreen patch --param DEBUG_LOG=1` to enable debug logs for failed tests in the patch.
## Testing minimum dependencies
To run any of the test suites with minimum supported dependencies, pass `--test-min-deps` to
`just setup-tests`.
## Testing time-dependent operations
- `test.utils_shared.delay` - One can trigger an arbitrarily long-running operation on the server using this delay utility
in combination with a `$where` operation. Use this to test behaviors around timeouts or signals.
## Adding a new test suite
- If adding new tests files that should only be run for that test suite, add a pytest marker to the file and add
to the list of pytest markers in `pyproject.toml`. Then add the test suite to the `TEST_SUITE_MAP` in `.evergreen/scripts/utils.py`. If for some reason it is not a pytest-runnable test, add it to the list of `EXTRA_TESTS` instead.
- If the test uses Atlas or otherwise doesn't use `run-mongodb.sh`, add it to the `NO_RUN_ORCHESTRATION` list in
`.evergreen/scripts/utils.py`.
- If there is something special required to run the local server or there is an extra flag that should always be set
like `AUTH`, add that logic to `.evergreen/scripts/run_server.py`.
- The bulk of the logic will typically be in `.evergreen/scripts/setup_tests.py`. This is where you should fetch secrets and make them available using `write_env`, start services, and write other env vars needed using `write_env`.
- If there are any special test considerations, including not running `pytest` at all, handle it in `.evergreen/scripts/run_tests.py`.
- If there are any services or atlas clusters to teardown, handle them in `.evergreen/scripts/teardown_tests.py`.
- Add functions to generate the test variant(s) and task(s) to the `.evergreen/scripts/generate_config.py`.
- There are some considerations about the Python version used in the test:
- If a specific version of Python is needed in a task that is running on variants with a toolchain, use
``TOOLCHAIN_VERSION`` (e.g. `TOOLCHAIN_VERSION=3.10`). The actual path lookup needs to be done on the host, since
tasks are host-agnostic.
- If a specific Python binary is needed (for example on the FIPS host), set `UV_PYTHON=/path/to/python`.
- If a specific Python version is needed and the toolchain will not be available, use `UV_PYTHON` (e.g. `UV_PYTHON=3.11`).
- The default if neither ``TOOLCHAIN_VERSION`` or ``UV_PYTHON`` is set is to use UV to install the minimum
supported version of Python and use that. This ensures a consistent behavior across host types that do not
have the Python toolchain (e.g. Azure VMs), by having a known version of Python with the build headers (`Python.h`)
needed to build the C extensions.
- Regenerate the test variants and tasks using `pre-commit run --all-files generate-config`.
- Make sure to add instructions for running the test suite to `CONTRIBUTING.md`.
## Handling flaky tests
We have a custom `flaky` decorator in [test/asynchronous/utils.py](test/asynchronous/utils.py) that can be used for
tests that are `flaky`. By default the decorator only applies when not running on CPython on Linux, since other
runtimes tend to have more variation. When using the `flaky` decorator, open a corresponding ticket and
a use the ticket number as the "reason" parameter to the decorator, e.g. `@flaky(reason="PYTHON-1234")`.
When running tests locally (not in CI), the `flaky` decorator will be disabled unless `ENABLE_FLAKY` is set.
To disable the `flaky` decorator in CI, you can use `evergreen patch --param DISABLE_FLAKY=1`.
## Integration Tests
The `integration_tests` directory has a set of scripts that verify the usage of PyMongo with downstream packages or frameworks. See the [README](./integration_tests/README.md) for more information.
To run the tests, use `just integration_tests`.
The tests should be able to run with and without SSL enabled.
## Specification Tests
The MongoDB [specifications repository](https://github.com/mongodb/specifications)
holds in progress and completed specifications for features of MongoDB, drivers,
and associated products. PyMongo supports the [Unified Test Format](https://jira.mongodb.org/browse/DRIVERS-709)
for running specification tests to confirm PyMongo behaves as expected.
### Resynchronizing the Specification Tests
If you would like to re-sync the copy of the specification tests in the
PyMongo repository with that which is inside the [specifications
repo](https://github.com/mongodb/specifications), please use the script
provided in `.evergreen/resync-specs.sh`.:
```bash
git clone git@github.com:mongodb/specifications.git
export MDB_SPECS=~/specifications
cd ~/mongo-python-driver/.evergreen
./resync-specs.sh -b "<regex>" spec1 spec2 ...
./resync-specs.sh -b "connection-string*" crud bson-corpus # Updates crud and bson-corpus specs while ignoring all files with the regex "connection-string*"
cd ..
```
The `-b` flag adds as a regex pattern to block files you do not wish to
update in PyMongo. This is primarily helpful if you are implementing a
new feature in PyMongo that has spec tests already implemented, or if
you are attempting to validate new spec tests in PyMongo.
### Automated Specification Test Resyncing
The (`/.evergreen/scripts/resync-all-specs.sh`) script
automatically runs once a week to resync all the specs with the [specifications repo](https://github.com/mongodb/specifications).
A PR will be generated by mongodb-drivers-pr-bot containing any changes picked up by this resync.
The PR description will display the name(s) of the updated specs along
with any errors that occurred.
Spec test changes associated with a behavioral change or bugfix that has yet to be implemented in PyMongo
must be added to a patch file in `/.evergreen/spec-patch`. Each patch
file must be named after the associated PYTHON ticket and contain the
test differences between PyMongo's current tests and the specification.
All changes listed in these patch files will be *undone* by the script and won't
be applied to PyMongo's tests.
When a new test file or folder is added to the spec repo before the associated code changes are implemented, that test's path must be added to `.evergreen/remove-unimplemented-tests.sh` along with a comment indicating the associated PYTHON ticket for those changes.
Any PR that implements a PYTHON ticket documented in a patch file or within `.evergreen/remove-unimplemented-tests.sh` must also remove the associated patch file or entry in `remove-unimplemented-tests.sh`.
#### Adding to a patch file
To add to or create a patch file, run `git diff` to show the desired changes to undo and copy the
results into the patch file.
For example: the imaginary, unimplemented PYTHON-1234 ticket has associated spec test changes. To add those changes to `PYTHON-1234.patch`), do the following:
```bash
git diff HEAD~1 path/to/file >> .evergreen/spec-patch/PYTHON-1234.patch
```
#### Running Locally
Both `resync-all-specs.sh` and `resync-all-specs.py` can be run locally (and won't generate a PR).
```bash
./.evergreen/scripts/resync-all-specs.sh
python3 ./.evergreen/scripts/resync-all-specs.py
```
## Making a Release
Follow the [Python Driver Release Process Wiki](https://wiki.corp.mongodb.com/display/DRIVERS/Python+Driver+Release+Process).
## Project Structure and Asyncio Considerations
This section describes the layout of the `pymongo/` package.
Within `pymongo/`, the code is further divided into the `pymongo/asynchronous` and `pymongo/synchronous` subdirectories.
Files in `pymongo/synchronous` are generated from `pymongo/asynchronous` using the `synchro` pre-commit hook, which uses [unasync](https://github.com/python-trio/unasync/) and some custom transforms.
As a result, **all modifications** within `pymongo` must be made in either the top-level `pymongo` directory when they have to exhibit differing behavior between sync and async contexts or the `pymongo/asynchronous` directory, not `pymongo/synchronous`.
Any changes made directly to files in the `pymongo/synchronous` directory will be overwritten by the `synchro` hook when it is run, which happens automatically on commit.
Some top-level files (e.g. `pymongo/collection.py`) are re-export files for existing import compatibility and should not be modified directly.
The other top-level files (e.g. `pymongo/network_layer.py`, `pymongo/pool_shared.py`) contain either shared code used in both the asynchronous and synchronous APIs, or code that is very different between the two APIs and therefore cannot be generated from the async version using `synchro`.
Run `pre-commit run --all-files synchro` before running tests to generate the latest version of the synchronous code.
To prevent the `synchro` hook from accidentally overwriting code, it first checks to see whether a sync version
of a file is changing and not its async counterpart, and will fail.
In the unlikely scenario that you want to override this behavior, first export `OVERRIDE_SYNCHRO_CHECK=1`.
Sometimes, the `synchro` hook will fail and introduce changes many previously unmodified files. This is due to static
Python errors, such as missing imports, incorrect syntax, or other fatal typos. To resolve these issues,
run `pre-commit run --all-files --hook-stage manual ruff` and fix all reported errors before running the `synchro`
hook again.
## Converting a test to async
The `tools/convert_test_to_async.py` script takes in an existing synchronous test file and outputs a
partially-converted asynchronous version of the same name to the `test/asynchronous` directory.
Use this generated file as a starting point for the completed conversion.
The script is used like so: `python tools/convert_test_to_async.py [test_file.py]`
## CPU profiling
To profile a test script and generate a flame graph, follow these steps:
1. Install `py-spy` if you haven't already:
```bash
pip install py-spy
```
2. Inside your test script, perform any required setup and then loop over the code you want to profile for improved sampling.
3. Run `py-spy record -o <output.svg> -r <sample_rate=100> -- python <path/to/script>` to generate a `.svg` file containing the flame graph.
(Note: on macOS you will need to run this command using `sudo` to allow `py-spy` to attach to the Python process.)
4. If you need to include native code (for example the C extensions), profiling should be done on a Linux system, as macOS and Windows do not support the `--native` option of `py-spy`.
Creating an ubuntu Evergreen spawn host and using `scp` to copy the flamegraph `.svg` file back to your local machine is the best way to do this.
5. You can then view the flamegraph using an SVG viewer like a browser.
## Memory profiling
To test for a memory leak or any memory-related issues, the current best tool is [memray](https://bloomberg.github.io/memray/overview.html).
In order to include code from our C extensions, it must be run in native mode, on Linux.
To do so, either spin up an Ubuntu docker container or an Ubuntu Evergreen spawn host.
From the spawn host or Ubuntu image, do the following:
1. Install `memray` if you haven't already:
```bash
pip install memray
```
2. Inside your test script, perform any required setup and then loop over the code you want to profile for improved sampling.
3. Run memray with the script under test with the `--native` flag, e.g. `python -m memray run --native -o test.bin <path/to/script>`.
4. Generate the flamegraph with `python -m memray flamegraph -o test.html test.bin`.
See the [docs](https://bloomberg.github.io/memray/flamegraph.html) for more options.
5. Then, from the host computer, use either scp or docker cp to copy the flamegraph, e.g. `scp ubuntu@ec2-3-82-52-49.compute-1.amazonaws.com:/home/ubuntu/test.html .`.
6. You can then view the flamegraph html in a browser.
## Dependabot updates
Dependabot will raise PRs at most once per week, grouped by GitHub Actions updates and Python requirement
file updates. We have a pre-commit hook that will update the `uv.lock` file when requirements change.
To update the lock file on a failing PR, you can use a method like `gh pr checkout <pr number>`, then run
`just lint uv-lock` to update the lock file, and then push the changes. If a typing dependency has changed,
also run `just typing` and handle any new findings.

View File

@ -1,56 +0,0 @@
Contributing to PyMongo
=======================
PyMongo has a large `community
<http://api.mongodb.org/python/current/contributors.html>`_ and
contributions are always encouraged. Contributions can be as simple as
minor tweaks to the documentation. Please read these guidelines before
sending a pull request.
Bugfixes and New Features
-------------------------
Before starting to write code, look for existing `tickets
<https://jira.mongodb.org/browse/PYTHON>`_ or `create one
<https://jira.mongodb.org/browse/PYTHON>`_ for your specific
issue or feature request. That way you avoid working on something
that might not be of interest or that has already been addressed.
Supported Interpreters
----------------------
PyMongo supports CPython 2.4 and newer, PyPy, and Jython. Language
features not supported by all interpreters can not be used (e.g.
the `with statement
<http://docs.python.org/reference/compound_stmts.html#the-with-statement>`_
is not supported in Python 2.4). Please also ensure that your code is
properly converted by `2to3 <http://docs.python.org/library/2to3.html>`_ for
Python 3 support.
Style Guide
-----------
PyMongo follows `PEP8 <http://www.python.org/dev/peps/pep-0008/>`_
including 4 space indents and 79 character line limits.
General Guidelines
------------------
- Avoid backward breaking changes if at all possible.
- Write inline documentation for new classes and methods.
- Write tests and make sure they pass (make sure you have a mongod
running on the default port, then execute ``python setup.py test``
from the cmd line to run the test suite).
- Add yourself to doc/contributors.rst :)
Documentation
-------------
To contribute to the `API documentation <http://api.mongodb.org/python/current/>`_
just make your changes to the inline documentation of the appropriate
`source code <https://github.com/mongodb/mongo-python-driver>`_ or `rst file
<https://github.com/mongodb/mongo-python-driver/tree/master/doc>`_ in a
branch and submit a `pull request <https://help.github.com/articles/using-pull-requests>`_.
You might also use the github `Edit <https://github.com/blog/844-forking-with-the-edit-button>`_
button.

View File

@ -199,4 +199,3 @@
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@ -1,10 +0,0 @@
include README.rst
include LICENSE
include ez_setup.py
recursive-include doc *.rst
recursive-include doc *.py
recursive-include tools *.py
include tools/README.rst
recursive-include test *.pem
recursive-include test *.py
recursive-include bson *.h

219
README.md Normal file
View File

@ -0,0 +1,219 @@
# PyMongo
[![PyPI Version](https://img.shields.io/pypi/v/pymongo)](https://pypi.org/project/pymongo)
[![Python Versions](https://img.shields.io/pypi/pyversions/pymongo)](https://pypi.org/project/pymongo)
[![Monthly Downloads](https://static.pepy.tech/badge/pymongo/month)](https://pepy.tech/project/pymongo)
[![API Documentation Status](https://readthedocs.org/projects/pymongo/badge/?version=stable)](http://pymongo.readthedocs.io/en/stable/api?badge=stable)
[![codecov](https://codecov.io/gh/mongodb/mongo-python-driver/graph/badge.svg?branch=master)](https://codecov.io/gh/mongodb/mongo-python-driver)
## About
The PyMongo distribution contains tools for interacting with MongoDB
database from Python. The `bson` package is an implementation of the
[BSON format](http://bsonspec.org) for Python. The `pymongo` package is
a native Python driver for MongoDB, offering both synchronous and asynchronous APIs. The `gridfs` package is a
[gridfs](https://github.com/mongodb/specifications/blob/master/source/gridfs/gridfs-spec.md/)
implementation on top of `pymongo`.
PyMongo supports MongoDB 4.0, 4.2, 4.4, 5.0, 6.0, 7.0, and 8.0. PyMongo follows [semantic versioning](https://semver.org/spec/v2.0.0.html) for its releases.
## Documentation
Documentation is available at
[mongodb.com](https://www.mongodb.com/docs/languages/python/pymongo-driver/current/).
[API documentation](https://pymongo.readthedocs.io/en/stable/api/) and the [full changelog](https://pymongo.readthedocs.io/en/stable/changelog.html) for each release is available at [readthedocs.io](https://pymongo.readthedocs.io/en/stable/index.html).
## Support / Feedback
For issues with, questions about, or feedback for PyMongo, please look
into our [support channels](https://support.mongodb.com/welcome). Please
do not email any of the PyMongo developers directly with issues or
questions - you're more likely to get an answer on
[StackOverflow](https://stackoverflow.com/questions/tagged/mongodb)
(using a "mongodb" tag).
## Bugs / Feature Requests
Think you've found a bug? Want to see a new feature in PyMongo? Please
open a case in our issue management tool, JIRA:
- [Create an account and login](https://jira.mongodb.org).
- Navigate to [the PYTHON
project](https://jira.mongodb.org/browse/PYTHON).
- Click **Create Issue** - Please provide as much information as
possible about the issue type and how to reproduce it.
Bug reports in JIRA for all driver projects (i.e. PYTHON, CSHARP, JAVA)
and the Core Server (i.e. SERVER) project are **public**.
### How To Ask For Help
Please include all of the following information when opening an issue:
- Detailed steps to reproduce the problem, including full traceback,
if possible.
- The exact python version used, with patch level:
```bash
python -c "import sys; print(sys.version)"
```
- The exact version of PyMongo used, with patch level:
```bash
python -c "import pymongo; print(pymongo.version); print(pymongo.has_c())"
```
- The operating system and version (e.g. Windows 7, OSX 10.8, ...)
- Web framework or asynchronous network library used, if any, with
version (e.g. Django 1.7, mod_wsgi 4.3.0, gevent 1.0.1, Tornado
4.0.2, ...)
### Security Vulnerabilities
If you've identified a security vulnerability in a driver or any other
MongoDB project, please report it according to the [instructions
here](https://www.mongodb.com/docs/manual/tutorial/create-a-vulnerability-report/).
## Installation
PyMongo can be installed with [pip](http://pypi.python.org/pypi/pip):
```bash
python -m pip install pymongo
```
You can also download the project source and do:
```bash
pip install .
```
Do **not** install the "bson" package from pypi. PyMongo comes with
its own bson package; running "pip install bson" installs a third-party
package that is incompatible with PyMongo.
## Dependencies
PyMongo supports CPython 3.9+ and PyPy3.9+.
Required dependencies:
Support for `mongodb+srv://` URIs requires [dnspython](https://pypi.python.org/pypi/dnspython)
Optional dependencies:
GSSAPI authentication requires
[pykerberos](https://pypi.python.org/pypi/pykerberos) on Unix or
[WinKerberos](https://pypi.python.org/pypi/winkerberos) on Windows. The
correct dependency can be installed automatically along with PyMongo:
```bash
python -m pip install "pymongo[gssapi]"
```
MONGODB-AWS authentication requires
[pymongo-auth-aws](https://pypi.org/project/pymongo-auth-aws/):
```bash
python -m pip install "pymongo[aws]"
```
OCSP (Online Certificate Status Protocol) requires
[PyOpenSSL](https://pypi.org/project/pyOpenSSL/),
[requests](https://pypi.org/project/requests/),
[service_identity](https://pypi.org/project/service_identity/) and may
require [certifi](https://pypi.python.org/pypi/certifi):
```bash
python -m pip install "pymongo[ocsp]"
```
Wire protocol compression with snappy requires
[python-snappy](https://pypi.org/project/python-snappy):
```bash
python -m pip install "pymongo[snappy]"
```
Wire protocol compression with zstandard requires
[backports.zstd](https://pypi.org/project/backports.zstd)
when used with Python versions before 3.14:
```bash
python -m pip install "pymongo[zstd]"
```
Client-Side Field Level Encryption requires
[pymongocrypt](https://pypi.org/project/pymongocrypt/) and
[pymongo-auth-aws](https://pypi.org/project/pymongo-auth-aws/):
```bash
python -m pip install "pymongo[encryption]"
```
You can install all dependencies automatically with the following
command:
```bash
python -m pip install "pymongo[gssapi,aws,ocsp,snappy,zstd,encryption]"
```
## Examples
Here's a basic example (for more see the *examples* section of the
docs):
```pycon
>>> import pymongo
>>> client = pymongo.MongoClient("localhost", 27017)
>>> db = client.test
>>> db.name
'test'
>>> db.my_collection
Collection(Database(MongoClient('localhost', 27017), 'test'), 'my_collection')
>>> db.my_collection.insert_one({"x": 10}).inserted_id
ObjectId('4aba15ebe23f6b53b0000000')
>>> db.my_collection.insert_one({"x": 8}).inserted_id
ObjectId('4aba160ee23f6b543e000000')
>>> db.my_collection.insert_one({"x": 11}).inserted_id
ObjectId('4aba160ee23f6b543e000002')
>>> db.my_collection.find_one()
{'x': 10, '_id': ObjectId('4aba15ebe23f6b53b0000000')}
>>> for item in db.my_collection.find():
... print(item["x"])
...
10
8
11
>>> db.my_collection.create_index("x")
'x_1'
>>> for item in db.my_collection.find().sort("x", pymongo.ASCENDING):
... print(item["x"])
...
8
10
11
>>> [item["x"] for item in db.my_collection.find().limit(2).skip(1)]
[8, 11]
```
## Learning Resources
- MongoDB Learn - [Python
courses](https://learn.mongodb.com/catalog?labels=%5B%22Language%22%5D&values=%5B%22Python%22%5D).
- [Python Articles on Developer
Center](https://www.mongodb.com/developer/languages/python/).
## Testing
The easiest way to run the tests is to run the following from the repository root.
```bash
pip install -e ".[test]"
pytest
```
For more advanced testing scenarios, see the [contributing guide](https://github.com/mongodb/mongo-python-driver/blob/master/CONTRIBUTING.md#running-tests-locally).

View File

@ -1,123 +0,0 @@
=======
PyMongo
=======
:Info: See `the mongo site <http://www.mongodb.org>`_ for more information. See `github <http://github.com/mongodb/mongo-python-driver/tree>`_ for the latest source.
:Author: Mike Dirolf
:Maintainer: Bernie Hackett <bernie@mongodb.com>
About
=====
The PyMongo distribution contains tools for interacting with MongoDB
database from Python. The ``bson`` package is an implementation of
the `BSON format <http://bsonspec.org>`_ for Python. The ``pymongo``
package is a native Python driver for MongoDB. The ``gridfs`` package
is a `gridfs
<http://www.mongodb.org/display/DOCS/GridFS+Specification>`_
implementation on top of ``pymongo``.
Support / Feedback
==================
For issues with, questions about, or feedback for PyMongo, please look into
our `support channels <http://www.mongodb.org/about/support>`_. Please
do not email any of the PyMongo developers directly with issues or
questions - you're more likely to get an answer on the `mongodb-user
<http://groups.google.com/group/mongodb-user>`_ list on Google Groups.
Bugs / Feature Requests
=======================
Think youve found a bug? Want to see a new feature in PyMongo? Please open a
case in our issue management tool, JIRA:
- `Create an account and login <https://jira.mongodb.org>`_.
- Navigate to `the PYTHON project <https://jira.mongodb.org/browse/PYTHON>`_.
- Click **Create Issue** - Please provide as much information as possible about the issue type and how to reproduce it.
Bug reports in JIRA for all driver projects (i.e. PYTHON, CSHARP, JAVA) and the
Core Server (i.e. SERVER) project are **public**.
Security Vulnerabilities
------------------------
If youve identified a security vulnerability in a driver or any other
MongoDB project, please report it according to the `instructions here
<http://docs.mongodb.org/manual/tutorial/create-a-vulnerability-report>`_.
Installation
============
If you have `setuptools
<http://pythonhosted.org/setuptools/>`_ installed you
should be able to do **easy_install pymongo** to install
PyMongo. Otherwise you can download the project source and do **python
setup.py install** to install.
Dependencies
============
The PyMongo distribution is supported and tested on Python 2.x (where
x >= 4) and Python 3.x (where x >= 1). PyMongo versions <= 1.3 also
supported Python 2.3, but that is no longer supported.
Additional dependencies are:
- (to generate documentation) sphinx_
- (to auto-discover tests) `nose <http://somethingaboutorange.com/mrl/projects/nose/>`_
Examples
========
Here's a basic example (for more see the *examples* section of the docs):
.. code-block:: pycon
>>> import pymongo
>>> client = pymongo.MongoClient("localhost", 27017)
>>> db = client.test
>>> db.name
u'test'
>>> db.my_collection
Collection(Database(MongoClient('localhost', 27017), u'test'), u'my_collection')
>>> db.my_collection.save({"x": 10})
ObjectId('4aba15ebe23f6b53b0000000')
>>> db.my_collection.save({"x": 8})
ObjectId('4aba160ee23f6b543e000000')
>>> db.my_collection.save({"x": 11})
ObjectId('4aba160ee23f6b543e000002')
>>> db.my_collection.find_one()
{u'x': 10, u'_id': ObjectId('4aba15ebe23f6b53b0000000')}
>>> for item in db.my_collection.find():
... print item["x"]
...
10
8
11
>>> db.my_collection.create_index("x")
u'x_1'
>>> for item in db.my_collection.find().sort("x", pymongo.ASCENDING):
... print item["x"]
...
8
10
11
>>> [item["x"] for item in db.my_collection.find().limit(2).skip(1)]
[8, 11]
Documentation
=============
You will need sphinx_ installed to generate the
documentation. Documentation can be generated by running **python
setup.py doc**. Generated documentation can be found in the
*doc/build/html/* directory.
Testing
=======
The easiest way to run the tests is to install `nose
<http://somethingaboutorange.com/mrl/projects/nose/>`_ (**easy_install
nose**) and run **nosetests** or **python setup.py test** in the root
of the distribution. Tests are located in the *test/* directory.
.. _sphinx: http://sphinx.pocoo.org/

View File

@ -1,70 +0,0 @@
Some notes on PyMongo releases
==============================
Versioning
----------
We shoot for a release every few months - that will generally just
increment the middle version number (e.g. 2.1.1 -> 2.2).
Minor releases are reserved for bug fixes (in general no new features
or deprecations) - they only happen in cases where there is a critical
bug in a recently released version, or when a release has no new
features or API changes.
In between releases we use a "+" version number to denote the version
under development. So if we just released 2.1, then the current dev
version would be 2.1+. When we make the next release (2.1.1 or 2.2) we
replace all instances of 2.1+ in the docs with the new version number.
Deprecation
-----------
Changes should be backwards compatible unless absolutely necessary. When making
API changes the approach is generally to add a deprecation warning but keeping
the existing API functional. Eventually (after at least ~4 releases) we can
remove the old API.
Doing a Release
---------------
1. Test release on Python 2.4-2.7 and 3.1-3.3 on Windows, Linux and OSX,
with and without the C extension. Generally enough to just run the tests on
2.4, 2.7 and 3.3 with and without the extension on a single platform,
and then just test any version on the other platforms as a sanity check.
`python setup.py test` will build the extension and test.
`python tools/clean.py` will remove the extension, and then `nosetests` will
run the tests without it. Run the replica set and mongos high-availability
tests with `PYTHONPATH=. python test/high_availability/test_ha.py` and the slow
tests with `nosetests -d test/slow`. Can also run the doctests: `python
setup.py doc -t`. For building extensions on Windows check section below.
2. Add release notes to doc/changelog.rst. Generally just summarize/clarify
the git log, but might add some more long form notes for big changes.
3. Search and replace the "+" version number w/ the new version number (see
note above).
4. Make sure version number is updated in setup.py and pymongo/__init__.py
5. Commit with a BUMP version_number message.
6. Tag w/ version_number
7. Push commit / tag.
8. Push source to PyPI: `python setup.py sdist upload`
9. Push binaries to PyPI; for each version of python and platform do:`python
setup.py bdist_egg upload`. Probably best to do `python setup.py bdist_egg`
first, to make sure the egg builds properly. Notably on the Windows machine,
for Python 2.4 and 2.5, you will have to run `python setup.py build -c mingw32
bdist_egg upload` or the C extension build will fail with an error about Visual
Studio 2003. On Windows we also push a binary installer. The setup.py target
for that is `bdist_wininst`.
10. Make sure the docs have properly updated (driver buildbot does this).
11. Add a "+" to the version number in setup.py/__init__.py, commit, push.
12. Announce!

98
THIRD-PARTY-NOTICES Normal file
View File

@ -0,0 +1,98 @@
PyMongo uses third-party libraries or other resources that may
be distributed under licenses different than the PyMongo software.
In the event that we accidentally failed to list a required notice,
please bring it to our attention through any of the ways detailed here:
https://jira.mongodb.org/projects/PYTHON
The attached notices are provided for information only.
For any licenses that require disclosure of source, sources are available at
https://github.com/mongodb/mongo-python-driver.
1) License Notice for time64.c
------------------------------
Copyright (c) 2007-2010 Michael G Schwern
This software originally derived from Paul Sheer's pivotal_gmtime_r.c.
The MIT License:
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
2) License Notice for _asyncio_lock.py
-----------------------------------------
1. This LICENSE AGREEMENT is between the Python Software Foundation
("PSF"), and the Individual or Organization ("Licensee") accessing and
otherwise using this software ("Python") in source or binary form and
its associated documentation.
2. Subject to the terms and conditions of this License Agreement, PSF hereby
grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce,
analyze, test, perform and/or display publicly, prepare derivative works,
distribute, and otherwise use Python alone or in any derivative version,
provided, however, that PSF's License Agreement and PSF's notice of copyright,
i.e., "Copyright (c) 2001-2024 Python Software Foundation; All Rights Reserved"
are retained in Python alone or in any derivative version prepared by Licensee.
3. In the event Licensee prepares a derivative work that is based on
or incorporates Python or any part thereof, and wants to make
the derivative work available to others as provided herein, then
Licensee hereby agrees to include in any such work a brief summary of
the changes made to Python.
4. PSF is making Python available to Licensee on an "AS IS"
basis. PSF MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND
DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS
FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON WILL NOT
INFRINGE ANY THIRD PARTY RIGHTS.
5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON
FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS
A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON,
OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
6. This License Agreement will automatically terminate upon a material
breach of its terms and conditions.
7. Nothing in this License Agreement shall be deemed to create any
relationship of agency, partnership, or joint venture between PSF and
Licensee. This License Agreement does not grant permission to use PSF
trademarks or trade name in a trademark sense to endorse or promote
products or services of Licensee, or any third party.
8. By copying, installing or otherwise using Python, Licensee
agrees to be bound by the terms and conditions of this License
Agreement.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.

152
_setup.py Normal file
View File

@ -0,0 +1,152 @@
from __future__ import annotations
import os
import sys
import warnings
# Hack to silence atexit traceback in some Python versions
try:
import multiprocessing # noqa: F401
except ImportError:
pass
from setuptools import setup
from setuptools.command.build_ext import build_ext
from setuptools.extension import Extension
class custom_build_ext(build_ext):
"""Allow C extension building to fail.
The C extension speeds up BSON encoding, but is not essential.
"""
warning_message = """
********************************************************************
WARNING: %s could not
be compiled. No C extensions are essential for PyMongo to run,
although they do result in significant speed improvements.
%s
Please see the installation docs for solutions to build issues:
https://pymongo.readthedocs.io/en/stable/installation.html
Here are some hints for popular operating systems:
If you are seeing this message on Linux you probably need to
install GCC and/or the Python development package for your
version of Python.
Debian and Ubuntu users should issue the following command:
$ sudo apt-get install build-essential python-dev
Users of Red Hat based distributions (RHEL, CentOS, Amazon Linux,
Oracle Linux, Fedora, etc.) should issue the following command:
$ sudo yum install gcc python-devel
If you are seeing this message on Microsoft Windows please install
PyMongo using pip. Modern versions of pip will install PyMongo
from binary wheels available on pypi. If you must install from
source read the documentation here:
https://pymongo.readthedocs.io/en/stable/installation.html#installing-from-source-on-windows
If you are seeing this message on macOS / OSX please install PyMongo
using pip. Modern versions of pip will install PyMongo from binary
wheels available on pypi. If wheels are not available for your version
of macOS / OSX, or you must install from source read the documentation
here:
https://pymongo.readthedocs.io/en/stable/installation.html#osx
********************************************************************
"""
def run(self):
try:
build_ext.run(self)
except Exception:
if os.environ.get("PYMONGO_C_EXT_MUST_BUILD"):
raise
e = sys.exc_info()[1]
sys.stdout.write("%s\n" % str(e))
warnings.warn(
self.warning_message
% (
"Extension modules",
"There was an issue with your platform configuration - see above.",
),
stacklevel=2,
)
def build_extension(self, ext):
# "ProgramFiles(x86)" is not a valid environment variable in Cygwin but is needed for
# the MSVCCompiler in distutils.
if os.name == "nt":
if "ProgramFiles" in os.environ and "ProgramFiles(x86)" not in os.environ:
os.environ["ProgramFiles(x86)"] = os.environ["ProgramFiles"] + " (x86)"
name = ext.name
try:
build_ext.build_extension(self, ext)
except Exception:
if os.environ.get("PYMONGO_C_EXT_MUST_BUILD"):
raise
e = sys.exc_info()[1]
sys.stdout.write("%s\n" % str(e))
warnings.warn(
self.warning_message
% (
"The %s extension module" % (name,), # noqa: UP031
"The output above this warning shows how the compilation failed.",
),
stacklevel=2,
)
ext_modules = [
Extension(
"bson._cbson",
include_dirs=["bson"],
sources=["bson/_cbsonmodule.c", "bson/time64.c", "bson/buffer.c"],
),
Extension(
"pymongo._cmessage",
include_dirs=["bson"],
sources=[
"pymongo/_cmessagemodule.c",
"bson/_cbsonmodule.c",
"bson/time64.c",
"bson/buffer.c",
],
),
]
if "--no_ext" in sys.argv or os.environ.get("NO_EXT"):
try:
sys.argv.remove("--no_ext")
except ValueError:
pass
ext_modules = []
elif (
sys.platform.startswith("java")
or sys.platform == "cli"
or sys.implementation.name in ("pypy", "graalpy")
):
sys.stdout.write(
"""
*****************************************************\n
The optional C extensions are currently not supported\n
by this python implementation.\n
*****************************************************\n
"""
)
ext_modules = []
setup(
cmdclass={"build_ext": custom_build_ext},
ext_modules=ext_modules,
packages=["bson", "pymongo", "gridfs"],
) # type:ignore

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
/*
* Copyright 2009-2014 MongoDB, Inc.
* Copyright 2009-present MongoDB, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -14,44 +14,67 @@
* limitations under the License.
*/
#include "bson-endian.h"
#ifndef _CBSONMODULE_H
#define _CBSONMODULE_H
/* Py_ssize_t was new in python 2.5. See conversion
* guidlines in http://www.python.org/dev/peps/pep-0353
* */
#if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN)
typedef int Py_ssize_t;
#define PY_SSIZE_T_MAX INT_MAX
#define PY_SSIZE_T_MIN INT_MIN
#endif
#if defined(WIN32) || defined(_MSC_VER)
/*
* This macro is basically an implementation of asprintf for win32
* We print to the provided buffer to get the string value as an int.
* USE LL2STR. This is kept only to test LL2STR.
*/
#if defined(_MSC_VER) && (_MSC_VER >= 1400)
#define INT2STRING(buffer, i) \
_snprintf_s((buffer), \
_scprintf("%d", (i)) + 1, \
_scprintf("%d", (i)) + 1, \
"%d", \
_scprintf("%lld", (i)) + 1, \
_scprintf("%lld", (i)) + 1, \
"%lld", \
(i))
#define STRCAT(dest, n, src) strcat_s((dest), (n), (src))
#else
#define INT2STRING(buffer, i) \
_snprintf((buffer), \
_scprintf("%d", (i)) + 1, \
"%d", \
_scprintf("%lld", (i)) + 1, \
"%lld", \
(i))
#define STRCAT(dest, n, src) strcat((dest), (src))
#endif
#else
#define INT2STRING(buffer, i) snprintf((buffer), sizeof((buffer)), "%d", (i))
#define INT2STRING(buffer, i) snprintf((buffer), sizeof((buffer)), "%lld", (i))
#define STRCAT(dest, n, src) strcat((dest), (src))
#endif
/* Just enough space in char array to hold LLONG_MIN and null terminator */
#define BUF_SIZE 21
/* Converts integer to its string representation in decimal notation. */
extern int cbson_long_long_to_str(long long int num, char* str, size_t size);
#define LL2STR(buffer, i) cbson_long_long_to_str((i), (buffer), sizeof(buffer))
typedef struct type_registry_t {
PyObject* encoder_map;
PyObject* decoder_map;
PyObject* fallback_encoder;
PyObject* registry_obj;
unsigned char is_encoder_empty;
unsigned char is_decoder_empty;
unsigned char has_fallback_encoder;
} type_registry_t;
typedef struct codec_options_t {
PyObject* document_class;
unsigned char tz_aware;
unsigned char uuid_rep;
char* unicode_decode_error_handler;
PyObject* tzinfo;
type_registry_t type_registry;
unsigned char datetime_conversion;
PyObject* options_obj;
unsigned char is_raw_bson;
unsigned char is_dict_class;
} codec_options_t;
/* C API functions */
#define _cbson_buffer_write_bytes_INDEX 0
#define _cbson_buffer_write_bytes_RETURN int
@ -59,18 +82,46 @@ typedef int Py_ssize_t;
#define _cbson_write_dict_INDEX 1
#define _cbson_write_dict_RETURN int
#define _cbson_write_dict_PROTO (PyObject* self, buffer_t buffer, PyObject* dict, unsigned char check_keys, unsigned char uuid_subtype, unsigned char top_level)
#define _cbson_write_dict_PROTO (PyObject* self, buffer_t buffer, PyObject* dict, unsigned char check_keys, const codec_options_t* options, unsigned char top_level)
#define _cbson_write_pair_INDEX 2
#define _cbson_write_pair_RETURN int
#define _cbson_write_pair_PROTO (PyObject* self, buffer_t buffer, const char* name, int name_length, PyObject* value, unsigned char check_keys, unsigned char uuid_subtype, unsigned char allow_id)
#define _cbson_write_pair_PROTO (PyObject* self, buffer_t buffer, const char* name, int name_length, PyObject* value, unsigned char check_keys, const codec_options_t* options, unsigned char allow_id)
#define _cbson_decode_and_write_pair_INDEX 3
#define _cbson_decode_and_write_pair_RETURN int
#define _cbson_decode_and_write_pair_PROTO (PyObject* self, buffer_t buffer, PyObject* key, PyObject* value, unsigned char check_keys, unsigned char uuid_subtype, unsigned char top_level)
#define _cbson_decode_and_write_pair_PROTO (PyObject* self, buffer_t buffer, PyObject* key, PyObject* value, unsigned char check_keys, const codec_options_t* options, unsigned char top_level)
#define _cbson_convert_codec_options_INDEX 4
#define _cbson_convert_codec_options_RETURN int
#define _cbson_convert_codec_options_PROTO (PyObject* self, PyObject* options_obj, codec_options_t* options)
#define _cbson_destroy_codec_options_INDEX 5
#define _cbson_destroy_codec_options_RETURN void
#define _cbson_destroy_codec_options_PROTO (codec_options_t* options)
#define _cbson_buffer_write_double_INDEX 6
#define _cbson_buffer_write_double_RETURN int
#define _cbson_buffer_write_double_PROTO (buffer_t buffer, double data)
#define _cbson_buffer_write_int32_INDEX 7
#define _cbson_buffer_write_int32_RETURN int
#define _cbson_buffer_write_int32_PROTO (buffer_t buffer, int32_t data)
#define _cbson_buffer_write_int64_INDEX 8
#define _cbson_buffer_write_int64_RETURN int
#define _cbson_buffer_write_int64_PROTO (buffer_t buffer, int64_t data)
#define _cbson_buffer_write_int32_at_position_INDEX 9
#define _cbson_buffer_write_int32_at_position_RETURN void
#define _cbson_buffer_write_int32_at_position_PROTO (buffer_t buffer, int position, int32_t data)
#define _cbson_downcast_and_check_INDEX 10
#define _cbson_downcast_and_check_RETURN int
#define _cbson_downcast_and_check_PROTO (Py_ssize_t size, uint8_t extra)
/* Total number of C API pointers */
#define _cbson_API_POINTER_COUNT 4
#define _cbson_API_POINTER_COUNT 11
#ifdef _CBSON_MODULE
/* This section is used when compiling _cbsonmodule */
@ -83,6 +134,20 @@ static _cbson_write_pair_RETURN write_pair _cbson_write_pair_PROTO;
static _cbson_decode_and_write_pair_RETURN decode_and_write_pair _cbson_decode_and_write_pair_PROTO;
static _cbson_convert_codec_options_RETURN convert_codec_options _cbson_convert_codec_options_PROTO;
static _cbson_destroy_codec_options_RETURN destroy_codec_options _cbson_destroy_codec_options_PROTO;
static _cbson_buffer_write_double_RETURN buffer_write_double _cbson_buffer_write_double_PROTO;
static _cbson_buffer_write_int32_RETURN buffer_write_int32 _cbson_buffer_write_int32_PROTO;
static _cbson_buffer_write_int64_RETURN buffer_write_int64 _cbson_buffer_write_int64_PROTO;
static _cbson_buffer_write_int32_at_position_RETURN buffer_write_int32_at_position _cbson_buffer_write_int32_at_position_PROTO;
static _cbson_downcast_and_check_RETURN _downcast_and_check _cbson_downcast_and_check_PROTO;
#else
/* This section is used in modules that use _cbsonmodule's API */
@ -96,6 +161,20 @@ static void **_cbson_API;
#define decode_and_write_pair (*(_cbson_decode_and_write_pair_RETURN (*)_cbson_decode_and_write_pair_PROTO) _cbson_API[_cbson_decode_and_write_pair_INDEX])
#define convert_codec_options (*(_cbson_convert_codec_options_RETURN (*)_cbson_convert_codec_options_PROTO) _cbson_API[_cbson_convert_codec_options_INDEX])
#define destroy_codec_options (*(_cbson_destroy_codec_options_RETURN (*)_cbson_destroy_codec_options_PROTO) _cbson_API[_cbson_destroy_codec_options_INDEX])
#define buffer_write_double (*(_cbson_buffer_write_double_RETURN (*)_cbson_buffer_write_double_PROTO) _cbson_API[_cbson_buffer_write_double_INDEX])
#define buffer_write_int32 (*(_cbson_buffer_write_int32_RETURN (*)_cbson_buffer_write_int32_PROTO) _cbson_API[_cbson_buffer_write_int32_INDEX])
#define buffer_write_int64 (*(_cbson_buffer_write_int64_RETURN (*)_cbson_buffer_write_int64_PROTO) _cbson_API[_cbson_buffer_write_int64_INDEX])
#define buffer_write_int32_at_position (*(_cbson_buffer_write_int32_at_position_RETURN (*)_cbson_buffer_write_int32_at_position_PROTO) _cbson_API[_cbson_buffer_write_int32_at_position_INDEX])
#define _downcast_and_check (*(_cbson_downcast_and_check_RETURN (*)_cbson_downcast_and_check_PROTO) _cbson_API[_cbson_downcast_and_check_INDEX])
#define _cbson_IMPORT _cbson_API = (void **)PyCapsule_Import("_cbson._C_API", 0)
#endif

43
bson/_helpers.py Normal file
View File

@ -0,0 +1,43 @@
# Copyright 2021-present MongoDB, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Setstate and getstate functions for objects with __slots__, allowing
compatibility with default pickling protocol
"""
from __future__ import annotations
from typing import Any, Mapping
def _setstate_slots(self: Any, state: Any) -> None:
for slot, value in state.items():
setattr(self, slot, value)
def _mangle_name(name: str, prefix: str) -> str:
if name.startswith("__"):
prefix = "_" + prefix
else:
prefix = ""
return prefix + name
def _getstate_slots(self: Any) -> Mapping[Any, Any]:
prefix = self.__class__.__name__
ret = {}
for name in self.__slots__:
mangled_name = _mangle_name(name, prefix)
if hasattr(self, mangled_name):
ret[mangled_name] = getattr(self, mangled_name)
return ret

View File

@ -1,4 +1,4 @@
# Copyright 2009-2014 MongoDB, Inc.
# Copyright 2009-present MongoDB, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -11,14 +11,13 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from __future__ import annotations
try:
from uuid import UUID
except ImportError:
# Python2.4 doesn't have a uuid module.
pass
from bson.py3compat import PY3, binary_type
import struct
import warnings
from enum import Enum
from typing import TYPE_CHECKING, Any, Optional, Sequence, Tuple, Type, Union, overload
from uuid import UUID
"""Tools for representing BSON binary data.
"""
@ -27,14 +26,10 @@ BINARY_SUBTYPE = 0
"""BSON binary subtype for binary data.
This is the default subtype for binary data.
.. versionadded:: 1.5
"""
FUNCTION_SUBTYPE = 1
"""BSON binary subtype for functions.
.. versionadded:: 1.5
"""
OLD_BINARY_SUBTYPE = 2
@ -42,15 +37,16 @@ OLD_BINARY_SUBTYPE = 2
This is the old default subtype, the current
default is :data:`BINARY_SUBTYPE`.
.. versionadded:: 1.7
"""
OLD_UUID_SUBTYPE = 3
"""Old BSON binary subtype for a UUID.
:class:`uuid.UUID` instances will automatically be encoded
by :mod:`bson` using this subtype.
by :mod:`bson` using this subtype when using
:data:`UuidRepresentation.PYTHON_LEGACY`,
:data:`UuidRepresentation.JAVA_LEGACY`, or
:data:`UuidRepresentation.CSHARP_LEGACY`.
.. versionadded:: 2.1
"""
@ -58,174 +54,612 @@ by :mod:`bson` using this subtype.
UUID_SUBTYPE = 4
"""BSON binary subtype for a UUID.
This is the new BSON binary subtype for UUIDs. The
current default is :data:`OLD_UUID_SUBTYPE` but will
change to this in a future release.
.. versionchanged:: 2.1
Changed to subtype 4.
.. versionadded:: 1.5
This is the standard BSON binary subtype for UUIDs.
:class:`uuid.UUID` instances will automatically be encoded
by :mod:`bson` using this subtype when using
:data:`UuidRepresentation.STANDARD`.
"""
JAVA_LEGACY = 5
"""Used with :attr:`pymongo.collection.Collection.uuid_subtype`
to specify that UUIDs should be stored in the legacy byte order
used by the Java driver.
:class:`uuid.UUID` instances will automatically be encoded
by :mod:`bson` using :data:`OLD_UUID_SUBTYPE`.
if TYPE_CHECKING:
from array import array as _array
from mmap import mmap as _mmap
import numpy as np
import numpy.typing as npt
class UuidRepresentation:
UNSPECIFIED = 0
"""An unspecified UUID representation.
When configured, :class:`uuid.UUID` instances will **not** be
automatically encoded to or decoded from :class:`~bson.binary.Binary`.
When encoding a :class:`uuid.UUID` instance, an error will be raised.
To encode a :class:`uuid.UUID` instance with this configuration, it must
be wrapped in the :class:`~bson.binary.Binary` class by the application
code. When decoding a BSON binary field with a UUID subtype, a
:class:`~bson.binary.Binary` instance will be returned instead of a
:class:`uuid.UUID` instance.
See `unspecified representation details <https://www.mongodb.com/docs/languages/python/pymongo-driver/current/data-formats/uuid/#unspecified>`_ for details.
.. versionadded:: 3.11
"""
STANDARD = UUID_SUBTYPE
"""The standard UUID representation.
:class:`uuid.UUID` instances will automatically be encoded to
and decoded from BSON binary, using RFC-4122 byte order with
binary subtype :data:`UUID_SUBTYPE`.
See `standard representation details <https://www.mongodb.com/docs/languages/python/pymongo-driver/current/data-formats/uuid/#standard>`_ for details.
.. versionadded:: 3.11
"""
PYTHON_LEGACY = OLD_UUID_SUBTYPE
"""The Python legacy UUID representation.
:class:`uuid.UUID` instances will automatically be encoded to
and decoded from BSON binary, using RFC-4122 byte order with
binary subtype :data:`OLD_UUID_SUBTYPE`.
See `python legacy representation details <https://www.mongodb.com/docs/languages/python/pymongo-driver/current/data-formats/uuid/#python_legacy>`_ for details.
.. versionadded:: 3.11
"""
JAVA_LEGACY = 5
"""The Java legacy UUID representation.
:class:`uuid.UUID` instances will automatically be encoded to
and decoded from BSON binary subtype :data:`OLD_UUID_SUBTYPE`,
using the Java driver's legacy byte order.
See `Java Legacy UUID <https://www.mongodb.com/docs/languages/python/pymongo-driver/current/data-formats/uuid/#java_legacy>`_ for details.
.. versionadded:: 3.11
"""
CSHARP_LEGACY = 6
"""The C#/.net legacy UUID representation.
:class:`uuid.UUID` instances will automatically be encoded to
and decoded from BSON binary subtype :data:`OLD_UUID_SUBTYPE`,
using the C# driver's legacy byte order.
See `C# Legacy UUID <https://www.mongodb.com/docs/languages/python/pymongo-driver/current/data-formats/uuid/#csharp_legacy>`_ for details.
.. versionadded:: 3.11
"""
STANDARD = UuidRepresentation.STANDARD
"""An alias for :data:`UuidRepresentation.STANDARD`.
.. versionadded:: 3.0
"""
PYTHON_LEGACY = UuidRepresentation.PYTHON_LEGACY
"""An alias for :data:`UuidRepresentation.PYTHON_LEGACY`.
.. versionadded:: 3.0
"""
JAVA_LEGACY = UuidRepresentation.JAVA_LEGACY
"""An alias for :data:`UuidRepresentation.JAVA_LEGACY`.
.. versionchanged:: 3.6
BSON binary subtype 4 is decoded using RFC-4122 byte order.
.. versionadded:: 2.3
"""
CSHARP_LEGACY = 6
"""Used with :attr:`pymongo.collection.Collection.uuid_subtype`
to specify that UUIDs should be stored in the legacy byte order
used by the C# driver.
:class:`uuid.UUID` instances will automatically be encoded
by :mod:`bson` using :data:`OLD_UUID_SUBTYPE`.
CSHARP_LEGACY = UuidRepresentation.CSHARP_LEGACY
"""An alias for :data:`UuidRepresentation.CSHARP_LEGACY`.
.. versionchanged:: 3.6
BSON binary subtype 4 is decoded using RFC-4122 byte order.
.. versionadded:: 2.3
"""
ALL_UUID_SUBTYPES = (OLD_UUID_SUBTYPE, UUID_SUBTYPE, JAVA_LEGACY, CSHARP_LEGACY)
ALL_UUID_SUBTYPES = (OLD_UUID_SUBTYPE, UUID_SUBTYPE)
ALL_UUID_REPRESENTATIONS = (
UuidRepresentation.UNSPECIFIED,
UuidRepresentation.STANDARD,
UuidRepresentation.PYTHON_LEGACY,
UuidRepresentation.JAVA_LEGACY,
UuidRepresentation.CSHARP_LEGACY,
)
UUID_REPRESENTATION_NAMES = {
UuidRepresentation.UNSPECIFIED: "UuidRepresentation.UNSPECIFIED",
UuidRepresentation.STANDARD: "UuidRepresentation.STANDARD",
UuidRepresentation.PYTHON_LEGACY: "UuidRepresentation.PYTHON_LEGACY",
UuidRepresentation.JAVA_LEGACY: "UuidRepresentation.JAVA_LEGACY",
UuidRepresentation.CSHARP_LEGACY: "UuidRepresentation.CSHARP_LEGACY",
}
MD5_SUBTYPE = 5
"""BSON binary subtype for an MD5 hash.
.. versionadded:: 1.5
"""
COLUMN_SUBTYPE = 7
"""BSON binary subtype for columns.
.. versionadded:: 4.0
"""
SENSITIVE_SUBTYPE = 8
"""BSON binary subtype for sensitive data.
.. versionadded:: 4.5
"""
VECTOR_SUBTYPE = 9
"""BSON binary subtype for densely packed vector data.
.. versionadded:: 4.10
"""
USER_DEFINED_SUBTYPE = 128
"""BSON binary subtype for any user defined structure.
.. versionadded:: 1.5
"""
class Binary(binary_type):
class BinaryVectorDtype(Enum):
"""Datatypes of vector subtype.
:param FLOAT32: (0x27) Pack list of :class:`float` as float32
:param INT8: (0x03) Pack list of :class:`int` in [-128, 127] as signed int8
:param PACKED_BIT: (0x10) Pack list of :class:`int` in [0, 255] as unsigned uint8
The `PACKED_BIT` value represents a special case where vector values themselves
can only be of two values (0 or 1) but these are packed together into groups of 8,
a byte. In Python, these are displayed as ints in range [0, 255]
Each value is of type bytes with a length of one.
.. versionadded:: 4.10
"""
INT8 = b"\x03"
FLOAT32 = b"\x27"
PACKED_BIT = b"\x10"
class BinaryVector:
"""Vector of numbers along with metadata for binary interoperability.
.. versionadded:: 4.10
"""
__slots__ = ("data", "dtype", "padding")
def __init__(
self,
data: Union[Sequence[float | int], npt.NDArray[np.number]],
dtype: BinaryVectorDtype,
padding: int = 0,
):
"""
:param data: Sequence of numbers representing the mathematical vector.
:param dtype: The data type stored in binary
:param padding: The number of bits in the final byte that are to be ignored
when a vector element's size is less than a byte
and the length of the vector is not a multiple of 8.
(Padding is equivalent to a negative value of `count` in
`numpy.unpackbits <https://numpy.org/doc/stable/reference/generated/numpy.unpackbits.html>`_)
"""
self.data = data
self.dtype = dtype
self.padding = padding
def __repr__(self) -> str:
return f"BinaryVector(dtype={self.dtype}, padding={self.padding}, data={self.data})"
def __eq__(self, other: Any) -> bool:
if not isinstance(other, BinaryVector):
return False
return (
self.dtype == other.dtype and self.padding == other.padding and self.data == other.data
)
def __len__(self) -> int:
return len(self.data)
class Binary(bytes):
"""Representation of BSON binary data.
This is necessary because we want to represent Python strings as
the BSON string type. We need to wrap binary data so we can tell
We want to represent Python strings as the BSON string type.
We need to wrap binary data so that we can tell
the difference between what should be considered binary data and
what should be considered a string when we encode to BSON.
Raises TypeError if `data` is not an instance of :class:`str`
(:class:`bytes` in python 3) or `subtype` is not an instance of
:class:`int`. Raises ValueError if `subtype` is not in [0, 256).
Subtype 9 provides a space-efficient representation of 1-dimensional vector data.
Its data is prepended with two bytes of metadata.
The first (dtype) describes its data type, such as float32 or int8.
The second (padding) prescribes the number of bits to ignore in the final byte.
This is relevant when the element size of the dtype is not a multiple of 8.
Raises TypeError if `subtype` is not an instance of :class:`int`.
Raises ValueError if `subtype` is not in [0, 256).
.. note::
In python 3 instances of Binary with subtype 0 will be decoded
directly to :class:`bytes`.
Instances of Binary with subtype 0 will be decoded directly to :class:`bytes`.
:Parameters:
- `data`: the binary data to represent
- `subtype` (optional): the `binary subtype
<http://bsonspec.org/#/specification>`_
:param data: the binary data to represent. Can be any bytes-like type
that implements the buffer protocol.
:param subtype: the `binary subtype
<https://bsonspec.org/spec.html>`_
to use
.. versionchanged:: 3.9
Support any bytes-like type that implements the buffer protocol.
.. versionchanged:: 4.10
Addition of vector subtype.
"""
_type_marker = 5
__subtype: int
def __new__(cls, data, subtype=BINARY_SUBTYPE):
if not isinstance(data, binary_type):
raise TypeError("data must be an "
"instance of %s" % (binary_type.__name__,))
def __new__(
cls: Type[Binary],
data: Union[memoryview, bytes, bytearray, _mmap, _array[Any]],
subtype: int = BINARY_SUBTYPE,
) -> Binary:
if not isinstance(subtype, int):
raise TypeError("subtype must be an instance of int")
raise TypeError(f"subtype must be an instance of int, not {type(subtype)}")
if subtype >= 256 or subtype < 0:
raise ValueError("subtype must be contained in [0, 256)")
self = binary_type.__new__(cls, data)
# Support any type that implements the buffer protocol.
self = bytes.__new__(cls, memoryview(data).tobytes())
self.__subtype = subtype
return self
@property
def subtype(self):
"""Subtype of this binary data.
@classmethod
def from_uuid(
cls: Type[Binary], uuid: UUID, uuid_representation: int = UuidRepresentation.STANDARD
) -> Binary:
"""Create a BSON Binary object from a Python UUID.
Creates a :class:`~bson.binary.Binary` object from a
:class:`uuid.UUID` instance. Assumes that the native
:class:`uuid.UUID` instance uses the byte-order implied by the
provided ``uuid_representation``.
Raises :exc:`TypeError` if `uuid` is not an instance of
:class:`~uuid.UUID`.
:param uuid: A :class:`uuid.UUID` instance.
:param uuid_representation: A member of
:class:`~bson.binary.UuidRepresentation`. Default:
:const:`~bson.binary.UuidRepresentation.STANDARD`.
See `UUID representations <https://www.mongodb.com/docs/languages/python/pymongo-driver/current/data-formats/uuid/#universally-unique-ids--uuids->`_ for details.
.. versionadded:: 3.11
"""
if not isinstance(uuid, UUID):
raise TypeError(f"uuid must be an instance of uuid.UUID, not {type(uuid)}")
if uuid_representation not in ALL_UUID_REPRESENTATIONS:
raise ValueError(
"uuid_representation must be a value from bson.binary.UuidRepresentation"
)
if uuid_representation == UuidRepresentation.UNSPECIFIED:
raise ValueError(
"cannot encode native uuid.UUID with "
"UuidRepresentation.UNSPECIFIED. UUIDs can be manually "
"converted to bson.Binary instances using "
"bson.Binary.from_uuid() or a different UuidRepresentation "
"can be configured. See the documentation for "
"UuidRepresentation for more information."
)
subtype = OLD_UUID_SUBTYPE
if uuid_representation == UuidRepresentation.PYTHON_LEGACY:
payload = uuid.bytes
elif uuid_representation == UuidRepresentation.JAVA_LEGACY:
from_uuid = uuid.bytes
payload = from_uuid[0:8][::-1] + from_uuid[8:16][::-1]
elif uuid_representation == UuidRepresentation.CSHARP_LEGACY:
payload = uuid.bytes_le
else:
# uuid_representation == UuidRepresentation.STANDARD
subtype = UUID_SUBTYPE
payload = uuid.bytes
return cls(payload, subtype)
def as_uuid(self, uuid_representation: int = UuidRepresentation.STANDARD) -> UUID:
"""Create a Python UUID from this BSON Binary object.
Decodes this binary object as a native :class:`uuid.UUID` instance
with the provided ``uuid_representation``.
Raises :exc:`ValueError` if this :class:`~bson.binary.Binary` instance
does not contain a UUID.
:param uuid_representation: A member of
:class:`~bson.binary.UuidRepresentation`. Default:
:const:`~bson.binary.UuidRepresentation.STANDARD`.
See `UUID representations <https://www.mongodb.com/docs/languages/python/pymongo-driver/current/data-formats/uuid/#universally-unique-ids--uuids->`_ for details.
.. versionadded:: 3.11
"""
if self.subtype not in ALL_UUID_SUBTYPES:
raise ValueError(f"cannot decode subtype {self.subtype} as a uuid")
if uuid_representation not in ALL_UUID_REPRESENTATIONS:
raise ValueError(
"uuid_representation must be a value from bson.binary.UuidRepresentation"
)
if uuid_representation == UuidRepresentation.UNSPECIFIED:
raise ValueError("uuid_representation cannot be UNSPECIFIED")
elif uuid_representation == UuidRepresentation.PYTHON_LEGACY:
if self.subtype == OLD_UUID_SUBTYPE:
return UUID(bytes=self)
elif uuid_representation == UuidRepresentation.JAVA_LEGACY:
if self.subtype == OLD_UUID_SUBTYPE:
return UUID(bytes=self[0:8][::-1] + self[8:16][::-1])
elif uuid_representation == UuidRepresentation.CSHARP_LEGACY:
if self.subtype == OLD_UUID_SUBTYPE:
return UUID(bytes_le=self)
else:
# uuid_representation == UuidRepresentation.STANDARD
if self.subtype == UUID_SUBTYPE:
return UUID(bytes=self)
raise ValueError(
f"cannot decode subtype {self.subtype} to {UUID_REPRESENTATION_NAMES[uuid_representation]}"
)
@classmethod
@overload
def from_vector(cls: Type[Binary], vector: BinaryVector) -> Binary:
...
@classmethod
@overload
def from_vector(
cls: Type[Binary],
vector: Union[list[int], list[float]],
dtype: BinaryVectorDtype,
padding: int = 0,
) -> Binary:
...
@classmethod
@overload
def from_vector(
cls: Type[Binary],
vector: npt.NDArray[np.number],
dtype: BinaryVectorDtype,
padding: int = 0,
) -> Binary:
...
@classmethod
def from_vector(
cls: Type[Binary],
vector: Union[BinaryVector, list[int], list[float], npt.NDArray[np.number]],
dtype: Optional[BinaryVectorDtype] = None,
padding: Optional[int] = None,
) -> Binary:
"""Create a BSON :class:`~bson.binary.Binary` of Vector subtype.
To interpret the representation of the numbers, a data type must be included.
See :class:`~bson.binary.BinaryVectorDtype` for available types and descriptions.
The dtype and padding are prepended to the binary data's value.
:param vector: Either a List of values, or a :class:`~bson.binary.BinaryVector` dataclass.
:param dtype: Data type of the values
:param padding: For fractional bytes, number of bits to ignore at end of vector.
:return: Binary packed data identified by dtype and padding.
.. versionchanged:: 4.14
When padding is non-zero, ignored bits should be zero. Raise exception on encoding, warn on decoding.
.. versionadded:: 4.10
"""
if isinstance(vector, BinaryVector):
if dtype or padding:
raise ValueError(
"The first argument, vector, has type BinaryVector. "
"dtype or padding cannot be separately defined, but were."
)
dtype = vector.dtype
padding = vector.padding
vector = vector.data # type: ignore
padding = 0 if padding is None else padding
if not isinstance(dtype, BinaryVectorDtype):
raise TypeError(
"dtype must be a bson.BinaryVectorDtype of BinaryVectorDType.INT8, PACKED_BIT, FLOAT32"
)
metadata = struct.pack("<sB", dtype.value, padding)
if isinstance(vector, list):
if dtype == BinaryVectorDtype.INT8: # pack ints in [-128, 127] as signed int8
format_str = "b"
if padding:
raise ValueError(f"padding does not apply to {dtype=}")
elif dtype == BinaryVectorDtype.PACKED_BIT: # pack ints in [0, 255] as unsigned uint8
format_str = "B"
if 0 <= padding > 7:
raise ValueError(f"{padding=}. It must be in [0,1, ..7].")
if padding and not vector:
raise ValueError("Empty vector with non-zero padding.")
elif dtype == BinaryVectorDtype.FLOAT32: # pack floats as float32
format_str = "f"
if padding:
raise ValueError(f"padding does not apply to {dtype=}")
else:
raise NotImplementedError("%s not yet supported" % dtype)
data = struct.pack(f"<{len(vector)}{format_str}", *vector)
else: # vector is numpy array or incorrect type.
try:
import numpy as np
except ImportError as exc:
raise ImportError(
"Failed to create binary from vector. Check type. If numpy array, numpy must be installed."
) from exc
if not isinstance(vector, np.ndarray):
raise TypeError(
"Could not create Binary. Vector must be a BinaryVector, list[int], list[float] or numpy ndarray."
)
if vector.ndim != 1:
raise ValueError(
"from_numpy_vector only supports 1D arrays as it creates a single vector."
)
if dtype == BinaryVectorDtype.FLOAT32:
vector = vector.astype(np.dtype("float32"), copy=False)
elif dtype == BinaryVectorDtype.INT8:
if vector.min() >= -128 and vector.max() <= 127:
vector = vector.astype(np.dtype("int8"), copy=False)
else:
raise ValueError("Values found outside INT8 range.")
elif dtype == BinaryVectorDtype.PACKED_BIT:
if vector.min() >= 0 and vector.max() <= 127:
vector = vector.astype(np.dtype("uint8"), copy=False)
else:
raise ValueError("Values found outside UINT8 range.")
else:
raise NotImplementedError("%s not yet supported" % dtype)
data = vector.tobytes()
if padding and len(vector) and not (data[-1] & ((1 << padding) - 1)) == 0:
raise ValueError(
"Vector has a padding P, but bits in the final byte lower than P are non-zero. They must be zero."
)
return cls(metadata + data, subtype=VECTOR_SUBTYPE)
def as_vector(self, return_numpy: bool = False) -> BinaryVector:
"""From the Binary, create a list or 1-d numpy array of numbers, along with dtype and padding.
:param return_numpy: If True, BinaryVector.data will be a one-dimensional numpy array. By default, it is a list.
:return: BinaryVector
.. versionadded:: 4.10
"""
if self.subtype != VECTOR_SUBTYPE:
raise ValueError(f"Cannot decode subtype {self.subtype} as a vector")
dtype, padding = struct.unpack_from("<sB", self)
dtype = BinaryVectorDtype(dtype)
offset = 2
n_bytes = len(self) - offset
if padding and dtype != BinaryVectorDtype.PACKED_BIT:
raise ValueError(
f"Corrupt data. Padding ({padding}) must be 0 for all but PACKED_BIT dtypes. ({dtype=})"
)
if not return_numpy:
if dtype == BinaryVectorDtype.INT8:
dtype_format = "b"
format_string = f"<{n_bytes}{dtype_format}"
vector = list(struct.unpack_from(format_string, self, offset))
return BinaryVector(vector, dtype, padding)
elif dtype == BinaryVectorDtype.FLOAT32:
n_values = n_bytes // 4
if n_bytes % 4:
raise ValueError(
"Corrupt data. N bytes for a float32 vector must be a multiple of 4."
)
dtype_format = "f"
format_string = f"<{n_values}{dtype_format}"
vector = list(struct.unpack_from(format_string, self, offset))
return BinaryVector(vector, dtype, padding)
elif dtype == BinaryVectorDtype.PACKED_BIT:
# data packed as uint8
if padding and not n_bytes:
raise ValueError("Corrupt data. Vector has a padding P, but no data.")
if padding > 7 or padding < 0:
raise ValueError(f"Corrupt data. Padding ({padding}) must be between 0 and 7.")
dtype_format = "B"
format_string = f"<{n_bytes}{dtype_format}"
unpacked_uint8s = list(struct.unpack_from(format_string, self, offset))
if padding and n_bytes and unpacked_uint8s[-1] & (1 << padding) - 1 != 0:
warnings.warn(
"Vector has a padding P, but bits in the final byte lower than P are non-zero. For pymongo>=5.0, they must be zero.",
DeprecationWarning,
stacklevel=2,
)
return BinaryVector(unpacked_uint8s, dtype, padding)
else:
raise NotImplementedError("Binary Vector dtype %s not yet supported" % dtype.name)
else: # create a numpy array
try:
import numpy as np
except ImportError as exc:
raise ImportError(
"Converting binary to numpy.ndarray requires numpy to be installed."
) from exc
if dtype == BinaryVectorDtype.INT8:
data = np.frombuffer(self[offset:], dtype="int8")
elif dtype == BinaryVectorDtype.FLOAT32:
if n_bytes % 4:
raise ValueError(
"Corrupt data. N bytes for a float32 vector must be a multiple of 4."
)
data = np.frombuffer(self[offset:], dtype="float32")
elif dtype == BinaryVectorDtype.PACKED_BIT:
# data packed as uint8
if padding and not n_bytes:
raise ValueError("Corrupt data. Vector has a padding P, but no data.")
if padding > 7 or padding < 0:
raise ValueError(f"Corrupt data. Padding ({padding}) must be between 0 and 7.")
data = np.frombuffer(self[offset:], dtype="uint8")
if padding and np.unpackbits(data[-1])[-padding:].sum() > 0:
warnings.warn(
"Vector has a padding P, but bits in the final byte lower than P are non-zero. For pymongo>=5.0, they must be zero.",
DeprecationWarning,
stacklevel=2,
)
else:
raise NotImplementedError("Binary Vector dtype %s not yet supported" % dtype.name)
return BinaryVector(data, dtype, padding)
@property
def subtype(self) -> int:
"""Subtype of this binary data."""
return self.__subtype
def __getnewargs__(self):
def __getnewargs__(self) -> Tuple[bytes, int]: # type: ignore[override]
# Work around http://bugs.python.org/issue7382
data = super(Binary, self).__getnewargs__()[0]
if PY3 and not isinstance(data, binary_type):
data = data.encode('latin-1')
data = super().__getnewargs__()[0]
if not isinstance(data, bytes):
data = data.encode("latin-1")
return data, self.__subtype
def __eq__(self, other):
def __eq__(self, other: Any) -> bool:
if isinstance(other, Binary):
return ((self.__subtype, binary_type(self)) ==
(other.subtype, binary_type(other)))
return (self.__subtype, bytes(self)) == (other.subtype, bytes(other))
# We don't return NotImplemented here because if we did then
# Binary("foo") == "foo" would return True, since Binary is a
# subclass of str...
return False
def __ne__(self, other):
def __hash__(self) -> int:
return super().__hash__() ^ hash(self.__subtype)
def __ne__(self, other: Any) -> bool:
return not self == other
def __repr__(self):
return "Binary(%s, %s)" % (binary_type.__repr__(self), self.__subtype)
class UUIDLegacy(Binary):
"""UUID wrapper to support working with UUIDs stored as legacy
BSON binary subtype 3.
.. doctest::
>>> import uuid
>>> from bson.binary import Binary, UUIDLegacy, UUID_SUBTYPE
>>> my_uuid = uuid.uuid4()
>>> coll = db.test
>>> coll.uuid_subtype = UUID_SUBTYPE
>>> coll.insert({'uuid': Binary(my_uuid.bytes, 3)})
ObjectId('...')
>>> coll.find({'uuid': my_uuid}).count()
0
>>> coll.find({'uuid': UUIDLegacy(my_uuid)}).count()
1
>>> coll.find({'uuid': UUIDLegacy(my_uuid)})[0]['uuid']
UUID('...')
>>>
>>> # Convert from subtype 3 to subtype 4
>>> doc = coll.find_one({'uuid': UUIDLegacy(my_uuid)})
>>> coll.save(doc)
ObjectId('...')
>>> coll.find({'uuid': UUIDLegacy(my_uuid)}).count()
0
>>> coll.find({'uuid': {'$in': [UUIDLegacy(my_uuid), my_uuid]}}).count()
1
>>> coll.find_one({'uuid': my_uuid})['uuid']
UUID('...')
Raises TypeError if `obj` is not an instance of :class:`~uuid.UUID`.
:Parameters:
- `obj`: An instance of :class:`~uuid.UUID`.
"""
def __new__(cls, obj):
if not isinstance(obj, UUID):
raise TypeError("obj must be an instance of uuid.UUID")
# Python 3.0(.1) returns a bytearray instance for bytes (3.1 and
# newer just return a bytes instance). Convert that to binary_type
# for compatibility.
self = Binary.__new__(cls, binary_type(obj.bytes), OLD_UUID_SUBTYPE)
self.__uuid = obj
return self
def __getnewargs__(self):
# Support copy and deepcopy
return (self.__uuid,)
@property
def uuid(self):
"""UUID instance wrapped by this UUIDLegacy instance.
"""
return self.__uuid
def __repr__(self):
return "UUIDLegacy('%s')" % self.__uuid
def __repr__(self) -> str:
if self.__subtype == SENSITIVE_SUBTYPE:
return f"<Binary(REDACTED, {self.__subtype})>"
else:
return f"Binary({bytes.__repr__(self)}, {self.__subtype})"

233
bson/bson-endian.h Normal file
View File

@ -0,0 +1,233 @@
/*
* Copyright 2013-2016 MongoDB, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef BSON_ENDIAN_H
#define BSON_ENDIAN_H
#if defined(__sun)
# include <sys/byteorder.h>
#endif
#ifdef _MSC_VER
# define BSON_INLINE __inline
#else
# include <stdint.h>
# define BSON_INLINE __inline__
#endif
#define BSON_BIG_ENDIAN 4321
#define BSON_LITTLE_ENDIAN 1234
/* WORDS_BIGENDIAN from pyconfig.h / Python.h */
#ifdef WORDS_BIGENDIAN
# define BSON_BYTE_ORDER BSON_BIG_ENDIAN
#else
# define BSON_BYTE_ORDER BSON_LITTLE_ENDIAN
#endif
#if defined(__sun)
# define BSON_UINT16_SWAP_LE_BE(v) BSWAP_16((uint16_t)v)
# define BSON_UINT32_SWAP_LE_BE(v) BSWAP_32((uint32_t)v)
# define BSON_UINT64_SWAP_LE_BE(v) BSWAP_64((uint64_t)v)
#elif defined(__clang__) && defined(__clang_major__) && defined(__clang_minor__) && \
(__clang_major__ >= 3) && (__clang_minor__ >= 1)
# if __has_builtin(__builtin_bswap16)
# define BSON_UINT16_SWAP_LE_BE(v) __builtin_bswap16(v)
# endif
# if __has_builtin(__builtin_bswap32)
# define BSON_UINT32_SWAP_LE_BE(v) __builtin_bswap32(v)
# endif
# if __has_builtin(__builtin_bswap64)
# define BSON_UINT64_SWAP_LE_BE(v) __builtin_bswap64(v)
# endif
#elif defined(__GNUC__) && (__GNUC__ >= 4)
# if __GNUC__ >= 4 && defined (__GNUC_MINOR__) && __GNUC_MINOR__ >= 3
# define BSON_UINT32_SWAP_LE_BE(v) __builtin_bswap32 ((uint32_t)v)
# define BSON_UINT64_SWAP_LE_BE(v) __builtin_bswap64 ((uint64_t)v)
# endif
# if __GNUC__ >= 4 && defined (__GNUC_MINOR__) && __GNUC_MINOR__ >= 8
# define BSON_UINT16_SWAP_LE_BE(v) __builtin_bswap16 ((uint32_t)v)
# endif
#endif
#ifndef BSON_UINT16_SWAP_LE_BE
# define BSON_UINT16_SWAP_LE_BE(v) __bson_uint16_swap_slow ((uint16_t)v)
#endif
#ifndef BSON_UINT32_SWAP_LE_BE
# define BSON_UINT32_SWAP_LE_BE(v) __bson_uint32_swap_slow ((uint32_t)v)
#endif
#ifndef BSON_UINT64_SWAP_LE_BE
# define BSON_UINT64_SWAP_LE_BE(v) __bson_uint64_swap_slow ((uint64_t)v)
#endif
#if BSON_BYTE_ORDER == BSON_LITTLE_ENDIAN
# define BSON_UINT16_FROM_LE(v) ((uint16_t)v)
# define BSON_UINT16_TO_LE(v) ((uint16_t)v)
# define BSON_UINT16_FROM_BE(v) BSON_UINT16_SWAP_LE_BE (v)
# define BSON_UINT16_TO_BE(v) BSON_UINT16_SWAP_LE_BE (v)
# define BSON_UINT32_FROM_LE(v) ((uint32_t)v)
# define BSON_UINT32_TO_LE(v) ((uint32_t)v)
# define BSON_UINT32_FROM_BE(v) BSON_UINT32_SWAP_LE_BE (v)
# define BSON_UINT32_TO_BE(v) BSON_UINT32_SWAP_LE_BE (v)
# define BSON_UINT64_FROM_LE(v) ((uint64_t)v)
# define BSON_UINT64_TO_LE(v) ((uint64_t)v)
# define BSON_UINT64_FROM_BE(v) BSON_UINT64_SWAP_LE_BE (v)
# define BSON_UINT64_TO_BE(v) BSON_UINT64_SWAP_LE_BE (v)
# define BSON_DOUBLE_FROM_LE(v) ((double)v)
# define BSON_DOUBLE_TO_LE(v) ((double)v)
#elif BSON_BYTE_ORDER == BSON_BIG_ENDIAN
# define BSON_UINT16_FROM_LE(v) BSON_UINT16_SWAP_LE_BE (v)
# define BSON_UINT16_TO_LE(v) BSON_UINT16_SWAP_LE_BE (v)
# define BSON_UINT16_FROM_BE(v) ((uint16_t)v)
# define BSON_UINT16_TO_BE(v) ((uint16_t)v)
# define BSON_UINT32_FROM_LE(v) BSON_UINT32_SWAP_LE_BE (v)
# define BSON_UINT32_TO_LE(v) BSON_UINT32_SWAP_LE_BE (v)
# define BSON_UINT32_FROM_BE(v) ((uint32_t)v)
# define BSON_UINT32_TO_BE(v) ((uint32_t)v)
# define BSON_UINT64_FROM_LE(v) BSON_UINT64_SWAP_LE_BE (v)
# define BSON_UINT64_TO_LE(v) BSON_UINT64_SWAP_LE_BE (v)
# define BSON_UINT64_FROM_BE(v) ((uint64_t)v)
# define BSON_UINT64_TO_BE(v) ((uint64_t)v)
# define BSON_DOUBLE_FROM_LE(v) (__bson_double_swap_slow (v))
# define BSON_DOUBLE_TO_LE(v) (__bson_double_swap_slow (v))
#else
# error "The endianness of target architecture is unknown."
#endif
/*
*--------------------------------------------------------------------------
*
* __bson_uint16_swap_slow --
*
* Fallback endianness conversion for 16-bit integers.
*
* Returns:
* The endian swapped version.
*
* Side effects:
* None.
*
*--------------------------------------------------------------------------
*/
static BSON_INLINE uint16_t
__bson_uint16_swap_slow (uint16_t v) /* IN */
{
return ((v & 0x00FF) << 8) |
((v & 0xFF00) >> 8);
}
/*
*--------------------------------------------------------------------------
*
* __bson_uint32_swap_slow --
*
* Fallback endianness conversion for 32-bit integers.
*
* Returns:
* The endian swapped version.
*
* Side effects:
* None.
*
*--------------------------------------------------------------------------
*/
static BSON_INLINE uint32_t
__bson_uint32_swap_slow (uint32_t v) /* IN */
{
return ((v & 0x000000FFU) << 24) |
((v & 0x0000FF00U) << 8) |
((v & 0x00FF0000U) >> 8) |
((v & 0xFF000000U) >> 24);
}
/*
*--------------------------------------------------------------------------
*
* __bson_uint64_swap_slow --
*
* Fallback endianness conversion for 64-bit integers.
*
* Returns:
* The endian swapped version.
*
* Side effects:
* None.
*
*--------------------------------------------------------------------------
*/
static BSON_INLINE uint64_t
__bson_uint64_swap_slow (uint64_t v) /* IN */
{
return ((v & 0x00000000000000FFULL) << 56) |
((v & 0x000000000000FF00ULL) << 40) |
((v & 0x0000000000FF0000ULL) << 24) |
((v & 0x00000000FF000000ULL) << 8) |
((v & 0x000000FF00000000ULL) >> 8) |
((v & 0x0000FF0000000000ULL) >> 24) |
((v & 0x00FF000000000000ULL) >> 40) |
((v & 0xFF00000000000000ULL) >> 56);
}
/*
*--------------------------------------------------------------------------
*
* __bson_double_swap_slow --
*
* Fallback endianness conversion for double floating point.
*
* Returns:
* The endian swapped version.
*
* Side effects:
* None.
*
*--------------------------------------------------------------------------
*/
static BSON_INLINE double
__bson_double_swap_slow (double v) /* IN */
{
uint64_t uv;
memcpy(&uv, &v, sizeof(v));
uv = BSON_UINT64_SWAP_LE_BE(uv);
memcpy(&v, &uv, sizeof(v));
return v;
}
#endif /* BSON_ENDIAN_H */

View File

@ -1,5 +1,5 @@
/*
* Copyright 2009-2014 MongoDB, Inc.
* Copyright 2009-2015 MongoDB, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -14,6 +14,10 @@
* limitations under the License.
*/
/* Include Python.h so we can set Python's error indicator. */
#define PY_SSIZE_T_CLEAN
#include "Python.h"
#include <stdlib.h>
#include <string.h>
@ -27,12 +31,19 @@ struct buffer {
int position;
};
/* Set Python's error indicator to MemoryError.
* Called after allocation failures. */
static void set_memory_error(void) {
PyErr_NoMemory();
}
/* Allocate and return a new buffer.
* Return NULL on allocation failure. */
buffer_t buffer_new(void) {
* Return NULL and sets MemoryError on allocation failure. */
buffer_t pymongo_buffer_new(void) {
buffer_t buffer;
buffer = (buffer_t)malloc(sizeof(struct buffer));
if (buffer == NULL) {
set_memory_error();
return NULL;
}
@ -41,6 +52,7 @@ buffer_t buffer_new(void) {
buffer->buffer = (char*)malloc(sizeof(char) * INITIAL_BUFFER_SIZE);
if (buffer->buffer == NULL) {
free(buffer);
set_memory_error();
return NULL;
}
@ -49,17 +61,20 @@ buffer_t buffer_new(void) {
/* Free the memory allocated for `buffer`.
* Return non-zero on failure. */
int buffer_free(buffer_t buffer) {
int pymongo_buffer_free(buffer_t buffer) {
if (buffer == NULL) {
return 1;
}
free(buffer->buffer);
/* Buffer will be NULL when buffer_grow fails. */
if (buffer->buffer != NULL) {
free(buffer->buffer);
}
free(buffer);
return 0;
}
/* Grow `buffer` to at least `min_length`.
* Return non-zero on allocation failure. */
* Return non-zero and sets MemoryError on allocation failure. */
static int buffer_grow(buffer_t buffer, int min_length) {
int old_size = 0;
int size = buffer->size;
@ -79,7 +94,7 @@ static int buffer_grow(buffer_t buffer, int min_length) {
buffer->buffer = (char*)realloc(buffer->buffer, sizeof(char) * size);
if (buffer->buffer == NULL) {
free(old_buffer);
free(buffer);
set_memory_error();
return 1;
}
buffer->size = size;
@ -87,17 +102,27 @@ static int buffer_grow(buffer_t buffer, int min_length) {
}
/* Assure that `buffer` has at least `size` free bytes (and grow if needed).
* Return non-zero on allocation failure. */
* Return non-zero and sets MemoryError on allocation failure.
* Return non-zero and sets ValueError if `size` would exceed 2GiB. */
static int buffer_assure_space(buffer_t buffer, int size) {
if (buffer->position + size <= buffer->size) {
int new_size = buffer->position + size;
/* Check for overflow. */
if (new_size < buffer->position) {
PyErr_SetString(PyExc_ValueError,
"Document would overflow BSON size limit");
return 1;
}
if (new_size <= buffer->size) {
return 0;
}
return buffer_grow(buffer, buffer->position + size);
return buffer_grow(buffer, new_size);
}
/* Save `size` bytes from the current position in `buffer` (and grow if needed).
* Return offset for writing, or -1 on allocation failure. */
buffer_position buffer_save_space(buffer_t buffer, int size) {
* Return offset for writing, or -1 on failure.
* Sets MemoryError or ValueError on failure. */
buffer_position pymongo_buffer_save_space(buffer_t buffer, int size) {
int position = buffer->position;
if (buffer_assure_space(buffer, size) != 0) {
return -1;
@ -107,8 +132,9 @@ buffer_position buffer_save_space(buffer_t buffer, int size) {
}
/* Write `size` bytes from `data` to `buffer` (and grow if needed).
* Return non-zero on allocation failure. */
int buffer_write(buffer_t buffer, const char* data, int size) {
* Return non-zero on failure.
* Sets MemoryError or ValueError on failure. */
int pymongo_buffer_write(buffer_t buffer, const char* data, int size) {
if (buffer_assure_space(buffer, size) != 0) {
return 1;
}
@ -118,29 +144,14 @@ int buffer_write(buffer_t buffer, const char* data, int size) {
return 0;
}
/* Write `size` bytes from `data` to `buffer` at position `position`.
* Does not change the internal position of `buffer`.
* Return non-zero if buffer isn't large enough for write. */
int buffer_write_at_position(buffer_t buffer, buffer_position position,
const char* data, int size) {
if (position + size > buffer->size) {
buffer_free(buffer);
return 1;
}
memcpy(buffer->buffer + position, data, size);
return 0;
}
int buffer_get_position(buffer_t buffer) {
int pymongo_buffer_get_position(buffer_t buffer) {
return buffer->position;
}
char* buffer_get_buffer(buffer_t buffer) {
char* pymongo_buffer_get_buffer(buffer_t buffer) {
return buffer->buffer;
}
void buffer_update_position(buffer_t buffer, buffer_position new_position) {
void pymongo_buffer_update_position(buffer_t buffer, buffer_position new_position) {
buffer->position = new_position;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2009-2014 MongoDB, Inc.
* Copyright 2009-2015 MongoDB, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -27,30 +27,25 @@ typedef int buffer_position;
/* Allocate and return a new buffer.
* Return NULL on allocation failure. */
buffer_t buffer_new(void);
buffer_t pymongo_buffer_new(void);
/* Free the memory allocated for `buffer`.
* Return non-zero on failure. */
int buffer_free(buffer_t buffer);
int pymongo_buffer_free(buffer_t buffer);
/* Save `size` bytes from the current position in `buffer` (and grow if needed).
* Return offset for writing, or -1 on allocation failure. */
buffer_position buffer_save_space(buffer_t buffer, int size);
buffer_position pymongo_buffer_save_space(buffer_t buffer, int size);
/* Write `size` bytes from `data` to `buffer` (and grow if needed).
* Return non-zero on allocation failure. */
int buffer_write(buffer_t buffer, const char* data, int size);
/* Write `size` bytes from `data` to `buffer` at position `position`.
* Does not change the internal position of `buffer`.
* Return non-zero if buffer isn't large enough for write. */
int buffer_write_at_position(buffer_t buffer, buffer_position position, const char* data, int size);
int pymongo_buffer_write(buffer_t buffer, const char* data, int size);
/* Getters for the internals of a buffer_t.
* Should try to avoid using these as much as possible
* since they break the abstraction. */
buffer_position buffer_get_position(buffer_t buffer);
char* buffer_get_buffer(buffer_t buffer);
void buffer_update_position(buffer_t buffer, buffer_position new_position);
buffer_position pymongo_buffer_get_position(buffer_t buffer);
char* pymongo_buffer_get_buffer(buffer_t buffer);
void pymongo_buffer_update_position(buffer_t buffer, buffer_position new_position);
#endif

View File

@ -1,4 +1,4 @@
# Copyright 2009-2014 MongoDB, Inc.
# Copyright 2009-present MongoDB, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -12,69 +12,89 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""Tools for representing JavaScript code in BSON.
"""
"""Tools for representing JavaScript code in BSON."""
from __future__ import annotations
from collections.abc import Mapping as _Mapping
from typing import Any, Mapping, Optional, Type, Union
class Code(str):
"""BSON's JavaScript code type.
Raises :class:`TypeError` if `code` is not an instance of
:class:`basestring` (:class:`str` in python 3) or `scope`
is not ``None`` or an instance of :class:`dict`.
:class:`str` or `scope` is not ``None`` or an instance
of :class:`dict`.
Scope variables can be set by passing a dictionary as the `scope`
argument or by using keyword arguments. If a variable is set as a
keyword argument it will override any setting for that variable in
the `scope` dictionary.
:Parameters:
- `code`: string containing JavaScript code to be evaluated
- `scope` (optional): dictionary representing the scope in which
:param code: A string containing JavaScript code to be evaluated or another
instance of Code. In the latter case, the scope of `code` becomes this
Code's :attr:`scope`.
:param scope: dictionary representing the scope in which
`code` should be evaluated - a mapping from identifiers (as
strings) to values
- `**kwargs` (optional): scope variables can also be passed as
keyword arguments
strings) to values. Defaults to ``None``. This is applied after any
scope associated with a given `code` above.
:param kwargs: scope variables can also be passed as
keyword arguments. These are applied after `scope` and `code`.
.. versionchanged:: 3.4
The default value for :attr:`scope` is ``None`` instead of ``{}``.
.. versionadded:: 1.9
Ability to pass scope values using keyword arguments.
"""
_type_marker = 13
__scope: Union[Mapping[str, Any], None]
def __new__(cls, code, scope=None, **kwargs):
if not isinstance(code, basestring):
raise TypeError("code must be an "
"instance of %s" % (basestring.__name__,))
def __new__(
cls: Type[Code],
code: Union[str, Code],
scope: Optional[Mapping[str, Any]] = None,
**kwargs: Any,
) -> Code:
if not isinstance(code, str):
raise TypeError(f"code must be an instance of str, not {type(code)}")
self = str.__new__(cls, code)
try:
self.__scope = code.scope
self.__scope = code.scope # type: ignore
except AttributeError:
self.__scope = {}
self.__scope = None
if scope is not None:
if not isinstance(scope, dict):
raise TypeError("scope must be an instance of dict")
self.__scope.update(scope)
if not isinstance(scope, _Mapping):
raise TypeError(f"scope must be an instance of dict, not {type(scope)}")
if self.__scope is not None:
self.__scope.update(scope) # type: ignore
else:
self.__scope = scope
self.__scope.update(kwargs)
if kwargs:
if self.__scope is not None:
self.__scope.update(kwargs) # type: ignore
else:
self.__scope = kwargs
return self
@property
def scope(self):
"""Scope dictionary for this instance.
"""
def scope(self) -> Optional[Mapping[str, Any]]:
"""Scope dictionary for this instance or ``None``."""
return self.__scope
def __repr__(self):
return "Code(%s, %r)" % (str.__repr__(self), self.__scope)
def __repr__(self) -> str:
return f"Code({str.__repr__(self)}, {self.__scope!r})"
def __eq__(self, other):
def __eq__(self, other: Any) -> bool:
if isinstance(other, Code):
return (self.__scope, str(self)) == (other.__scope, str(other))
return False
def __ne__(self, other):
__hash__: Any = None
def __ne__(self, other: Any) -> bool:
return not self == other

505
bson/codec_options.py Normal file
View File

@ -0,0 +1,505 @@
# Copyright 2014-present MongoDB, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Tools for specifying BSON codec options."""
from __future__ import annotations
import abc
import datetime
import enum
from collections.abc import MutableMapping as _MutableMapping
from typing import (
TYPE_CHECKING,
Any,
Callable,
Generic,
Iterable,
Mapping,
NamedTuple,
Optional,
Tuple,
Type,
Union,
cast,
)
from bson.binary import (
ALL_UUID_REPRESENTATIONS,
UUID_REPRESENTATION_NAMES,
UuidRepresentation,
)
from bson.typings import _DocumentType
_RAW_BSON_DOCUMENT_MARKER = 101
def _raw_document_class(document_class: Any) -> bool:
"""Determine if a document_class is a RawBSONDocument class."""
marker = getattr(document_class, "_type_marker", None)
return marker == _RAW_BSON_DOCUMENT_MARKER
class TypeEncoder(abc.ABC):
"""Base class for defining type codec classes which describe how a
custom type can be transformed to one of the types BSON understands.
Codec classes must implement the ``python_type`` attribute, and the
``transform_python`` method to support encoding.
See `encode data with type codecs <https://www.mongodb.com/docs/languages/python/pymongo-driver/current/data-formats/custom-types/type-codecs/#encode-data-with-type-codecs>`_ documentation for an example.
"""
@abc.abstractproperty
def python_type(self) -> Any:
"""The Python type to be converted into something serializable."""
@abc.abstractmethod
def transform_python(self, value: Any) -> Any:
"""Convert the given Python object into something serializable."""
class TypeDecoder(abc.ABC):
"""Base class for defining type codec classes which describe how a
BSON type can be transformed to a custom type.
Codec classes must implement the ``bson_type`` attribute, and the
``transform_bson`` method to support decoding.
See `encode data with type codecs <https://www.mongodb.com/docs/languages/python/pymongo-driver/current/data-formats/custom-types/type-codecs/#encode-data-with-type-codecs>`_ documentation for an example.
"""
@abc.abstractproperty
def bson_type(self) -> Any:
"""The BSON type to be converted into our own type."""
@abc.abstractmethod
def transform_bson(self, value: Any) -> Any:
"""Convert the given BSON value into our own type."""
class TypeCodec(TypeEncoder, TypeDecoder):
"""Base class for defining type codec classes which describe how a
custom type can be transformed to/from one of the types :mod:`bson`
can already encode/decode.
Codec classes must implement the ``python_type`` attribute, and the
``transform_python`` method to support encoding, as well as the
``bson_type`` attribute, and the ``transform_bson`` method to support
decoding.
See `encode data with type codecs <https://www.mongodb.com/docs/languages/python/pymongo-driver/current/data-formats/custom-types/type-codecs/#encode-data-with-type-codecs>`_ documentation for an example.
"""
_Codec = Union[TypeEncoder, TypeDecoder, TypeCodec]
_Fallback = Callable[[Any], Any]
class TypeRegistry:
"""Encapsulates type codecs used in encoding and / or decoding BSON, as
well as the fallback encoder. Type registries cannot be modified after
instantiation.
``TypeRegistry`` can be initialized with an iterable of type codecs, and
a callable for the fallback encoder::
>>> from bson.codec_options import TypeRegistry
>>> type_registry = TypeRegistry([Codec1, Codec2, Codec3, ...],
... fallback_encoder)
See `add codec to the type registry <https://www.mongodb.com/docs/languages/python/pymongo-driver/current/data-formats/custom-types/type-codecs/#add-codec-to-the-type-registry>`_ documentation for an example.
:param type_codecs: iterable of type codec instances. If
``type_codecs`` contains multiple codecs that transform a single
python or BSON type, the transformation specified by the type codec
occurring last prevails. A TypeError will be raised if one or more
type codecs modify the encoding behavior of a built-in :mod:`bson`
type.
:param fallback_encoder: callable that accepts a single,
unencodable python value and transforms it into a type that
:mod:`bson` can encode. See `define a fallback encoder <https://www.mongodb.com/docs/languages/python/pymongo-driver/current/data-formats/custom-types/type-codecs/#define-a-fallback-encoder>`_
documentation for an example.
"""
def __init__(
self,
type_codecs: Optional[Iterable[_Codec]] = None,
fallback_encoder: Optional[_Fallback] = None,
) -> None:
self.__type_codecs = list(type_codecs or [])
self._fallback_encoder = fallback_encoder
self._encoder_map: dict[Any, Any] = {}
self._decoder_map: dict[Any, Any] = {}
if self._fallback_encoder is not None:
if not callable(fallback_encoder):
raise TypeError("fallback_encoder %r is not a callable" % (fallback_encoder))
for codec in self.__type_codecs:
is_valid_codec = False
if isinstance(codec, TypeEncoder):
self._validate_type_encoder(codec)
is_valid_codec = True
self._encoder_map[codec.python_type] = codec.transform_python
if isinstance(codec, TypeDecoder):
is_valid_codec = True
self._decoder_map[codec.bson_type] = codec.transform_bson
if not is_valid_codec:
raise TypeError(
f"Expected an instance of {TypeEncoder.__name__}, {TypeDecoder.__name__}, or {TypeCodec.__name__}, got {codec!r} instead"
)
@property
def codecs(self) -> list[TypeEncoder | TypeDecoder | TypeCodec]:
"""The list of type codecs in this registry."""
return self.__type_codecs
@property
def fallback_encoder(self) -> Optional[_Fallback]:
"""The fallback encoder in this registry."""
return self._fallback_encoder
def _validate_type_encoder(self, codec: _Codec) -> None:
from bson import _BUILT_IN_TYPES
for pytype in _BUILT_IN_TYPES:
if issubclass(cast(TypeCodec, codec).python_type, pytype):
err_msg = (
"TypeEncoders cannot change how built-in types are "
f"encoded (encoder {codec} transforms type {pytype})"
)
raise TypeError(err_msg)
def __repr__(self) -> str:
return "{}(type_codecs={!r}, fallback_encoder={!r})".format(
self.__class__.__name__,
self.__type_codecs,
self._fallback_encoder,
)
def __eq__(self, other: Any) -> Any:
if not isinstance(other, type(self)):
return NotImplemented
return (
(self._decoder_map == other._decoder_map)
and (self._encoder_map == other._encoder_map)
and (self._fallback_encoder == other._fallback_encoder)
)
class DatetimeConversion(int, enum.Enum):
"""Options for decoding BSON datetimes."""
DATETIME = 1
"""Decode a BSON UTC datetime as a :class:`datetime.datetime`.
BSON UTC datetimes that cannot be represented as a
:class:`~datetime.datetime` will raise an :class:`OverflowError`
or a :class:`ValueError`.
.. versionadded 4.3
"""
DATETIME_CLAMP = 2
"""Decode a BSON UTC datetime as a :class:`datetime.datetime`, clamping
to :attr:`~datetime.datetime.min` and :attr:`~datetime.datetime.max`.
.. versionadded 4.3
"""
DATETIME_MS = 3
"""Decode a BSON UTC datetime as a :class:`~bson.datetime_ms.DatetimeMS`
object.
.. versionadded 4.3
"""
DATETIME_AUTO = 4
"""Decode a BSON UTC datetime as a :class:`datetime.datetime` if possible,
and a :class:`~bson.datetime_ms.DatetimeMS` if not.
.. versionadded 4.3
"""
class _BaseCodecOptions(NamedTuple):
document_class: Type[Mapping[str, Any]]
tz_aware: bool
uuid_representation: int
unicode_decode_error_handler: str
tzinfo: Optional[datetime.tzinfo]
type_registry: TypeRegistry
datetime_conversion: Optional[DatetimeConversion]
if TYPE_CHECKING:
class CodecOptions(Tuple[_DocumentType], Generic[_DocumentType]):
document_class: Type[_DocumentType]
tz_aware: bool
uuid_representation: int
unicode_decode_error_handler: Optional[str]
tzinfo: Optional[datetime.tzinfo]
type_registry: TypeRegistry
datetime_conversion: Optional[int]
def __new__(
cls: Type[CodecOptions[_DocumentType]],
document_class: Optional[Type[_DocumentType]] = ...,
tz_aware: bool = ...,
uuid_representation: Optional[int] = ...,
unicode_decode_error_handler: Optional[str] = ...,
tzinfo: Optional[datetime.tzinfo] = ...,
type_registry: Optional[TypeRegistry] = ...,
datetime_conversion: Optional[int] = ...,
) -> CodecOptions[_DocumentType]:
...
# CodecOptions API
def with_options(self, **kwargs: Any) -> CodecOptions[Any]:
...
def _arguments_repr(self) -> str:
...
# NamedTuple API
@classmethod
def _make(cls, obj: Iterable[Any]) -> CodecOptions[_DocumentType]:
...
def _asdict(self) -> dict[str, Any]:
...
def _replace(self, **kwargs: Any) -> CodecOptions[_DocumentType]:
...
_source: str
_fields: Tuple[str]
else:
class CodecOptions(_BaseCodecOptions):
"""Encapsulates options used encoding and / or decoding BSON."""
def __init__(self, *args, **kwargs):
"""Encapsulates options used encoding and / or decoding BSON.
The `document_class` option is used to define a custom type for use
decoding BSON documents. Access to the underlying raw BSON bytes for
a document is available using the :class:`~bson.raw_bson.RawBSONDocument`
type::
>>> from bson.raw_bson import RawBSONDocument
>>> from bson.codec_options import CodecOptions
>>> codec_options = CodecOptions(document_class=RawBSONDocument)
>>> coll = db.get_collection('test', codec_options=codec_options)
>>> doc = coll.find_one()
>>> doc.raw
'\\x16\\x00\\x00\\x00\\x07_id\\x00[0\\x165\\x91\\x10\\xea\\x14\\xe8\\xc5\\x8b\\x93\\x00'
The document class can be any type that inherits from
:class:`~collections.abc.MutableMapping`::
>>> class AttributeDict(dict):
... # A dict that supports attribute access.
... def __getattr__(self, key):
... return self[key]
... def __setattr__(self, key, value):
... self[key] = value
...
>>> codec_options = CodecOptions(document_class=AttributeDict)
>>> coll = db.get_collection('test', codec_options=codec_options)
>>> doc = coll.find_one()
>>> doc._id
ObjectId('5b3016359110ea14e8c58b93')
See `Dates and Times <https://www.mongodb.com/docs/languages/python/pymongo-driver/current/data-formats/dates-and-times/#dates-and-times>`_ for examples using the `tz_aware` and
`tzinfo` options.
See `UUID <https://www.mongodb.com/docs/languages/python/pymongo-driver/current/data-formats/uuid/#universally-unique-ids--uuids->`_ for examples using the `uuid_representation`
option.
:param document_class: BSON documents returned in queries will be decoded
to an instance of this class. Must be a subclass of
:class:`~collections.abc.MutableMapping`. Defaults to :class:`dict`.
:param tz_aware: If ``True``, BSON datetimes will be decoded to timezone
aware instances of :class:`~datetime.datetime`. Otherwise they will be
naive. Defaults to ``False``.
:param uuid_representation: The BSON representation to use when encoding
and decoding instances of :class:`~uuid.UUID`. Defaults to
:data:`~bson.binary.UuidRepresentation.UNSPECIFIED`. New
applications should consider setting this to
:data:`~bson.binary.UuidRepresentation.STANDARD` for cross language
compatibility. See `UUID representations <https://www.mongodb.com/docs/languages/python/pymongo-driver/current/data-formats/uuid/#universally-unique-ids--uuids->`_ for details.
:param unicode_decode_error_handler: The error handler to apply when
a Unicode-related error occurs during BSON decoding that would
otherwise raise :exc:`UnicodeDecodeError`. Valid options include
'strict', 'replace', 'backslashreplace', 'surrogateescape', and
'ignore'. Defaults to 'strict'.
:param tzinfo: A :class:`~datetime.tzinfo` subclass that specifies the
timezone to/from which :class:`~datetime.datetime` objects should be
encoded/decoded.
:param type_registry: Instance of :class:`TypeRegistry` used to customize
encoding and decoding behavior.
:param datetime_conversion: Specifies how UTC datetimes should be decoded
within BSON. Valid options include 'datetime_ms' to return as a
DatetimeMS, 'datetime' to return as a datetime.datetime and
raising a ValueError for out-of-range values, 'datetime_auto' to
return DatetimeMS objects when the underlying datetime is
out-of-range and 'datetime_clamp' to clamp to the minimum and
maximum possible datetimes. Defaults to 'datetime'.
.. versionchanged:: 4.0
The default for `uuid_representation` was changed from
:const:`~bson.binary.UuidRepresentation.PYTHON_LEGACY` to
:const:`~bson.binary.UuidRepresentation.UNSPECIFIED`.
.. versionadded:: 3.8
`type_registry` attribute.
.. warning:: Care must be taken when changing
`unicode_decode_error_handler` from its default value ('strict').
The 'replace' and 'ignore' modes should not be used when documents
retrieved from the server will be modified in the client application
and stored back to the server.
"""
super().__init__()
def __new__(
cls: Type[CodecOptions],
document_class: Optional[Type[Mapping[str, Any]]] = None,
tz_aware: bool = False,
uuid_representation: Optional[int] = UuidRepresentation.UNSPECIFIED,
unicode_decode_error_handler: str = "strict",
tzinfo: Optional[datetime.tzinfo] = None,
type_registry: Optional[TypeRegistry] = None,
datetime_conversion: Optional[DatetimeConversion] = DatetimeConversion.DATETIME,
) -> CodecOptions:
doc_class = document_class or dict
# issubclass can raise TypeError for generic aliases like SON[str, Any].
# In that case we can use the base class for the comparison.
is_mapping = False
try:
is_mapping = issubclass(doc_class, _MutableMapping)
except TypeError:
if hasattr(doc_class, "__origin__"):
is_mapping = issubclass(doc_class.__origin__, _MutableMapping)
if not (is_mapping or _raw_document_class(doc_class)):
raise TypeError(
"document_class must be dict, bson.son.SON, "
"bson.raw_bson.RawBSONDocument, or a "
"subclass of collections.abc.MutableMapping"
)
if not isinstance(tz_aware, bool):
raise TypeError(f"tz_aware must be True or False, was: tz_aware={tz_aware}")
if uuid_representation not in ALL_UUID_REPRESENTATIONS:
raise ValueError(
"uuid_representation must be a value from bson.binary.UuidRepresentation"
)
if not isinstance(unicode_decode_error_handler, str):
raise ValueError(
f"unicode_decode_error_handler must be a string, not {type(unicode_decode_error_handler)}"
)
if tzinfo is not None:
if not isinstance(tzinfo, datetime.tzinfo):
raise TypeError(
f"tzinfo must be an instance of datetime.tzinfo, not {type(tzinfo)}"
)
if not tz_aware:
raise ValueError("cannot specify tzinfo without also setting tz_aware=True")
type_registry = type_registry or TypeRegistry()
if not isinstance(type_registry, TypeRegistry):
raise TypeError(
f"type_registry must be an instance of TypeRegistry, not {type(type_registry)}"
)
return tuple.__new__(
cls,
(
doc_class,
tz_aware,
uuid_representation,
unicode_decode_error_handler,
tzinfo,
type_registry,
datetime_conversion,
),
)
def _arguments_repr(self) -> str:
"""Representation of the arguments used to create this object."""
document_class_repr = (
"dict" if self.document_class is dict else repr(self.document_class)
)
uuid_rep_repr = UUID_REPRESENTATION_NAMES.get(
self.uuid_representation, self.uuid_representation
)
return (
"document_class={}, tz_aware={!r}, uuid_representation={}, "
"unicode_decode_error_handler={!r}, tzinfo={!r}, "
"type_registry={!r}, datetime_conversion={!s}".format(
document_class_repr,
self.tz_aware,
uuid_rep_repr,
self.unicode_decode_error_handler,
self.tzinfo,
self.type_registry,
self.datetime_conversion,
)
)
def __repr__(self) -> str:
return f"{self.__class__.__name__}({self._arguments_repr()})"
def with_options(self, **kwargs: Any) -> CodecOptions:
"""Make a copy of this CodecOptions, overriding some options::
>>> from bson.codec_options import DEFAULT_CODEC_OPTIONS
>>> DEFAULT_CODEC_OPTIONS.tz_aware
False
>>> options = DEFAULT_CODEC_OPTIONS.with_options(tz_aware=True)
>>> options.tz_aware
True
.. versionadded:: 3.5
"""
opts = self._asdict()
opts.update(kwargs)
return CodecOptions(**opts)
DEFAULT_CODEC_OPTIONS: CodecOptions[dict[str, Any]] = CodecOptions()
def _parse_codec_options(options: Any) -> CodecOptions[Any]:
"""Parse BSON codec options."""
kwargs = {}
for k in set(options) & {
"document_class",
"tz_aware",
"uuidrepresentation",
"unicode_decode_error_handler",
"tzinfo",
"type_registry",
"datetime_conversion",
}:
if k == "uuidrepresentation":
kwargs["uuid_representation"] = options[k]
else:
kwargs[k] = options[k]
return CodecOptions(**kwargs)

182
bson/datetime_ms.py Normal file
View File

@ -0,0 +1,182 @@
# Copyright 2022-present MongoDB, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you
# may not use this file except in compliance with the License. You
# may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied. See the License for the specific language governing
# permissions and limitations under the License.
"""Tools for representing the BSON datetime type.
.. versionadded:: 4.3
"""
from __future__ import annotations
import calendar
import datetime
from typing import Any, Union, cast
from bson.codec_options import DEFAULT_CODEC_OPTIONS, CodecOptions, DatetimeConversion
from bson.errors import InvalidBSON
from bson.tz_util import utc
EPOCH_AWARE = datetime.datetime.fromtimestamp(0, utc)
EPOCH_NAIVE = EPOCH_AWARE.replace(tzinfo=None)
_DATETIME_ERROR_SUGGESTION = (
"(Consider Using CodecOptions(datetime_conversion=DATETIME_AUTO)"
" or MongoClient(datetime_conversion='DATETIME_AUTO'))."
" See: https://www.mongodb.com/docs/languages/python/pymongo-driver/current/data-formats/dates-and-times/#handling-out-of-range-datetimes"
)
class DatetimeMS:
"""Represents a BSON UTC datetime."""
__slots__ = ("_value",)
def __init__(self, value: Union[int, datetime.datetime]):
"""Represents a BSON UTC datetime.
BSON UTC datetimes are defined as an int64 of milliseconds since the
Unix epoch. The principal use of DatetimeMS is to represent
datetimes outside the range of the Python builtin
:class:`~datetime.datetime` class when
encoding/decoding BSON.
To decode UTC datetimes as a ``DatetimeMS``, `datetime_conversion` in
:class:`~bson.codec_options.CodecOptions` must be set to 'datetime_ms' or
'datetime_auto'. See `handling out of range datetimes <https://www.mongodb.com/docs/languages/python/pymongo-driver/current/data-formats/dates-and-times/#handling-out-of-range-datetimes>`_ for
details.
:param value: An instance of :class:`datetime.datetime` to be
represented as milliseconds since the Unix epoch, or int of
milliseconds since the Unix epoch.
"""
if isinstance(value, int):
if not (-(2**63) <= value <= 2**63 - 1):
raise OverflowError("Must be a 64-bit integer of milliseconds")
self._value = value
elif isinstance(value, datetime.datetime):
self._value = _datetime_to_millis(value)
else:
raise TypeError(f"{type(value)} is not a valid type for DatetimeMS")
def __hash__(self) -> int:
return hash(self._value)
def __repr__(self) -> str:
return type(self).__name__ + "(" + str(self._value) + ")"
def __lt__(self, other: Union[DatetimeMS, int]) -> bool:
return self._value < other
def __le__(self, other: Union[DatetimeMS, int]) -> bool:
return self._value <= other
def __eq__(self, other: Any) -> bool:
if isinstance(other, DatetimeMS):
return self._value == other._value
return False
def __ne__(self, other: Any) -> bool:
if isinstance(other, DatetimeMS):
return self._value != other._value
return True
def __gt__(self, other: Union[DatetimeMS, int]) -> bool:
return self._value > other
def __ge__(self, other: Union[DatetimeMS, int]) -> bool:
return self._value >= other
_type_marker = 9
def as_datetime(
self, codec_options: CodecOptions[Any] = DEFAULT_CODEC_OPTIONS
) -> datetime.datetime:
"""Create a Python :class:`~datetime.datetime` from this DatetimeMS object.
:param codec_options: A CodecOptions instance for specifying how the
resulting DatetimeMS object will be formatted using ``tz_aware``
and ``tz_info``. Defaults to
:const:`~bson.codec_options.DEFAULT_CODEC_OPTIONS`.
"""
return cast(datetime.datetime, _millis_to_datetime(self._value, codec_options))
def __int__(self) -> int:
return self._value
def _datetime_to_millis(dtm: datetime.datetime) -> int:
"""Convert datetime to milliseconds since epoch UTC."""
if dtm.utcoffset() is not None:
dtm = dtm - dtm.utcoffset() # type: ignore
return int(calendar.timegm(dtm.timetuple()) * 1000 + dtm.microsecond // 1000)
_MIN_UTC = datetime.datetime.min.replace(tzinfo=utc)
_MAX_UTC = datetime.datetime.max.replace(tzinfo=utc)
_MIN_UTC_MS = _datetime_to_millis(_MIN_UTC)
_MAX_UTC_MS = _datetime_to_millis(_MAX_UTC)
# Inclusive min and max for timezones.
def _min_datetime_ms(tz: datetime.tzinfo = utc) -> int:
delta = tz.utcoffset(_MIN_UTC)
if delta is not None:
offset_millis = (delta.days * 86400 + delta.seconds) * 1000 + delta.microseconds // 1000
else:
offset_millis = 0
return max(_MIN_UTC_MS, _MIN_UTC_MS - offset_millis)
def _max_datetime_ms(tz: datetime.tzinfo = utc) -> int:
delta = tz.utcoffset(_MAX_UTC)
if delta is not None:
offset_millis = (delta.days * 86400 + delta.seconds) * 1000 + delta.microseconds // 1000
else:
offset_millis = 0
return min(_MAX_UTC_MS, _MAX_UTC_MS - offset_millis)
def _millis_to_datetime(
millis: int, opts: CodecOptions[Any]
) -> Union[datetime.datetime, DatetimeMS]:
"""Convert milliseconds since epoch UTC to datetime."""
if (
opts.datetime_conversion == DatetimeConversion.DATETIME
or opts.datetime_conversion == DatetimeConversion.DATETIME_CLAMP
or opts.datetime_conversion == DatetimeConversion.DATETIME_AUTO
):
tz = opts.tzinfo or utc
if opts.datetime_conversion == DatetimeConversion.DATETIME_CLAMP:
millis = max(_min_datetime_ms(tz), min(millis, _max_datetime_ms(tz)))
elif opts.datetime_conversion == DatetimeConversion.DATETIME_AUTO:
if not (_min_datetime_ms(tz) <= millis <= _max_datetime_ms(tz)):
return DatetimeMS(millis)
diff = ((millis % 1000) + 1000) % 1000
seconds = (millis - diff) // 1000
micros = diff * 1000
try:
if opts.tz_aware:
dt = EPOCH_AWARE + datetime.timedelta(seconds=seconds, microseconds=micros)
if opts.tzinfo:
dt = dt.astimezone(tz)
return dt
else:
return EPOCH_NAIVE + datetime.timedelta(seconds=seconds, microseconds=micros)
except ArithmeticError as err:
raise InvalidBSON(f"{err} {_DATETIME_ERROR_SUGGESTION}") from err
elif opts.datetime_conversion == DatetimeConversion.DATETIME_MS:
return DatetimeMS(millis)
else:
raise ValueError("datetime_conversion must be an element of DatetimeConversion")

View File

@ -1,4 +1,4 @@
# Copyright 2009-2014 MongoDB, Inc.
# Copyright 2009-2015 MongoDB, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -13,135 +13,121 @@
# limitations under the License.
"""Tools for manipulating DBRefs (references to MongoDB documents)."""
from __future__ import annotations
from copy import deepcopy
from typing import Any, Mapping, Optional
from bson._helpers import _getstate_slots, _setstate_slots
from bson.son import SON
class DBRef(object):
"""A reference to a document stored in MongoDB.
"""
class DBRef:
"""A reference to a document stored in MongoDB."""
__slots__ = "__collection", "__id", "__database", "__kwargs"
__getstate__ = _getstate_slots
__setstate__ = _setstate_slots
# DBRef isn't actually a BSON "type" so this number was arbitrarily chosen.
_type_marker = 100
def __init__(self, collection, id, database=None, _extra={}, **kwargs):
def __init__(
self,
collection: str,
id: Any,
database: Optional[str] = None,
_extra: Optional[Mapping[str, Any]] = None,
**kwargs: Any,
) -> None:
"""Initialize a new :class:`DBRef`.
Raises :class:`TypeError` if `collection` or `database` is not
an instance of :class:`basestring` (:class:`str` in python 3).
`database` is optional and allows references to documents to work
across databases. Any additional keyword arguments will create
additional fields in the resultant embedded document.
an instance of :class:`str`. `database` is optional and allows
references to documents to work across databases. Any additional
keyword arguments will create additional fields in the resultant
embedded document.
:Parameters:
- `collection`: name of the collection the document is stored in
- `id`: the value of the document's ``"_id"`` field
- `database` (optional): name of the database to reference
- `**kwargs` (optional): additional keyword arguments will
:param collection: name of the collection the document is stored in
:param id: the value of the document's ``"_id"`` field
:param database: name of the database to reference
:param kwargs: additional keyword arguments will
create additional, custom fields
.. versionchanged:: 1.8
Now takes keyword arguments to specify additional fields.
.. versionadded:: 1.1.1
The `database` parameter.
.. mongodoc:: dbrefs
.. seealso:: The MongoDB documentation on `dbrefs <https://dochub.mongodb.org/core/dbrefs>`_.
"""
if not isinstance(collection, basestring):
raise TypeError("collection must be an "
"instance of %s" % (basestring.__name__,))
if database is not None and not isinstance(database, basestring):
raise TypeError("database must be an "
"instance of %s" % (basestring.__name__,))
if not isinstance(collection, str):
raise TypeError(f"collection must be an instance of str, not {type(collection)}")
if database is not None and not isinstance(database, str):
raise TypeError(f"database must be an instance of str, not {type(database)}")
self.__collection = collection
self.__id = id
self.__database = database
kwargs.update(_extra)
kwargs.update(_extra or {})
self.__kwargs = kwargs
@property
def collection(self):
"""Get the name of this DBRef's collection as unicode.
"""
def collection(self) -> str:
"""Get the name of this DBRef's collection."""
return self.__collection
@property
def id(self):
"""Get this DBRef's _id.
"""
def id(self) -> Any:
"""Get this DBRef's _id."""
return self.__id
@property
def database(self):
def database(self) -> Optional[str]:
"""Get the name of this DBRef's database.
Returns None if this DBRef doesn't specify a database.
.. versionadded:: 1.1.1
"""
return self.__database
def __getattr__(self, key):
def __getattr__(self, key: Any) -> Any:
try:
return self.__kwargs[key]
except KeyError:
raise AttributeError(key)
raise AttributeError(key) from None
# Have to provide __setstate__ to avoid
# infinite recursion since we override
# __getattr__.
def __setstate__(self, state):
self.__dict__.update(state)
def as_doc(self):
def as_doc(self) -> SON[str, Any]:
"""Get the SON document representation of this DBRef.
Generally not needed by application developers
"""
doc = SON([("$ref", self.collection),
("$id", self.id)])
doc = SON([("$ref", self.collection), ("$id", self.id)])
if self.database is not None:
doc["$db"] = self.database
doc.update(self.__kwargs)
return doc
def __repr__(self):
extra = "".join([", %s=%r" % (k, v)
for k, v in self.__kwargs.iteritems()])
def __repr__(self) -> str:
extra = "".join([f", {k}={v!r}" for k, v in self.__kwargs.items()])
if self.database is None:
return "DBRef(%r, %r%s)" % (self.collection, self.id, extra)
return "DBRef(%r, %r, %r%s)" % (self.collection, self.id,
self.database, extra)
return f"DBRef({self.collection!r}, {self.id!r}{extra})"
return f"DBRef({self.collection!r}, {self.id!r}, {self.database!r}{extra})"
def __eq__(self, other):
def __eq__(self, other: Any) -> bool:
if isinstance(other, DBRef):
us = (self.__database, self.__collection,
self.__id, self.__kwargs)
them = (other.__database, other.__collection,
other.__id, other.__kwargs)
us = (self.__database, self.__collection, self.__id, self.__kwargs)
them = (other.__database, other.__collection, other.__id, other.__kwargs)
return us == them
return NotImplemented
def __ne__(self, other):
def __ne__(self, other: Any) -> bool:
return not self == other
def __hash__(self):
"""Get a hash value for this :class:`DBRef`.
def __hash__(self) -> int:
"""Get a hash value for this :class:`DBRef`."""
return hash(
(self.__collection, self.__id, self.__database, tuple(sorted(self.__kwargs.items())))
)
.. versionadded:: 1.1
"""
return hash((self.__collection, self.__id, self.__database,
tuple(sorted(self.__kwargs.items()))))
def __deepcopy__(self, memo):
"""Support function for `copy.deepcopy()`.
.. versionadded:: 1.10
"""
return DBRef(deepcopy(self.__collection, memo),
deepcopy(self.__id, memo),
deepcopy(self.__database, memo),
deepcopy(self.__kwargs, memo))
def __deepcopy__(self, memo: Any) -> DBRef:
"""Support function for `copy.deepcopy()`."""
return DBRef(
deepcopy(self.__collection, memo),
deepcopy(self.__id, memo),
deepcopy(self.__database, memo),
deepcopy(self.__kwargs, memo),
)

351
bson/decimal128.py Normal file
View File

@ -0,0 +1,351 @@
# Copyright 2016-present MongoDB, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Tools for working with the BSON decimal128 type.
.. versionadded:: 3.4
"""
from __future__ import annotations
import decimal
import struct
from decimal import Decimal
from typing import Any, Sequence, Tuple, Type, Union
from bson.codec_options import TypeDecoder, TypeEncoder
_PACK_64 = struct.Struct("<Q").pack
_UNPACK_64 = struct.Struct("<Q").unpack
_EXPONENT_MASK = 3 << 61
_EXPONENT_BIAS = 6176
_EXPONENT_MAX = 6144
_EXPONENT_MIN = -6143
_MAX_DIGITS = 34
_INF = 0x7800000000000000
_NAN = 0x7C00000000000000
_SNAN = 0x7E00000000000000
_SIGN = 0x8000000000000000
_NINF = (_INF + _SIGN, 0)
_PINF = (_INF, 0)
_NNAN = (_NAN + _SIGN, 0)
_PNAN = (_NAN, 0)
_NSNAN = (_SNAN + _SIGN, 0)
_PSNAN = (_SNAN, 0)
_CTX_OPTIONS = {
"prec": _MAX_DIGITS,
"rounding": decimal.ROUND_HALF_EVEN,
"Emin": _EXPONENT_MIN,
"Emax": _EXPONENT_MAX,
"capitals": 1,
"flags": [],
"traps": [decimal.InvalidOperation, decimal.Overflow, decimal.Inexact],
"clamp": 1,
}
_DEC128_CTX = decimal.Context(**_CTX_OPTIONS.copy()) # type: ignore
_VALUE_OPTIONS = Union[decimal.Decimal, float, str, Tuple[int, Sequence[int], int]]
class DecimalEncoder(TypeEncoder):
"""Converts Python :class:`decimal.Decimal` to BSON :class:`Decimal128`.
For example::
opts = CodecOptions(type_registry=TypeRegistry([DecimalEncoder()]))
bson.encode({"d": decimal.Decimal('1.0')}, codec_options=opts)
.. versionadded:: 4.15
"""
@property
def python_type(self) -> Type[Decimal]:
return Decimal
def transform_python(self, value: Any) -> Decimal128:
return Decimal128(value)
class DecimalDecoder(TypeDecoder):
"""Converts BSON :class:`Decimal128` to Python :class:`decimal.Decimal`.
For example::
opts = CodecOptions(type_registry=TypeRegistry([DecimalDecoder()]))
bson.decode(data, codec_options=opts)
.. versionadded:: 4.15
"""
@property
def bson_type(self) -> Type[Decimal128]:
return Decimal128
def transform_bson(self, value: Any) -> decimal.Decimal:
return value.to_decimal()
def create_decimal128_context() -> decimal.Context:
"""Returns an instance of :class:`decimal.Context` appropriate
for working with IEEE-754 128-bit decimal floating point values.
"""
opts = _CTX_OPTIONS.copy()
opts["traps"] = []
return decimal.Context(**opts) # type: ignore
def _decimal_to_128(value: _VALUE_OPTIONS) -> Tuple[int, int]:
"""Converts a decimal.Decimal to BID (high bits, low bits).
:param value: An instance of decimal.Decimal
"""
with decimal.localcontext(_DEC128_CTX) as ctx:
value = ctx.create_decimal(value)
if value.is_infinite():
return _NINF if value.is_signed() else _PINF
sign, digits, exponent = value.as_tuple()
if value.is_nan():
if digits:
raise ValueError("NaN with debug payload is not supported")
if value.is_snan():
return _NSNAN if value.is_signed() else _PSNAN
return _NNAN if value.is_signed() else _PNAN
significand = int("".join([str(digit) for digit in digits]))
bit_length = significand.bit_length()
high = 0
low = 0
for i in range(min(64, bit_length)):
if significand & (1 << i):
low |= 1 << i
for i in range(64, bit_length):
if significand & (1 << i):
high |= 1 << (i - 64)
biased_exponent = exponent + _EXPONENT_BIAS # type: ignore[operator]
if high >> 49 == 1:
high = high & 0x7FFFFFFFFFFF
high |= _EXPONENT_MASK
high |= (biased_exponent & 0x3FFF) << 47
else:
high |= biased_exponent << 49
if sign:
high |= _SIGN
return high, low
class Decimal128:
"""BSON Decimal128 type::
>>> Decimal128(Decimal("0.0005"))
Decimal128('0.0005')
>>> Decimal128("0.0005")
Decimal128('0.0005')
>>> Decimal128((3474527112516337664, 5))
Decimal128('0.0005')
:param value: An instance of :class:`decimal.Decimal`, string, or tuple of
(high bits, low bits) from Binary Integer Decimal (BID) format.
.. note:: :class:`~Decimal128` uses an instance of :class:`decimal.Context`
configured for IEEE-754 Decimal128 when validating parameters.
Signals like :class:`decimal.InvalidOperation`, :class:`decimal.Inexact`,
and :class:`decimal.Overflow` are trapped and raised as exceptions::
>>> Decimal128(".13.1")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
...
decimal.InvalidOperation: [<class 'decimal.ConversionSyntax'>]
>>>
>>> Decimal128("1E-6177")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
...
decimal.Inexact: [<class 'decimal.Inexact'>]
>>>
>>> Decimal128("1E6145")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
...
decimal.Overflow: [<class 'decimal.Overflow'>, <class 'decimal.Rounded'>]
To ensure the result of a calculation can always be stored as BSON
Decimal128 use the context returned by
:func:`create_decimal128_context`::
>>> import decimal
>>> decimal128_ctx = create_decimal128_context()
>>> with decimal.localcontext(decimal128_ctx) as ctx:
... Decimal128(ctx.create_decimal(".13.3"))
...
Decimal128('NaN')
>>>
>>> with decimal.localcontext(decimal128_ctx) as ctx:
... Decimal128(ctx.create_decimal("1E-6177"))
...
Decimal128('0E-6176')
>>>
>>> with decimal.localcontext(DECIMAL128_CTX) as ctx:
... Decimal128(ctx.create_decimal("1E6145"))
...
Decimal128('Infinity')
To match the behavior of MongoDB's Decimal128 implementation
str(Decimal(value)) may not match str(Decimal128(value)) for NaN values::
>>> Decimal128(Decimal('NaN'))
Decimal128('NaN')
>>> Decimal128(Decimal('-NaN'))
Decimal128('NaN')
>>> Decimal128(Decimal('sNaN'))
Decimal128('NaN')
>>> Decimal128(Decimal('-sNaN'))
Decimal128('NaN')
However, :meth:`~Decimal128.to_decimal` will return the exact value::
>>> Decimal128(Decimal('NaN')).to_decimal()
Decimal('NaN')
>>> Decimal128(Decimal('-NaN')).to_decimal()
Decimal('-NaN')
>>> Decimal128(Decimal('sNaN')).to_decimal()
Decimal('sNaN')
>>> Decimal128(Decimal('-sNaN')).to_decimal()
Decimal('-sNaN')
Two instances of :class:`Decimal128` compare equal if their Binary
Integer Decimal encodings are equal::
>>> Decimal128('NaN') == Decimal128('NaN')
True
>>> Decimal128('NaN').bid == Decimal128('NaN').bid
True
This differs from :class:`decimal.Decimal` comparisons for NaN::
>>> Decimal('NaN') == Decimal('NaN')
False
"""
__slots__ = ("__high", "__low")
_type_marker = 19
def __init__(self, value: _VALUE_OPTIONS) -> None:
if isinstance(value, (str, decimal.Decimal)):
self.__high, self.__low = _decimal_to_128(value)
elif isinstance(value, (list, tuple)):
if len(value) != 2:
raise ValueError(
"Invalid size for creation of Decimal128 "
"from list or tuple. Must have exactly 2 "
"elements."
)
self.__high, self.__low = value
else:
raise TypeError(f"Cannot convert {value!r} to Decimal128")
def to_decimal(self) -> decimal.Decimal:
"""Returns an instance of :class:`decimal.Decimal` for this
:class:`Decimal128`.
"""
high = self.__high
low = self.__low
sign = 1 if (high & _SIGN) else 0
if (high & _SNAN) == _SNAN:
return decimal.Decimal((sign, (), "N")) # type: ignore
elif (high & _NAN) == _NAN:
return decimal.Decimal((sign, (), "n")) # type: ignore
elif (high & _INF) == _INF:
return decimal.Decimal((sign, (), "F")) # type: ignore
if (high & _EXPONENT_MASK) == _EXPONENT_MASK:
exponent = ((high & 0x1FFFE00000000000) >> 47) - _EXPONENT_BIAS
return decimal.Decimal((sign, (0,), exponent))
else:
exponent = ((high & 0x7FFF800000000000) >> 49) - _EXPONENT_BIAS
arr = bytearray(15)
mask = 0x00000000000000FF
for i in range(14, 6, -1):
arr[i] = (low & mask) >> ((14 - i) << 3)
mask = mask << 8
mask = 0x00000000000000FF
for i in range(6, 0, -1):
arr[i] = (high & mask) >> ((6 - i) << 3)
mask = mask << 8
mask = 0x0001000000000000
arr[0] = (high & mask) >> 48
# cdecimal only accepts a tuple for digits.
digits = tuple(int(digit) for digit in str(int.from_bytes(arr, "big")))
with decimal.localcontext(_DEC128_CTX) as ctx:
return ctx.create_decimal((sign, digits, exponent))
@classmethod
def from_bid(cls: Type[Decimal128], value: bytes) -> Decimal128:
"""Create an instance of :class:`Decimal128` from Binary Integer
Decimal string.
:param value: 16 byte string (128-bit IEEE 754-2008 decimal floating
point in Binary Integer Decimal (BID) format).
"""
if not isinstance(value, bytes):
raise TypeError(f"value must be an instance of bytes, not {type(value)}")
if len(value) != 16:
raise ValueError("value must be exactly 16 bytes")
return cls((_UNPACK_64(value[8:])[0], _UNPACK_64(value[:8])[0])) # type: ignore
@property
def bid(self) -> bytes:
"""The Binary Integer Decimal (BID) encoding of this instance."""
return _PACK_64(self.__low) + _PACK_64(self.__high)
def __str__(self) -> str:
dec = self.to_decimal()
if dec.is_nan():
# Required by the drivers spec to match MongoDB behavior.
return "NaN"
return str(dec)
def __repr__(self) -> str:
return f"Decimal128('{self!s}')"
def __setstate__(self, value: Tuple[int, int]) -> None:
self.__high, self.__low = value
def __getstate__(self) -> Tuple[int, int]:
return self.__high, self.__low
def __eq__(self, other: Any) -> bool:
if isinstance(other, Decimal128):
return self.bid == other.bid
return NotImplemented
def __ne__(self, other: Any) -> bool:
return not self == other

View File

@ -1,118 +0,0 @@
/*
* Copyright 2009-2014 MongoDB, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "encoding_helpers.h"
/*
* Portions Copyright 2001 Unicode, Inc.
*
* Disclaimer
*
* This source code is provided as is by Unicode, Inc. No claims are
* made as to fitness for any particular purpose. No warranties of any
* kind are expressed or implied. The recipient agrees to determine
* applicability of information provided. If this file has been
* purchased on magnetic or optical media from Unicode, Inc., the
* sole remedy for any claim will be exchange of defective media
* within 90 days of receipt.
*
* Limitations on Rights to Redistribute This Code
*
* Unicode, Inc. hereby grants the right to freely use the information
* supplied in this file in the creation of products supporting the
* Unicode Standard, and to make copies of this file in any form
* for internal or external distribution as long as this notice
* remains attached.
*/
/*
* Index into the table below with the first byte of a UTF-8 sequence to
* get the number of trailing bytes that are supposed to follow it.
*/
static const char trailingBytesForUTF8[256] = {
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 3,3,3,3,3,3,3,3,4,4,4,4,5,5,5,5
};
/* --------------------------------------------------------------------- */
/*
* Utility routine to tell whether a sequence of bytes is legal UTF-8.
* This must be called with the length pre-determined by the first byte.
* The length can be set by:
* length = trailingBytesForUTF8[*source]+1;
* and the sequence is illegal right away if there aren't that many bytes
* available.
* If presented with a length > 4, this returns 0. The Unicode
* definition of UTF-8 goes up to 4-byte sequences.
*/
static unsigned char isLegalUTF8(const unsigned char* source, int length) {
unsigned char a;
const unsigned char* srcptr = source + length;
switch (length) {
default: return 0;
/* Everything else falls through when "true"... */
case 4: if ((a = (*--srcptr)) < 0x80 || a > 0xBF) return 0;
case 3: if ((a = (*--srcptr)) < 0x80 || a > 0xBF) return 0;
case 2: if ((a = (*--srcptr)) > 0xBF) return 0;
switch (*source) {
/* no fall-through in this inner switch */
case 0xE0: if (a < 0xA0) return 0; break;
case 0xF0: if (a < 0x90) return 0; break;
case 0xF4: if (a > 0x8F) return 0; break;
default: if (a < 0x80) return 0;
}
case 1: if (*source >= 0x80 && *source < 0xC2) return 0;
if (*source > 0xF4) return 0;
}
return 1;
}
result_t check_string(const unsigned char* string, const int length,
const char check_utf8, const char check_null) {
int position = 0;
/* By default we go character by character. Will be different for checking
* UTF-8 */
int sequence_length = 1;
if (!check_utf8 && !check_null) {
return VALID;
}
while (position < length) {
if (check_null && *(string + position) == 0) {
return HAS_NULL;
}
if (check_utf8) {
sequence_length = trailingBytesForUTF8[*(string + position)] + 1;
if ((position + sequence_length) > length) {
return NOT_UTF_8;
}
if (!isLegalUTF8(string + position, sequence_length)) {
return NOT_UTF_8;
}
}
position += sequence_length;
}
return VALID;
}

View File

@ -1,29 +0,0 @@
/*
* Copyright 2009-2014 MongoDB, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ENCODING_HELPERS_H
#define ENCODING_HELPERS_H
typedef enum {
VALID,
NOT_UTF_8,
HAS_NULL
} result_t;
result_t check_string(const unsigned char* string, const int length,
const char check_utf8, const char check_null);
#endif

View File

@ -1,4 +1,4 @@
# Copyright 2009-2014 MongoDB, Inc.
# Copyright 2009-present MongoDB, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -13,28 +13,37 @@
# limitations under the License.
"""Exceptions raised by the BSON package."""
from __future__ import annotations
from typing import Any, Optional
class BSONError(Exception):
"""Base class for all BSON exceptions.
"""
"""Base class for all BSON exceptions."""
class InvalidBSON(BSONError):
"""Raised when trying to create a BSON object from invalid data.
"""
"""Raised when trying to create a BSON object from invalid data."""
class InvalidStringData(BSONError):
"""Raised when trying to encode a string containing non-UTF8 data.
"""
"""Raised when trying to encode a string containing non-UTF8 data."""
class InvalidDocument(BSONError):
"""Raised when trying to create a BSON object from an invalid document.
"""
"""Raised when trying to create a BSON object from an invalid document."""
def __init__(self, message: str, document: Optional[Any] = None) -> None:
super().__init__(message)
self._document = document
@property
def document(self) -> Any:
"""The invalid document that caused the error.
..versionadded:: 4.16"""
return self._document
class InvalidId(BSONError):
"""Raised when trying to create an ObjectId from invalid data.
"""
"""Raised when trying to create an ObjectId from invalid data."""

39
bson/int64.py Normal file
View File

@ -0,0 +1,39 @@
# Copyright 2014-2015 MongoDB, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""A BSON wrapper for long (int in python3)"""
from __future__ import annotations
from typing import Any
class Int64(int):
"""Representation of the BSON int64 type.
This is necessary because every integral number is an :class:`int` in
Python 3. Small integral numbers are encoded to BSON int32 by default,
but Int64 numbers will always be encoded to BSON int64.
:param value: the numeric value to represent
"""
__slots__ = ()
_type_marker = 18
def __getstate__(self) -> Any:
return {}
def __setstate__(self, state: Any) -> None:
pass

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
# Copyright 2010-2014 MongoDB, Inc.
# Copyright 2010-present MongoDB, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -12,36 +12,45 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""Representation for the MongoDB internal MaxKey type.
"""
"""Representation for the MongoDB internal MaxKey type."""
from __future__ import annotations
from typing import Any
class MaxKey(object):
"""MongoDB internal MaxKey type.
class MaxKey:
"""MongoDB internal MaxKey type."""
.. versionchanged:: 2.7
``MaxKey`` now implements comparison operators.
"""
__slots__ = ()
_type_marker = 127
def __eq__(self, other):
def __getstate__(self) -> Any:
return {}
def __setstate__(self, state: Any) -> None:
pass
def __eq__(self, other: Any) -> bool:
return isinstance(other, MaxKey)
def __ne__(self, other):
def __hash__(self) -> int:
return hash(self._type_marker)
def __ne__(self, other: Any) -> bool:
return not self == other
def __le__(self, other):
def __le__(self, other: Any) -> bool:
return isinstance(other, MaxKey)
def __lt__(self, dummy):
def __lt__(self, dummy: Any) -> bool:
return False
def __ge__(self, dummy):
def __ge__(self, dummy: Any) -> bool:
return True
def __gt__(self, other):
def __gt__(self, other: Any) -> bool:
return not isinstance(other, MaxKey)
def __repr__(self):
def __repr__(self) -> str:
return "MaxKey()"

View File

@ -1,4 +1,4 @@
# Copyright 2010-2014 MongoDB, Inc.
# Copyright 2010-present MongoDB, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -12,36 +12,45 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""Representation for the MongoDB internal MinKey type.
"""
"""Representation for the MongoDB internal MinKey type."""
from __future__ import annotations
from typing import Any
class MinKey(object):
"""MongoDB internal MinKey type.
class MinKey:
"""MongoDB internal MinKey type."""
.. versionchanged:: 2.7
``MinKey`` now implements comparison operators.
"""
__slots__ = ()
_type_marker = 255
def __eq__(self, other):
def __getstate__(self) -> Any:
return {}
def __setstate__(self, state: Any) -> None:
pass
def __eq__(self, other: Any) -> bool:
return isinstance(other, MinKey)
def __ne__(self, other):
def __hash__(self) -> int:
return hash(self._type_marker)
def __ne__(self, other: Any) -> bool:
return not self == other
def __le__(self, dummy):
def __le__(self, dummy: Any) -> bool:
return True
def __lt__(self, other):
def __lt__(self, other: Any) -> bool:
return not isinstance(other, MinKey)
def __ge__(self, other):
def __ge__(self, other: Any) -> bool:
return isinstance(other, MinKey)
def __gt__(self, dummy):
def __gt__(self, dummy: Any) -> bool:
return False
def __repr__(self):
return "MinKey()"
def __repr__(self) -> str:
return "MinKey()"

View File

@ -1,4 +1,4 @@
# Copyright 2009-2014 MongoDB, Inc.
# Copyright 2009-2015 MongoDB, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -12,87 +12,115 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""Tools for working with MongoDB `ObjectIds
<http://dochub.mongodb.org/core/objectids>`_.
"""
"""Tools for working with MongoDB ObjectIds."""
from __future__ import annotations
import binascii
import calendar
import datetime
try:
import hashlib
_md5func = hashlib.md5
except ImportError: # for Python < 2.5
import md5
_md5func = md5.new
import os
import random
import socket
import struct
import threading
import time
from random import SystemRandom
from typing import Any, NoReturn, Optional, Type, Union
from bson.datetime_ms import _datetime_to_millis
from bson.errors import InvalidId
from bson.py3compat import (PY3, b, binary_type, text_type,
bytes_from_hex, string_types)
from bson.tz_util import utc
EMPTY = b("")
ZERO = b("\x00")
def _machine_bytes():
"""Get the machine portion of an ObjectId.
"""
machine_hash = _md5func()
if PY3:
# gethostname() returns a unicode string in python 3.x
# while update() requires a byte string.
machine_hash.update(socket.gethostname().encode())
else:
# Calling encode() here will fail with non-ascii hostnames
machine_hash.update(socket.gethostname())
return machine_hash.digest()[0:3]
_MAX_COUNTER_VALUE = 0xFFFFFF
_PACK_INT = struct.Struct(">I").pack
_PACK_INT_RANDOM = struct.Struct(">I5s").pack
_UNPACK_INT = struct.Struct(">I").unpack
class ObjectId(object):
"""A MongoDB ObjectId.
"""
def _raise_invalid_id(oid: str) -> NoReturn:
raise InvalidId(
"%r is not a valid ObjectId, it must be a 12-byte input"
" or a 24-character hex string" % oid
)
_inc = random.randint(0, 0xFFFFFF)
def _random_bytes() -> bytes:
"""Get the 5-byte random field of an ObjectId."""
return os.urandom(5)
class ObjectId:
"""A MongoDB ObjectId."""
_pid = os.getpid()
_inc = SystemRandom().randint(0, _MAX_COUNTER_VALUE)
_inc_lock = threading.Lock()
_machine_bytes = _machine_bytes()
__random = _random_bytes()
__slots__ = ('__id')
__slots__ = ("__id",)
_type_marker = 7
def __init__(self, oid=None):
def __init__(self, oid: Optional[Union[str, ObjectId, bytes]] = None) -> None:
"""Initialize a new ObjectId.
If `oid` is ``None``, create a new (unique) ObjectId. If `oid`
is an instance of (:class:`basestring` (:class:`str` or :class:`bytes`
in python 3), :class:`ObjectId`) validate it and use that. Otherwise,
a :class:`TypeError` is raised. If `oid` is invalid,
:class:`~bson.errors.InvalidId` is raised.
An ObjectId is a 12-byte unique identifier consisting of:
:Parameters:
- `oid` (optional): a valid ObjectId (12 byte binary or 24 character
hex string)
- a 4-byte value representing the seconds since the Unix epoch,
- a 5-byte random value,
- a 3-byte counter, starting with a random value.
.. versionadded:: 1.2.1
The `oid` parameter can be a ``unicode`` instance (that contains
only hexadecimal digits).
By default, ``ObjectId()`` creates a new unique identifier. The
optional parameter `oid` can be an :class:`ObjectId`, or any 12
:class:`bytes`.
.. mongodoc:: objectids
For example, the 12 bytes b'foo-bar-quux' do not follow the ObjectId
specification but they are acceptable input::
>>> ObjectId(b'foo-bar-quux')
ObjectId('666f6f2d6261722d71757578')
`oid` can also be a :class:`str` of 24 hex digits::
>>> ObjectId('0123456789ab0123456789ab')
ObjectId('0123456789ab0123456789ab')
Raises :class:`~bson.errors.InvalidId` if `oid` is not 12 bytes nor
24 hex digits, or :class:`TypeError` if `oid` is not an accepted type.
:param oid: a valid ObjectId.
.. seealso:: The MongoDB documentation on `ObjectIds <http://dochub.mongodb.org/core/objectids>`_.
.. versionchanged:: 3.8
:class:`~bson.objectid.ObjectId` now implements the `ObjectID
specification version 0.2
<https://github.com/mongodb/specifications/blob/master/source/
objectid.rst>`_.
"""
if oid is None:
self.__generate()
# Generate a new value for this ObjectId.
with ObjectId._inc_lock:
inc = ObjectId._inc
ObjectId._inc = (inc + 1) % (_MAX_COUNTER_VALUE + 1)
# 4 bytes current time, 5 bytes random, 3 bytes inc.
self.__id = _PACK_INT_RANDOM(int(time.time()), ObjectId._random()) + _PACK_INT(inc)[1:4]
elif isinstance(oid, bytes) and len(oid) == 12:
self.__id = oid
elif isinstance(oid, str):
if len(oid) == 24:
try:
self.__id = bytes.fromhex(oid)
except (TypeError, ValueError):
_raise_invalid_id(oid)
else:
_raise_invalid_id(oid)
elif isinstance(oid, ObjectId):
self.__id = oid.binary
else:
self.__validate(oid)
raise TypeError(f"id must be an instance of (bytes, str, ObjectId), not {type(oid)}")
@classmethod
def from_datetime(cls, generation_time):
def from_datetime(cls: Type[ObjectId], generation_time: datetime.datetime) -> ObjectId:
"""Create a dummy ObjectId instance with a specific generation time.
This method is useful for doing range queries on a field
@ -115,123 +143,67 @@ class ObjectId(object):
>>> dummy_id = ObjectId.from_datetime(gen_time)
>>> result = collection.find({"_id": {"$lt": dummy_id}})
:Parameters:
- `generation_time`: :class:`~datetime.datetime` to be used
:param generation_time: :class:`~datetime.datetime` to be used
as the generation time for the resulting ObjectId.
.. versionchanged:: 1.8
Properly handle timezone aware values for
`generation_time`.
.. versionadded:: 1.6
"""
if generation_time.utcoffset() is not None:
generation_time = generation_time - generation_time.utcoffset()
ts = calendar.timegm(generation_time.timetuple())
oid = struct.pack(">i", int(ts)) + ZERO * 8
oid = (
_PACK_INT(_datetime_to_millis(generation_time) // 1000)
+ b"\x00\x00\x00\x00\x00\x00\x00\x00"
)
return cls(oid)
@classmethod
def is_valid(cls, oid):
def is_valid(cls: Type[ObjectId], oid: Any) -> bool:
"""Checks if a `oid` string is valid or not.
:Parameters:
- `oid`: the object id to validate
:param oid: the object id to validate
.. versionadded:: 2.3
"""
if not oid:
return False
try:
ObjectId(oid)
return True
except (InvalidId, TypeError):
return False
def __generate(self):
"""Generate a new value for this ObjectId.
"""
oid = EMPTY
# 4 bytes current time
oid += struct.pack(">i", int(time.time()))
# 3 bytes machine
oid += ObjectId._machine_bytes
# 2 bytes pid
oid += struct.pack(">H", os.getpid() % 0xFFFF)
# 3 bytes inc
ObjectId._inc_lock.acquire()
oid += struct.pack(">i", ObjectId._inc)[1:4]
ObjectId._inc = (ObjectId._inc + 1) % 0xFFFFFF
ObjectId._inc_lock.release()
self.__id = oid
def __validate(self, oid):
"""Validate and use the given id for this ObjectId.
Raises TypeError if id is not an instance of
(:class:`basestring` (:class:`str` or :class:`bytes`
in python 3), ObjectId) and InvalidId if it is not a
valid ObjectId.
:Parameters:
- `oid`: a valid ObjectId
"""
if isinstance(oid, ObjectId):
self.__id = oid.__id
elif isinstance(oid, string_types):
if len(oid) == 12:
if isinstance(oid, binary_type):
self.__id = oid
else:
raise InvalidId("%s is not a valid ObjectId" % oid)
elif len(oid) == 24:
try:
self.__id = bytes_from_hex(oid)
except (TypeError, ValueError):
raise InvalidId("%s is not a valid ObjectId" % oid)
else:
raise InvalidId("%s is not a valid ObjectId" % oid)
else:
raise TypeError("id must be an instance of (%s, %s, ObjectId), "
"not %s" % (binary_type.__name__,
text_type.__name__, type(oid)))
@classmethod
def _random(cls) -> bytes:
"""Generate a 5-byte random number once per process."""
pid = os.getpid()
if pid != cls._pid:
cls._pid = pid
cls.__random = _random_bytes()
return cls.__random
@property
def binary(self):
"""12-byte binary representation of this ObjectId.
"""
def binary(self) -> bytes:
"""12-byte binary representation of this ObjectId."""
return self.__id
@property
def generation_time(self):
def generation_time(self) -> datetime.datetime:
"""A :class:`datetime.datetime` instance representing the time of
generation for this :class:`ObjectId`.
The :class:`datetime.datetime` is timezone aware, and
represents the generation time in UTC. It is precise to the
second.
.. versionchanged:: 1.8
Now return an aware datetime instead of a naive one.
.. versionadded:: 1.2
"""
t = struct.unpack(">i", self.__id[0:4])[0]
return datetime.datetime.fromtimestamp(t, utc)
timestamp = _UNPACK_INT(self.__id[0:4])[0]
return datetime.datetime.fromtimestamp(timestamp, utc)
def __getstate__(self):
"""return value of object for pickling.
def __getstate__(self) -> bytes:
"""Return value of object for pickling.
needed explicitly because __slots__() defined.
"""
return self.__id
def __setstate__(self, value):
"""explicit state set from pickling
"""
# Provide backwards compatability with OIDs
def __setstate__(self, value: Any) -> None:
"""Explicit state set from pickling"""
# Provide backwards compatibility with OIDs
# pickled with pymongo-1.9 or older.
if isinstance(value, dict):
oid = value["_ObjectId__id"]
@ -240,52 +212,47 @@ class ObjectId(object):
# ObjectIds pickled in python 2.x used `str` for __id.
# In python 3.x this has to be converted to `bytes`
# by encoding latin-1.
if PY3 and isinstance(oid, text_type):
self.__id = oid.encode('latin-1')
if isinstance(oid, str):
self.__id = oid.encode("latin-1")
else:
self.__id = oid
def __str__(self):
if PY3:
return binascii.hexlify(self.__id).decode()
return binascii.hexlify(self.__id)
def __str__(self) -> str:
return self.__id.hex()
def __repr__(self):
return "ObjectId('%s')" % (str(self),)
def __repr__(self) -> str:
return f"ObjectId('{self!s}')"
def __eq__(self, other):
def __eq__(self, other: Any) -> bool:
if isinstance(other, ObjectId):
return self.__id == other.__id
return self.__id == other.binary
return NotImplemented
def __ne__(self, other):
def __ne__(self, other: Any) -> bool:
if isinstance(other, ObjectId):
return self.__id != other.__id
return self.__id != other.binary
return NotImplemented
def __lt__(self, other):
def __lt__(self, other: Any) -> bool:
if isinstance(other, ObjectId):
return self.__id < other.__id
return self.__id < other.binary
return NotImplemented
def __le__(self, other):
def __le__(self, other: Any) -> bool:
if isinstance(other, ObjectId):
return self.__id <= other.__id
return self.__id <= other.binary
return NotImplemented
def __gt__(self, other):
def __gt__(self, other: Any) -> bool:
if isinstance(other, ObjectId):
return self.__id > other.__id
return self.__id > other.binary
return NotImplemented
def __ge__(self, other):
def __ge__(self, other: Any) -> bool:
if isinstance(other, ObjectId):
return self.__id >= other.__id
return self.__id >= other.binary
return NotImplemented
def __hash__(self):
"""Get a hash value for this :class:`ObjectId`.
.. versionadded:: 1.1
"""
def __hash__(self) -> int:
"""Get a hash value for this :class:`ObjectId`."""
return hash(self.__id)

Some files were not shown because too many files have changed in this diff Show More