Compare commits

...

1394 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
1585 changed files with 318211 additions and 101210 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

View File

@ -1,25 +0,0 @@
[run]
branch = True
source = pymongo,bson,gridfs
[paths]
source=
.
/data/mci/*/src
[report]
exclude_lines =
if (.*and +)*_use_c( and.*)*:
def has_c
def get_version_string
^except AttributeError:
except ImportError:
raise NotImplementedError
return NotImplemented
_use_c = True
if __name__ == '__main__':
partial_branches =
if (.*and +)*not _use_c( and.*)*:
[html]
directory = htmlcov

View File

@ -1,31 +0,0 @@
#!/bin/bash -ex
# Get access to testinstall.
. .evergreen/utils.sh
# Create temp directory for validated files.
rm -rf validdist
mkdir -p validdist
mv dist/* validdist || true
VERSION=${VERSION:-3.10}
PYTHON=/Library/Frameworks/Python.framework/Versions/$VERSION/bin/python3
rm -rf build
createvirtualenv $PYTHON releasevenv
python -m pip install --upgrade wheel
python -m pip install setuptools==63.2.0
python setup.py bdist_wheel
deactivate || true
rm -rf releasevenv
# Test that each wheel is installable.
for release in dist/*; do
testinstall $PYTHON $release
mv $release validdist/
done
mv validdist/* dist
rm -rf validdist
ls dist

View File

@ -1,41 +0,0 @@
#!/bin/bash -ex
cd /src
# Get access to testinstall.
. .evergreen/utils.sh
# Create temp directory for validated files.
rm -rf validdist
mkdir -p validdist
mv dist/* validdist || true
# Compile wheels
for PYTHON in /opt/python/*/bin/python; do
if [[ ! $PYTHON =~ (cp37|cp38|cp39|cp310|cp311) ]]; then
continue
fi
# https://github.com/pypa/manylinux/issues/49
rm -rf build
$PYTHON setup.py bdist_wheel
rm -rf build
# Audit wheels and write manylinux tag
for whl in dist/*.whl; do
# Skip already built manylinux wheels.
if [[ "$whl" != *"manylinux"* ]]; then
auditwheel repair $whl -w dist
rm $whl
fi
done
# Test that each wheel is installable.
# Test without virtualenv because it's not present on manylinux containers.
for release in dist/*; do
testinstall $PYTHON $release "without-virtualenv"
mv $release validdist/
done
done
mv validdist/* dist
rm -rf validdist
ls dist

View File

@ -1,45 +0,0 @@
#!/bin/bash -ex
docker version
# manylinux1 2021-05-05-b64d921 and manylinux2014 2021-05-05-1ac6ef3 were
# the last releases to generate pip < 20.3 compatible wheels. After that
# auditwheel was upgraded to v4 which produces PEP 600 manylinux_x_y wheels
# which requires pip >= 20.3. We use the older docker image to support older
# pip versions.
BUILD_WITH_TAG="$1"
if [ -n "$BUILD_WITH_TAG" ]; then
images=(quay.io/pypa/manylinux1_x86_64:2021-05-05-b64d921 \
quay.io/pypa/manylinux1_i686:2021-05-05-b64d921 \
quay.io/pypa/manylinux2014_x86_64:2021-05-05-1ac6ef3 \
quay.io/pypa/manylinux2014_i686:2021-05-05-1ac6ef3 \
quay.io/pypa/manylinux2014_aarch64:2021-05-05-1ac6ef3 \
quay.io/pypa/manylinux2014_ppc64le:2021-05-05-1ac6ef3 \
quay.io/pypa/manylinux2014_s390x:2021-05-05-1ac6ef3)
else
images=(quay.io/pypa/manylinux1_x86_64 \
quay.io/pypa/manylinux1_i686 \
quay.io/pypa/manylinux2014_x86_64 \
quay.io/pypa/manylinux2014_i686 \
quay.io/pypa/manylinux2014_aarch64 \
quay.io/pypa/manylinux2014_ppc64le \
quay.io/pypa/manylinux2014_s390x)
fi
for image in "${images[@]}"; do
docker pull $image
docker run --rm -v "`pwd`:/src" $image /src/.evergreen/build-manylinux-internal.sh
done
ls dist
# Check for any unexpected files.
unexpected=$(find dist \! \( -iname dist -or \
-iname '*cp37*' -or \
-iname '*cp38*' -or \
-iname '*cp39*' -or \
-iname '*cp310*' -or \
-iname '*cp311*' \))
if [ -n "$unexpected" ]; then
echo "Unexpected files:" $unexpected
exit 1
fi

View File

@ -1,28 +0,0 @@
#!/bin/bash -ex
# Get access to testinstall.
. .evergreen/utils.sh
# Create temp directory for validated files.
rm -rf validdist
mkdir -p validdist
mv dist/* validdist || true
for VERSION in 37 38 39 310 311; do
_pythons=("C:/Python/Python${VERSION}/python.exe" \
"C:/Python/32/Python${VERSION}/python.exe")
for PYTHON in "${_pythons[@]}"; do
rm -rf build
$PYTHON setup.py bdist_wheel
# Test that each wheel is installable.
for release in dist/*; do
testinstall $PYTHON $release
mv $release validdist/
done
done
done
mv validdist/* dist
rm -rf validdist
ls dist

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

File diff suppressed because it is too large Load Diff

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]

View File

@ -1,19 +0,0 @@
#!/bin/bash
set -o xtrace # Write all commands first to stderr
set -o errexit # Exit the script with error if any of the commands fail
# Copy PyMongo's test certificates over driver-evergreen-tools'
cp ${PROJECT_DIRECTORY}/test/certificates/* ${DRIVERS_TOOLS}/.evergreen/x509gen/
# Replace MongoOrchestration's client certificate.
cp ${PROJECT_DIRECTORY}/test/certificates/client.pem ${MONGO_ORCHESTRATION_HOME}/lib/client.pem
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

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

@ -1,256 +0,0 @@
########################################
# 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 ourself 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
# What to do when evergreen hits the timeout (`post:` tasks are run automatically)
timeout:
- command: shell.exec
params:
script: |
ls -la
functions:
"fetch source":
# Executes git clone and applies the submitted patch, if any
- command: git.get_project
params:
directory: "src"
# Applies the subitted patch, if any
# Deprecated. Should be removed. But still needed for certain agents (ZAP)
- command: git.apply_patch
# Make an evergreen exapanstion file with dynamic values
- command: shell.exec
params:
working_dir: "src"
script: |
# Get the current unique version of this checkout
if [ "${is_patch}" = "true" ]; then
CURRENT_VERSION=$(git describe)-patch-${version_id}
else
CURRENT_VERSION=latest
fi
export DRIVERS_TOOLS="$(pwd)/../drivers-tools"
export PROJECT_DIRECTORY="$(pwd)"
# Python has cygwin path problems on Windows. Detect prospective mongo-orchestration home directory
if [ "Windows_NT" = "$OS" ]; then # Magic variable in cygwin
export DRIVERS_TOOLS=$(cygpath -m $DRIVERS_TOOLS)
export PROJECT_DIRECTORY=$(cygpath -m $PROJECT_DIRECTORY)
fi
export MONGO_ORCHESTRATION_HOME="$DRIVERS_TOOLS/.evergreen/orchestration"
export MONGODB_BINARIES="$DRIVERS_TOOLS/mongodb/bin"
export UPLOAD_BUCKET="${project}"
cat <<EOT > expansion.yml
CURRENT_VERSION: "$CURRENT_VERSION"
DRIVERS_TOOLS: "$DRIVERS_TOOLS"
MONGO_ORCHESTRATION_HOME: "$MONGO_ORCHESTRATION_HOME"
MONGODB_BINARIES: "$MONGODB_BINARIES"
UPLOAD_BUCKET: "$UPLOAD_BUCKET"
PROJECT_DIRECTORY: "$PROJECT_DIRECTORY"
PREPARE_SHELL: |
set -o errexit
set -o xtrace
export DRIVERS_TOOLS="$DRIVERS_TOOLS"
export MONGO_ORCHESTRATION_HOME="$MONGO_ORCHESTRATION_HOME"
export MONGODB_BINARIES="$MONGODB_BINARIES"
export UPLOAD_BUCKET="$UPLOAD_BUCKET"
export PROJECT_DIRECTORY="$PROJECT_DIRECTORY"
export TMPDIR="$MONGO_ORCHESTRATION_HOME/db"
export PATH="$MONGODB_BINARIES:$PATH"
export PROJECT="${project}"
EOT
# See what we've done
cat expansion.yml
# Load the expansion file to make an evergreen variable with the current unique version
- command: expansions.update
params:
file: src/expansion.yml
"prepare resources":
- command: shell.exec
params:
script: |
${PREPARE_SHELL}
rm -rf $DRIVERS_TOOLS
if [ "${project}" = "drivers-tools" ]; then
# If this was a patch build, doing a fresh clone would not actually test the patch
cp -R ${PROJECT_DIRECTORY}/ $DRIVERS_TOOLS
else
git clone https://github.com/mongodb-labs/drivers-evergreen-tools.git $DRIVERS_TOOLS
fi
echo "{ \"releases\": { \"default\": \"$MONGODB_BINARIES\" }}" > $MONGO_ORCHESTRATION_HOME/orchestration.config
"bootstrap mongo-orchestration":
- command: shell.exec
params:
script: |
${PREPARE_SHELL}
MONGODB_VERSION=${VERSION} TOPOLOGY=${TOPOLOGY} AUTH=${AUTH} SSL=${SSL} STORAGE_ENGINE=${STORAGE_ENGINE} bash ${DRIVERS_TOOLS}/.evergreen/run-orchestration.sh
# run-orchestration generates expansion file with the MONGODB_URI for the cluster
- command: expansions.update
params:
file: mo-expansion.yml
"stop mongo-orchestration":
- command: shell.exec
params:
script: |
${PREPARE_SHELL}
bash ${DRIVERS_TOOLS}/.evergreen/stop-orchestration.sh
"run perf tests":
- command: shell.exec
type: test
params:
working_dir: "src"
script: |
${PREPARE_SHELL}
PROJECT_DIRECTORY=${PROJECT_DIRECTORY} bash ${PROJECT_DIRECTORY}/.evergreen/run-perf-tests.sh
"attach benchmark test results":
- command: attach.results
params:
file_location: src/report.json
"send dashboard data":
- command: perf.send
params:
file: src/results.json
"cleanup":
- command: shell.exec
params:
script: |
${PREPARE_SHELL}
rm -rf $DRIVERS_TOOLS || true
"fix absolute paths":
- command: shell.exec
params:
script: |
${PREPARE_SHELL}
for filename in $(find ${DRIVERS_TOOLS} -name \*.json); do
perl -p -i -e "s|ABSOLUTE_PATH_REPLACEMENT_TOKEN|${DRIVERS_TOOLS}|g" $filename
done
"windows fix":
- command: shell.exec
params:
script: |
${PREPARE_SHELL}
for i in $(find ${DRIVERS_TOOLS}/.evergreen ${PROJECT_DIRECTORY}/.evergreen -name \*.sh); do
cat $i | tr -d '\r' > $i.new
mv $i.new $i
done
# Copy client certificate because symlinks do not work on Windows.
cp ${DRIVERS_TOOLS}/.evergreen/x509gen/client.pem ${MONGO_ORCHESTRATION_HOME}/lib/client.pem
"make files executable":
- command: shell.exec
params:
script: |
${PREPARE_SHELL}
for i in $(find ${DRIVERS_TOOLS}/.evergreen ${PROJECT_DIRECTORY}/.evergreen -name \*.sh); do
chmod +x $i
done
"install dependencies":
- command: shell.exec
params:
working_dir: "src"
script: |
${PREPARE_SHELL}
file="${PROJECT_DIRECTORY}/.evergreen/install-dependencies.sh"
# Don't use ${file} syntax here because evergreen treats it as an empty expansion.
[ -f "$file" ] && bash $file || echo "$file not available, skipping"
pre:
- func: "fetch source"
- func: "prepare resources"
# We don't run perf on Windows (yet)
#- func: "windows fix"
- func: "fix absolute paths"
- func: "make files executable"
# We're not testing with TLS (yet)
#- func: "install dependencies"
post:
- func: "stop mongo-orchestration"
- func: "cleanup"
tasks:
- name: "perf-3.6-standalone"
tags: ["perf"]
commands:
- func: "bootstrap mongo-orchestration"
vars:
VERSION: "3.6"
TOPOLOGY: "server"
- func: "run perf tests"
- func: "attach benchmark test results"
- func: "send dashboard data"
- name: "perf-4.0-standalone"
tags: ["perf"]
commands:
- func: "bootstrap mongo-orchestration"
vars:
VERSION: "4.0"
TOPOLOGY: "server"
- func: "run perf tests"
- func: "attach benchmark test results"
- func: "send dashboard data"
- name: "perf-4.2-standalone"
tags: ["perf"]
commands:
- func: "bootstrap mongo-orchestration"
vars:
VERSION: "4.2"
TOPOLOGY: "server"
- func: "run perf tests"
- func: "attach benchmark test results"
- func: "send dashboard data"
- name: "perf-4.4-standalone"
tags: ["perf"]
commands:
- func: "bootstrap mongo-orchestration"
vars:
VERSION: "4.4"
TOPOLOGY: "server"
- func: "run perf tests"
- func: "attach benchmark test results"
- func: "send dashboard data"
buildvariants:
- name: "perf-tests"
display_name: "Performance Benchmark Tests"
batchtime: 10080 # 7 days
run_on: centos6-perf
tasks:
- name: "perf-3.6-standalone"
- name: "perf-4.0-standalone"
- name: "perf-4.2-standalone"
- name: "perf-4.4-standalone"

View File

@ -1,9 +0,0 @@
#!/bin/bash -ex
if [ "$(uname -s)" = "Darwin" ]; then
.evergreen/build-mac.sh
elif [ "Windows_NT" = "$OS" ]; then # Magic variable in cygwin
.evergreen/build-windows.sh
else
.evergreen/build-manylinux.sh
fi

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"

View File

@ -1,6 +1,6 @@
#!/bin/bash
# exit when any command fails
set -e
# Resync test files from the specifications repo.
set -eu
PYMONGO=$(dirname "$(cd "$(dirname "$0")"; pwd)")
SPECS=${MDB_SPECS:-~/Work/specifications}
@ -39,15 +39,18 @@ while getopts 'b:c:s:' flag; do
done
shift $((OPTIND-1))
if [ -z $BRANCH ]
if [ -n "$BRANCH" ]
then
git -C $SPECS checkout $BRANCH
fi
# Ensure the JSON files are up to date.
cd $SPECS/source
make
cd -
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.
@ -56,7 +59,7 @@ cpjson () {
cd "$SPECS"/source/$1
find . -name '*.json' | grep -Ev "${BLOCKLIST}" | cpio -pdm \
$PYMONGO/test/$2
printf "\nIgnored files for ${PWD}\n"
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' )"
@ -70,8 +73,11 @@ for spec in "$@"
do
# Match the spec dir name, the python test dir name, and/or common abbreviations.
case "$spec" in
atlas-data-lake-testing|data_lake)
cpjson atlas-data-lake-testing/tests/ data_lake
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
@ -88,6 +94,9 @@ do
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
@ -95,13 +104,26 @@ do
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 cmap
rm $PYMONGO/test/cmap/wait-queue-fairness.json # PYTHON-1873
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
;;
@ -111,18 +133,30 @@ do
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
@ -142,6 +176,11 @@ do
;;
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
@ -149,7 +188,6 @@ do
transactions|transactions-convenient-api)
cpjson transactions/tests/ transactions
cpjson transactions-convenient-api/tests/ transactions-convenient-api
rm $PYMONGO/test/transactions/legacy/errors-client.json # PYTHON-1894
;;
unified|unified-test-format)
cpjson unified-test-format/tests/ unified-test-format/

View File

@ -1,25 +0,0 @@
#!/bin/bash
# Exit on error and enable trace.
set -o errexit
set -o xtrace
if [ -z "$PYTHON_BINARY" ]; then
echo "No python binary specified"
PYTHON_BINARY=$(command -v python3) || true
if [ -z "$PYTHON_BINARY" ]; then
echo "Cannot test without python3 installed!"
exit 1
fi
fi
. .evergreen/utils.sh
createvirtualenv $PYTHON_BINARY atlastest
trap "deactivate; rm -rf atlastest" EXIT HUP
echo "Running tests without dnspython"
python test/atlas/test_connection.py
python -m pip install dnspython
echo "Running tests with dnspython"
MUST_TEST_SRV="1" python test/atlas/test_connection.py

View File

@ -1,7 +0,0 @@
#!/bin/bash
set -o xtrace
set -o errexit
${PYTHON_BINARY} setup.py clean
${PYTHON_BINARY} setup.py doc -t

View File

@ -1,32 +0,0 @@
#!/bin/bash
# Don't trace to avoid secrets showing up in the logs
set -o errexit
echo "Running enterprise authentication tests"
export DB_USER="bob"
export DB_PASSWORD="pwd123"
if [ "Windows_NT" = "$OS" ]; then
echo "Setting GSSAPI_PASS"
export GSSAPI_PASS=${SASL_PASS}
export GSSAPI_CANONICALIZE="true"
else
# BUILD-3830
touch ${PROJECT_DIRECTORY}/.evergreen/krb5.conf.empty
export KRB5_CONFIG=${PROJECT_DIRECTORY}/.evergreen/krb5.conf.empty
echo "Writing keytab"
echo ${KEYTAB_BASE64} | base64 -d > ${PROJECT_DIRECTORY}/.evergreen/drivers.keytab
echo "Running kinit"
kinit -k -t ${PROJECT_DIRECTORY}/.evergreen/drivers.keytab -p ${PRINCIPAL}
fi
echo "Setting GSSAPI variables"
export GSSAPI_HOST=${SASL_HOST}
export GSSAPI_PORT=${SASL_PORT}
export GSSAPI_PRINCIPAL=${PRINCIPAL}
echo "Running tests"
${PYTHON_BINARY} setup.py clean
${PYTHON_BINARY} setup.py test --xunit-output=xunit-results

View File

@ -1,18 +0,0 @@
#!/bin/bash
# Must be run from pymongo repo root
set -o xtrace
set -o errexit
. .evergreen/utils.sh
${PYTHON_BINARY} setup.py clean
createvirtualenv ${PYTHON_BINARY} mockuptests
trap "deactivate; rm -rf mockuptests" EXIT HUP
# Install PyMongo from git clone so mockup-tests don't
# download it from pypi.
python -m pip install .
python -m pip install --upgrade 'https://github.com/ajdavis/mongo-mockup-db/archive/master.zip'
cd ./test/mockupdb
python -m unittest discover -v

View File

@ -1,42 +0,0 @@
#!/bin/bash
set -o xtrace
set -o errexit
APACHE=$(command -v apache2 || command -v /usr/lib/apache2/mpm-prefork/apache2) || true
if [ -n "$APACHE" ]; then
APACHE_CONFIG=apache24ubuntu161404.conf
else
APACHE=$(command -v httpd) || true
if [ -z "$APACHE" ]; then
echo "Could not find apache2 binary"
exit 1
else
APACHE_CONFIG=apache22amazon.conf
fi
fi
PYTHON_VERSION=$(${PYTHON_BINARY} -c "import sys; sys.stdout.write('.'.join(str(val) for val in sys.version_info[:2]))")
export MOD_WSGI_SO=/opt/python/mod_wsgi/python_version/$PYTHON_VERSION/mod_wsgi_version/$MOD_WSGI_VERSION/mod_wsgi.so
export PYTHONHOME=/opt/python/$PYTHON_VERSION
cd ..
$APACHE -k start -f ${PROJECT_DIRECTORY}/test/mod_wsgi_test/${APACHE_CONFIG}
trap '$APACHE -k stop -f ${PROJECT_DIRECTORY}/test/mod_wsgi_test/${APACHE_CONFIG}' EXIT HUP
set +e
wget -t 1 -T 10 -O - "http://localhost:8080${PROJECT_DIRECTORY}"
STATUS=$?
set -e
# Debug
cat error_log
if [ $STATUS != 0 ]; then
exit $STATUS
fi
${PYTHON_BINARY} ${PROJECT_DIRECTORY}/test/mod_wsgi_test/test_client.py -n 25000 -t 100 parallel http://localhost:8080${PROJECT_DIRECTORY}
${PYTHON_BINARY} ${PROJECT_DIRECTORY}/test/mod_wsgi_test/test_client.py -n 25000 serial http://localhost:8080${PROJECT_DIRECTORY}

View File

@ -1,7 +1,6 @@
#!/bin/bash
# Don't trace since the URI contains a password that shouldn't show up in the logs
set -o errexit # Exit the script with error if any of the commands fail
# Script run on an ECS host to test MONGODB-AWS.
set -eu
############################################
# Main Program #
@ -20,18 +19,14 @@ fi
# Now we can safely enable xtrace
set -o xtrace
# Install python3.7 with pip.
apt-get update
apt install python3.7 python3-pip -y
# Install a c compiler.
apt-get -qq update < /dev/null > /dev/null
apt-get -q install -y build-essential
authtest () {
echo "Running MONGODB-AWS ECS authentication tests with $PYTHON"
$PYTHON --version
$PYTHON -m pip install --upgrade wheel setuptools pip
cd src
$PYTHON -m pip install '.[aws]'
$PYTHON test/auth_aws/test_auth_aws.py -v
cd -
}
PYTHON="python3.7" authtest
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

@ -1,75 +0,0 @@
#!/bin/bash
set -o xtrace
set -o errexit # Exit the script with error if any of the commands fail
############################################
# Main Program #
############################################
# Supported/used environment variables:
# MONGODB_URI Set the URI, including an optional username/password to use
# to connect to the server via MONGODB-AWS authentication
# mechanism.
# PYTHON_BINARY The Python version to use.
echo "Running MONGODB-AWS authentication tests"
# ensure no secrets are printed in log files
set +x
# load the script
shopt -s expand_aliases # needed for `urlencode` alias
[ -s "${PROJECT_DIRECTORY}/prepare_mongodb_aws.sh" ] && source "${PROJECT_DIRECTORY}/prepare_mongodb_aws.sh"
MONGODB_URI=${MONGODB_URI:-"mongodb://localhost"}
MONGODB_URI="${MONGODB_URI}/aws?authMechanism=MONGODB-AWS"
if [[ -n ${SESSION_TOKEN} ]]; then
MONGODB_URI="${MONGODB_URI}&authMechanismProperties=AWS_SESSION_TOKEN:${SESSION_TOKEN}"
fi
export MONGODB_URI="$MONGODB_URI"
if [ "$ASSERT_NO_URI_CREDS" = "true" ]; then
if echo "$MONGODB_URI" | grep -q "@"; then
echo "MONGODB_URI unexpectedly contains user credentials!";
exit 1
fi
fi
# show test output
set -x
# Workaround macOS python 3.9 incompatibility with system virtualenv.
if [ "$(uname -s)" = "Darwin" ]; then
VIRTUALENV="/Library/Frameworks/Python.framework/Versions/3.9/bin/python3 -m virtualenv"
else
VIRTUALENV=$(command -v virtualenv)
fi
authtest () {
if [ "Windows_NT" = "$OS" ]; then
PYTHON=$(cygpath -m $PYTHON)
fi
echo "Running MONGODB-AWS authentication tests with $PYTHON"
$PYTHON --version
$VIRTUALENV -p $PYTHON --never-download venvaws
if [ "Windows_NT" = "$OS" ]; then
. venvaws/Scripts/activate
else
. venvaws/bin/activate
fi
python -m pip install '.[aws]'
python test/auth_aws/test_auth_aws.py -v
deactivate
rm -rf venvaws
}
PYTHON=${PYTHON_BINARY:-}
if [ -z "$PYTHON" ]; then
echo "Cannot test without specifying PYTHON_BINARY"
exit 1
fi
authtest

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."

View File

@ -1,25 +0,0 @@
#!/bin/bash
set -o xtrace
set -o errexit
# For createvirtualenv.
. .evergreen/utils.sh
if [ -z "$PYTHON_BINARY" ]; then
echo "No python binary specified"
PYTHON=$(command -v python3) || true
if [ -z "$PYTHON" ]; then
echo "Cannot test without python3 installed!"
exit 1
fi
else
PYTHON="$PYTHON_BINARY"
fi
createvirtualenv $PYTHON ocsptest
trap "deactivate; rm -rf ocsptest" EXIT HUP
python -m pip install --prefer-binary pyopenssl requests service_identity
OCSP_TLS_SHOULD_SUCCEED=${OCSP_TLS_SHOULD_SUCCEED} CA_FILE=${CA_FILE} python test/ocsp/test_ocsp.py

View File

@ -1,33 +0,0 @@
#!/bin/bash
set -o xtrace
set -o errexit
git clone https://github.com/mongodb-labs/driver-performance-test-data.git
cd driver-performance-test-data
tar xf extended_bson.tgz
tar xf parallel.tgz
tar xf single_and_multi_document.tgz
cd ..
export TEST_PATH="${PROJECT_DIRECTORY}/driver-performance-test-data"
export OUTPUT_FILE="${PROJECT_DIRECTORY}/results.json"
MTCBIN=/opt/mongodbtoolchain/v3/bin
VIRTUALENV="$MTCBIN/virtualenv -p $MTCBIN/python3"
$VIRTUALENV pyperftest
. pyperftest/bin/activate
python -m pip install simplejson
python setup.py build_ext -i
start_time=$(date +%s)
python test/performance/perf_test.py --locals
end_time=$(date +%s)
elapsed_secs=$((end_time-start_time))
cat results.json
echo "{\"failures\": 0, \"results\": [{\"status\": \"pass\", \"exit_code\": 0, \"test_file\": \"BenchMarkTests\", \"start\": $start_time, \"end\": $end_time, \"elapsed\": $elapsed_secs}]}" > report.json
cat report.json

View File

@ -1,238 +1,45 @@
#!/bin/bash
set -o errexit # Exit the script with error if any of the commands fail
# Run a test suite that was configured with setup-tests.sh.
set -eu
# Supported/used environment variables:
# SET_XTRACE_ON Set to non-empty to write all commands first to stderr.
# AUTH Set to enable authentication. Defaults to "noauth"
# SSL Set to enable SSL. Defaults to "nossl"
# PYTHON_BINARY The Python version to use. Defaults to whatever is available
# GREEN_FRAMEWORK The green framework to test with, if any.
# C_EXTENSIONS Pass --no_ext to setup.py, or not.
# COVERAGE If non-empty, run the test suite with coverage.
# TEST_ENCRYPTION If non-empty, install pymongocrypt.
# LIBMONGOCRYPT_URL The URL to download libmongocrypt.
# TEST_CRYPT_SHARED If non-empty, install crypt_shared lib.
SCRIPT_DIR=$(dirname ${BASH_SOURCE:-$0})
SCRIPT_DIR="$( cd -- "$SCRIPT_DIR" > /dev/null 2>&1 && pwd )"
ROOT_DIR="$(dirname $SCRIPT_DIR)"
if [ -n "${SET_XTRACE_ON}" ]; then
set -o xtrace
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
set +x
echo "Not sourcing env inputs"
fi
AUTH=${AUTH:-noauth}
SSL=${SSL:-nossl}
PYTHON_BINARY=${PYTHON_BINARY:-}
GREEN_FRAMEWORK=${GREEN_FRAMEWORK:-}
C_EXTENSIONS=${C_EXTENSIONS:-}
COVERAGE=${COVERAGE:-}
COMPRESSORS=${COMPRESSORS:-}
MONGODB_VERSION=${MONGODB_VERSION:-}
MONGODB_API_VERSION=${MONGODB_API_VERSION:-}
TEST_ENCRYPTION=${TEST_ENCRYPTION:-}
CRYPT_SHARED_LIB_PATH=${CRYPT_SHARED_LIB_PATH:-}
LIBMONGOCRYPT_URL=${LIBMONGOCRYPT_URL:-}
DATA_LAKE=${DATA_LAKE:-}
TEST_ARGS=""
if [ -n "$COMPRESSORS" ]; then
export COMPRESSORS=$COMPRESSORS
fi
if [ -n "$MONGODB_API_VERSION" ]; then
export MONGODB_API_VERSION=$MONGODB_API_VERSION
fi
if [ "$AUTH" != "noauth" ]; then
if [ ! -z "$DATA_LAKE" ]; then
export DB_USER="mhuser"
export DB_PASSWORD="pencil"
elif [ ! -z "$TEST_SERVERLESS" ]; then
export DB_USER=$SERVERLESS_ATLAS_USER
export DB_PASSWORD=$SERVERLESS_ATLAS_PASSWORD
else
export DB_USER="bob"
export DB_PASSWORD="pwd123"
fi
fi
if [ "$SSL" != "nossl" ]; then
export CLIENT_PEM="$DRIVERS_TOOLS/.evergreen/x509gen/client.pem"
export CA_PEM="$DRIVERS_TOOLS/.evergreen/x509gen/ca.pem"
if [ -n "$TEST_LOADBALANCER" ]; then
export SINGLE_MONGOS_LB_URI="${SINGLE_MONGOS_LB_URI}&tls=true"
export MULTI_MONGOS_LB_URI="${MULTI_MONGOS_LB_URI}&tls=true"
fi
fi
# For createvirtualenv.
. .evergreen/utils.sh
if [ -z "$PYTHON_BINARY" ]; then
# Use Python 3 from the server toolchain to test on ARM, POWER or zSeries if a
# system python3 doesn't exist or exists but is older than 3.7.
if is_python_37 "$(command -v python3)"; then
PYTHON=$(command -v python3)
elif is_python_37 "$(command -v /opt/mongodbtoolchain/v3/bin/python3)"; then
PYTHON=$(command -v /opt/mongodbtoolchain/v3/bin/python3)
else
echo "Cannot test without python3.7+ installed!"
fi
elif [ "$COMPRESSORS" = "snappy" ]; then
createvirtualenv $PYTHON_BINARY snappytest
trap "deactivate; rm -rf snappytest" EXIT HUP
python -m pip install python-snappy
PYTHON=python
elif [ "$COMPRESSORS" = "zstd" ]; then
createvirtualenv $PYTHON_BINARY zstdtest
trap "deactivate; rm -rf zstdtest" EXIT HUP
python -m pip install zstandard
PYTHON=python
# Handle test inputs.
if [ -f $SCRIPT_DIR/scripts/test-env.sh ]; then
echo "Sourcing test inputs"
. $SCRIPT_DIR/scripts/test-env.sh
else
PYTHON="$PYTHON_BINARY"
echo "Missing test inputs, please run 'just setup-tests'"
exit 1
fi
# PyOpenSSL test setup.
if [ -n "$TEST_PYOPENSSL" ]; then
createvirtualenv $PYTHON pyopenssltest
trap "deactivate; rm -rf pyopenssltest" EXIT HUP
PYTHON=python
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
}
python -m pip install --prefer-binary pyopenssl requests service_identity
fi
trap "cleanup_tests" SIGINT ERR
if [ -n "$TEST_ENCRYPTION" ] || [ -n "$TEST_FLE_AZURE_AUTO" ] || [ -n "$TEST_FLE_GCP_AUTO" ]; then
# 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."
createvirtualenv $PYTHON venv-encryption
trap "deactivate; rm -rf venv-encryption" EXIT HUP
PYTHON=python
if [ "Windows_NT" = "$OS" ]; then # Magic variable in cygwin
# PYTHON-2808 Ensure this machine has the CA cert for google KMS.
powershell.exe "Invoke-WebRequest -URI https://oauth2.googleapis.com/" > /dev/null || true
fi
if [ -z "$LIBMONGOCRYPT_URL" ]; then
echo "Cannot test client side encryption without LIBMONGOCRYPT_URL!"
exit 1
fi
curl -O "$LIBMONGOCRYPT_URL"
mkdir libmongocrypt
tar xzf libmongocrypt.tar.gz -C ./libmongocrypt
ls -la libmongocrypt
ls -la libmongocrypt/nocrypto
# Use the nocrypto build to avoid dependency issues with older windows/python versions.
BASE=$(pwd)/libmongocrypt/nocrypto
if [ -f "${BASE}/lib/libmongocrypt.so" ]; then
PYMONGOCRYPT_LIB=${BASE}/lib/libmongocrypt.so
elif [ -f "${BASE}/lib/libmongocrypt.dylib" ]; then
PYMONGOCRYPT_LIB=${BASE}/lib/libmongocrypt.dylib
elif [ -f "${BASE}/bin/mongocrypt.dll" ]; then
PYMONGOCRYPT_LIB=${BASE}/bin/mongocrypt.dll
# libmongocrypt's windows dll is not marked executable.
chmod +x $PYMONGOCRYPT_LIB
PYMONGOCRYPT_LIB=$(cygpath -m $PYMONGOCRYPT_LIB)
elif [ -f "${BASE}/lib64/libmongocrypt.so" ]; then
PYMONGOCRYPT_LIB=${BASE}/lib64/libmongocrypt.so
else
echo "Cannot find libmongocrypt shared object file"
exit 1
fi
export PYMONGOCRYPT_LIB
# TODO: Test with 'pip install pymongocrypt'
git clone https://github.com/mongodb/libmongocrypt.git libmongocrypt_git
python -m pip install --prefer-binary -r .evergreen/test-encryption-requirements.txt
python -m pip install ./libmongocrypt_git/bindings/python
python -c "import pymongocrypt; print('pymongocrypt version: '+pymongocrypt.__version__)"
python -c "import pymongocrypt; print('libmongocrypt version: '+pymongocrypt.libmongocrypt_version())"
# PATH is updated by PREPARE_SHELL for access to mongocryptd.
fi
if [ -n "$TEST_ENCRYPTION" ]; then
# Need aws dependency for On-Demand KMS Credentials.
python -m pip install '.[aws]'
# Get access to the AWS temporary credentials:
# CSFLE_AWS_TEMP_ACCESS_KEY_ID, CSFLE_AWS_TEMP_SECRET_ACCESS_KEY, CSFLE_AWS_TEMP_SESSION_TOKEN
. $DRIVERS_TOOLS/.evergreen/csfle/set-temp-creds.sh
if [ -n "$TEST_CRYPT_SHARED" ]; then
CRYPT_SHARED_DIR=`dirname $CRYPT_SHARED_LIB_PATH`
echo "using crypt_shared_dir $CRYPT_SHARED_DIR"
export DYLD_FALLBACK_LIBRARY_PATH=$CRYPT_SHARED_DIR:$DYLD_FALLBACK_LIBRARY_PATH
export LD_LIBRARY_PATH=$CRYPT_SHARED_DIR:$LD_LIBRARY_PATH
export PATH=$CRYPT_SHARED_DIR:$PATH
fi
# Only run the encryption tests.
TEST_ARGS="-s test.test_encryption"
fi
if [ -n "$TEST_FLE_AZURE_AUTO" ] || [ -n "$TEST_FLE_GCP_AUTO" ]; then
if [[ -z "$SUCCESS" ]]; then
echo "Must define SUCCESS"
exit 1
fi
if echo "$MONGODB_URI" | grep -q "@"; then
echo "MONGODB_URI unexpectedly contains user credentials in FLE test!";
exit 1
fi
TEST_ARGS="-s test.test_on_demand_csfle"
fi
if [ -n "$DATA_LAKE" ]; then
TEST_ARGS="-s test.test_data_lake"
fi
# Don't download unittest-xml-reporting from pypi, which often fails.
if $PYTHON -c "import xmlrunner"; then
# The xunit output dir must be a Python style absolute path.
XUNIT_DIR="$(pwd)/xunit-results"
if [ "Windows_NT" = "$OS" ]; then # Magic variable in cygwin
XUNIT_DIR=$(cygpath -m $XUNIT_DIR)
fi
OUTPUT="--xunit-output=${XUNIT_DIR}"
else
OUTPUT=""
fi
echo "Running $AUTH tests over $SSL with python $PYTHON"
$PYTHON -c 'import sys; print(sys.version)'
# Run the tests, and store the results in Evergreen compatible XUnit XML
# files in the xunit-results/ directory.
# Run the tests with coverage if requested and coverage is installed.
# Only cover CPython. PyPy reports suspiciously low coverage.
PYTHON_IMPL=$($PYTHON -c "import platform; print(platform.python_implementation())")
COVERAGE_ARGS=""
if [ -n "$COVERAGE" ] && [ "$PYTHON_IMPL" = "CPython" ]; then
if $PYTHON -m coverage --version; then
echo "INFO: coverage is installed, running tests with coverage..."
COVERAGE_ARGS="-m coverage run --branch"
else
echo "INFO: coverage is not installed, running tests without coverage..."
fi
fi
$PYTHON setup.py clean
if [ -z "$GREEN_FRAMEWORK" ]; then
if [ -z "$C_EXTENSIONS" ] && [ "$PYTHON_IMPL" = "CPython" ]; then
# Fail if the C extensions fail to build.
# This always sets 0 for exit status, even if the build fails, due
# to our hack to install PyMongo without C extensions when build
# deps aren't available.
$PYTHON setup.py build_ext -i
# This will set a non-zero exit status if either import fails,
# causing this script to exit.
$PYTHON -c "from bson import _cbson; from pymongo import _cmessage"
fi
$PYTHON $COVERAGE_ARGS setup.py $C_EXTENSIONS test $TEST_ARGS $OUTPUT
else
# --no_ext has to come before "test" so there is no way to toggle extensions here.
$PYTHON green_framework_test.py $GREEN_FRAMEWORK $OUTPUT
fi
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."

View File

@ -1,4 +0,0 @@
cffi>=1.12.0,<2
cryptography>=2
# boto3 is required by drivers-evergreen-tools/.evergreen/csfle/set-temp-creds.sh
boto3<2

View File

@ -1,76 +0,0 @@
#!/bin/bash -ex
set -o xtrace
# Usage:
# createvirtualenv /path/to/python /output/path/for/venv
# * param1: Python binary to use for the virtualenv
# * param2: Path to the virtualenv to create
createvirtualenv () {
PYTHON=$1
VENVPATH=$2
if $PYTHON -m virtualenv --version; then
VIRTUALENV="$PYTHON -m virtualenv"
elif $PYTHON -m venv -h>/dev/null; then
# System virtualenv might not be compatible with the python3 on our path
VIRTUALENV="$PYTHON -m venv"
else
echo "Cannot test without virtualenv"
exit 1
fi
# Workaround for bug in older versions of virtualenv.
$VIRTUALENV $VENVPATH || $PYTHON -m venv $VENVPATH
if [ "Windows_NT" = "$OS" ]; then
# Workaround https://bugs.python.org/issue32451:
# mongovenv/Scripts/activate: line 3: $'\r': command not found
dos2unix $VENVPATH/Scripts/activate || true
. $VENVPATH/Scripts/activate
else
. $VENVPATH/bin/activate
fi
python -m pip install --upgrade pip
python -m pip install --upgrade setuptools wheel
}
# Usage:
# testinstall /path/to/python /path/to/.whl ["no-virtualenv"]
# * param1: Python binary to test
# * param2: Path to the wheel to install
# * param3 (optional): If set to a non-empty string, don't create a virtualenv. Used in manylinux containers.
testinstall () {
PYTHON=$1
RELEASE=$2
NO_VIRTUALENV=$3
if [ -z "$NO_VIRTUALENV" ]; then
createvirtualenv $PYTHON venvtestinstall
PYTHON=python
fi
$PYTHON -m pip install --upgrade $RELEASE
cd tools
$PYTHON fail_if_no_c.py
$PYTHON -m pip uninstall -y pymongo
cd ..
if [ -z "$NO_VIRTUALENV" ]; then
deactivate
rm -rf venvtestinstall
fi
}
# Function that returns success if the provided Python binary is version 3.7 or later
# Usage:
# is_python_37 /path/to/python
# * param1: Python binary
is_python_37() {
if [ -z "$1" ]; then
return 1
elif $1 -c "import sys; exit(sys.version_info[:2] < (3, 7))"; then
# runs when sys.version_info[:2] >= (3, 7)
return 0
else
return 1
fi
}

30
.flake8
View File

@ -1,30 +0,0 @@
[flake8]
max-line-length = 100
enable-extensions = G
extend-ignore =
G200, G202,
# black adds spaces around ':'
E203,
# E501 line too long (let black handle line length)
E501
# B305 `.next()` is not a thing on Python 3
B305
per-file-ignores =
# E402 module level import not at top of file
pymongo/__init__.py: E402
# G004 Logging statement uses f-string
pymongo/event_loggers.py: G004
# E402 module level import not at top of file
# B011 Do not call assert False since python -O removes these calls
# F405 'Foo' may be undefined, or defined from star imports
# E741 ambiguous variable name
# B007 Loop control variable 'foo' not used within the loop body
# F403 'from foo import *' used; unable to detect undefined names
# B001 Do not use bare `except:`
# E722 do not use bare 'except'
# E731 do not assign a lambda expression, use a def
# F811 redefinition of unused 'foo' from line XXX
# F841 local variable 'foo' is assigned to but never used
test/*: E402, B011, F405, E741, B007, F403, B001, E722, E731, F811, F841

View File

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

3
.github/CODEOWNERS vendored
View File

@ -1,2 +1 @@
# Global owner for repo
* @blink1073 @juliusgeo @ShaneHarvey
* @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

View File

@ -2,98 +2,310 @@ 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:
pre-commit:
name: pre-commit
static:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: pre-commit/action@v2.0.0
- uses: actions/checkout@v6
with:
extra_args: --all-files --hook-stage=manual
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:
# supercharge/mongodb-github-action requires containers so we don't test other platforms
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04]
python-version: ["3.7", "3.10", "pypy-3.8"]
# 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@v2
- name: Setup Python
uses: actions/setup-python@v2
- 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 }}
cache: 'pip'
cache-dependency-path: 'setup.py'
- name: Start MongoDB
uses: supercharge/mongodb-github-action@1.7.0
- id: setup-mongodb
uses: mongodb-labs/drivers-evergreen-tools@master
with:
mongodb-version: 4.4
version: "${{ matrix.mongodb-version }}"
- name: Run tests
run: |
python setup.py test
run: uv run --extra test pytest -v
mypytest:
name: Run mypy
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-version: ['3.7', '3.10']
fail-fast: false
python: ["3.10", "3.11"]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
- uses: actions/checkout@v6
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: 'setup.py'
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: |
python -m pip install -U pip mypy==0.990
pip install -e ".[zstd, encryption, ocsp]"
- name: Run mypy
just install
- name: Run typecheck
run: |
mypy --install-types --non-interactive bson gridfs tools pymongo
# Test overshadowed codec_options.py file
mypy --install-types --non-interactive bson/codec_options.py
mypy --install-types --non-interactive --disable-error-code var-annotated --disable-error-code attr-defined --disable-error-code union-attr --disable-error-code assignment --disable-error-code no-redef --disable-error-code index --allow-redefinition --allow-untyped-globals --exclude "test/mypy_fails/*.*" test
python -m pip install -U typing_extensions
mypy --install-types --non-interactive test/test_typing.py test/test_typing_strict.py
- name: Run mypy strict
run: |
mypy --strict test/test_typing_strict.py
- name: Run pyright
run: |
python -m pip install -U pip pyright==1.1.290
pyright test/test_typing.py test/test_typing_strict.py
- name: Run pyright strict
run: |
echo '{"strict": ["tests/test_typing_strict.py"]}' >> pyrightconfig.json
pyright test/test_typing_strict.py
just typing
linkcheck:
name: Check Links
integration_tests:
runs-on: ubuntu-latest
name: Integration Tests
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v6
with:
cache: 'pip'
cache-dependency-path: 'setup.py'
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: |
python -m pip install -U pip
python -m pip install sphinx
- name: Check links
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: |
cd doc
make linkcheck
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

30
.gitignore vendored
View File

@ -9,10 +9,38 @@ build/
doc/_build/
dist/
tools/settings.py
drivers-evergreen-tools
pymongo.egg-info/
*.so
*.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

View File

@ -1,12 +1,14 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.1.0
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
@ -16,36 +18,51 @@ repos:
exclude: .patch
exclude_types: [json]
- repo: https://github.com/psf/black
rev: 22.3.0
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.1.3
hooks:
- id: black
files: \.py$
args: [--line-length=100]
- id: ruff
args: ["--fix", "--show-fixes"]
- id: ruff-format
- repo: https://github.com/PyCQA/isort
rev: 5.10.1
- repo: local
hooks:
- id: isort
files: \.py$
args: [--profile=black]
- 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/PyCQA/flake8
rev: 3.9.2
- repo: https://github.com/adamchainz/blacken-docs
rev: "1.16.0"
hooks:
- id: flake8
files: \.py$
additional_dependencies: [
'flake8-bugbear==20.1.4',
'flake8-logging-format==0.6.0',
'flake8-implicit-str-concat==0.2.0',
]
stages: [manual]
- 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.8.0.4
rev: v0.9.0.6
hooks:
- id: shellcheck
name: shellcheck
@ -53,26 +70,66 @@ repos:
stages: [manual]
- repo: https://github.com/PyCQA/doc8
rev: 0.11.1
rev: v1.1.1
hooks:
- id: doc8
args: ["--ignore=D001"] # ignore line length
stages: [manual]
- repo: https://github.com/sirosen/check-jsonschema
rev: 0.14.1
rev: 0.29.0
hooks:
- id: check-jsonschema
name: "Check GitHub Workflows"
files: ^\.github/workflows/
types: [yaml]
args: ["--schemafile", "https://json.schemastore.org/github-workflow"]
stages: [manual]
- id: check-github-workflows
- id: check-github-actions
- id: check-dependabot
- repo: https://github.com/ariebovenberg/slotscheck
rev: v0.14.0
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"

View File

@ -12,9 +12,13 @@ sphinx:
# Set the version of Python and requirements required to build the docs.
python:
version: 3.8
install:
# Install pymongo itself.
- method: pip
path: .
- requirements: doc/docs-requirements.txt
- requirements: requirements/docs.txt
build:
os: ubuntu-22.04
tools:
python: "3.11"

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,108 +0,0 @@
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.7+ and PyPy3.7+. 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.
- 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 :)
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::
pip install pre-commit
pre-commit install
To run ``pre-commit`` manually, run::
pre-commit run --all-files
To run a manual hook like `flake8` manually, run::
pre-commit run --all-files --hook-stage manual flake8
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.
Running Tests Locally
---------------------
- Ensure you have started the appropriate Mongo Server(s).
- Run ``python setup.py test`` to run all of the tests.
- Run ``python setup.py test -s test.<mod_name>.<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:
``python setup.py test -s test.test_change_stream.TestUnifiedChangeStreamsErrors.test_change_stream_errors_on_ElectionInProgress``.
Running Load Balancer Tests Locally
-----------------------------------
- Install ``haproxy`` (available as ``brew install haproxy`` on macOS).
- Clone ``drivers-evergreen-tools``: ``git clone git@github.com:mongodb-labs/drivers-evergreen-tools.git``.
- Start the servers using ``LOAD_BALANCER=true TOPOLOGY=sharded_cluster AUTH=noauth SSL=nossl MONGODB_VERSION=6.0 DRIVERS_TOOLS=$PWD/drivers-evergreen-tools MONGO_ORCHESTRATION_HOME=$PWD/drivers-evergreen-tools/.evergreen/orchestration $PWD/drivers-evergreen-tools/.evergreen/run-orchestration.sh``.
- Start the load balancer using: ``MONGODB_URI='mongodb://localhost:27017,localhost:27018/' $PWD/drivers-evergreen-tools/.evergreen/run-load-balancer.sh start``.
- Run the tests from the ``pymongo`` checkout directory using: ``LOADBALANCER=1 TEST_LOADBALANCER=1 SINGLE_MONGOS_LB_URI='mongodb://127.0.0.1:8000/?loadBalanced=true' MULTI_MONGOS_LB_URI='mongodb://127.0.0.1:8001/?loadBalanced=true' MONGODB_URI='mongodb://localhost:27017,localhost:27018/' python setup.py test -s test.test_load_balancer``.
Re-sync Spec 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``.::
git clone git@github.com:mongodb/specifications.git
export MDB_SPECS=~/specifications
cd ~/mongo-python-driver/.evergreen
./resync-specs.sh -b "connection-string*" crud bson-corpus
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.

View File

@ -1,14 +0,0 @@
include README.rst
include LICENSE
include THIRD-PARTY-NOTICES
recursive-include doc *.rst
recursive-include doc *.py
recursive-include doc *.conf
recursive-include doc *.css
recursive-include doc *.js
recursive-include doc *.png
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,209 +0,0 @@
=======
PyMongo
=======
:Info: See `the mongo site <http://www.mongodb.org>`_ for more information. See `GitHub <http://github.com/mongodb/mongo-python-driver>`_ for the latest source.
:Documentation: Available at `pymongo.readthedocs.io <https://pymongo.readthedocs.io/en/stable/>`_
:Author: The MongoDB Python Team
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
<https://github.com/mongodb/specifications/blob/master/source/gridfs/gridfs-spec.rst/>`_
implementation on top of ``pymongo``.
PyMongo supports MongoDB 3.6, 4.0, 4.2, 4.4, 5.0, and 6.0.
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 the `MongoDB Community
Forums <https://www.mongodb.com/community/forums/tag/python>`_.
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**.
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::
$ python -c "import sys; print(sys.version)"
- The exact version of PyMongo used, with patch level::
$ 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 youve 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>`_::
$ python -m pip install pymongo
Or ``easy_install`` from
`setuptools <http://pypi.python.org/pypi/setuptools>`_::
$ python -m easy_install pymongo
You can also download the project source and do::
$ python setup.py install
Do **not** install the "bson" package from pypi. PyMongo comes with its own
bson package; doing "easy_install bson" installs a third-party package that
is incompatible with PyMongo.
Dependencies
============
PyMongo supports CPython 3.7+ and PyPy3.7+.
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::
$ python -m pip install "pymongo[gssapi]"
MONGODB-AWS authentication requires `pymongo-auth-aws
<https://pypi.org/project/pymongo-auth-aws/>`_::
$ 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>`_::
$ python -m pip install "pymongo[ocsp]"
Wire protocol compression with snappy requires `python-snappy
<https://pypi.org/project/python-snappy>`_::
$ python -m pip install "pymongo[snappy]"
Wire protocol compression with zstandard requires `zstandard
<https://pypi.org/project/zstandard>`_::
$ 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/>`_::
$ python -m pip install "pymongo[encryption]"
You can install all dependencies automatically with the following
command::
$ python -m pip install "pymongo[gssapi,aws,ocsp,snappy,zstd,encryption]"
Additional dependencies are:
- (to generate documentation) sphinx_
Examples
========
Here's a basic example (for more see the *examples* section of the docs):
.. code-block:: python
>>> 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]
Documentation
=============
Documentation is available at `pymongo.readthedocs.io <https://pymongo.readthedocs.io/en/stable/>`_.
To build the documentation, you will need to install sphinx_.
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 run **python setup.py test** in
the root of the distribution.
To verify that PyMongo works with Gevent's monkey-patching::
$ python green_framework_test.py gevent
Or with Eventlet's::
$ python green_framework_test.py eventlet
.. _sphinx: https://www.sphinx-doc.org/en/master/

View File

@ -1,94 +0,0 @@
Some notes on PyMongo releases
==============================
Versioning
----------
We shoot for a release every few months - that will generally just
increment the middle / minor version number (e.g. 3.5.0 -> 3.6.0).
Patch 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 add .devN to the version number to denote the version
under development. So if we just released 3.6.0, then the current dev
version might be 3.6.1.dev0 or 3.7.0.dev0. When we make the next release we
replace all instances of 3.x.x.devN in the docs with the new version number.
https://semver.org/
https://www.python.org/dev/peps/pep-0440/
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. Deprecated features can be removed in a release
that changes the major version number.
Doing a Release
---------------
1. PyMongo is tested on Evergreen. Ensure the latest commit are passing CI
as expected: https://evergreen.mongodb.com/waterfall/mongo-python-driver.
To test locally, ``python3 setup.py test`` will build the C extensions and
test. ``python3 tools/clean.py`` will remove the extensions,
and then ``python3 setup.py --no_ext test`` will run the tests without
them. You can also run the doctests: ``python3 setup.py doc -t``.
2. Check Jira to ensure all the tickets in this version have been completed.
3. Add release notes to doc/changelog.rst. Generally just summarize/clarify
the git log, but you might add some more long form notes for big changes.
4. Make sure version number is updated in ``pymongo/_version.py``
5. Commit with a BUMP version_number message, eg ``git commit -m 'BUMP 3.11.0'``.
6. Tag w/ version_number, eg, ``git tag -a '3.11.0' -m 'BUMP 3.11.0' <COMMIT>``.
7. Push commit / tag, eg ``git push && git push --tags``.
8. Pushing a tag will trigger a release process in Evergreen which builds
wheels for manylinux, macOS, and Windows. Wait for the "release-combine"
task to complete and then download the "Release files all" archive. See:
https://evergreen.mongodb.com/waterfall/mongo-python-driver?bv_filter=release
The contents should look like this::
$ ls path/to/archive
pymongo-<version>-cp310-cp310-macosx_10_9_universal2.whl
...
pymongo-<version>-cp38-cp38-manylinux2014_x86_64.whl
...
pymongo-<version>-cp38-cp38-win_amd64.whl
...
pymongo-<version>.tar.gz
9. Upload all the release packages to PyPI with twine::
$ python3 -m twine upload path/to/archive/*
10. Make sure the new version appears on https://pymongo.readthedocs.io/. If the
new version does not show up automatically, trigger a rebuild of "latest":
https://readthedocs.org/projects/pymongo/builds/
11. Bump the version number to <next version>.dev0 in ``pymongo/_version.py``,
commit, push.
12. Publish the release version in Jira.
13. Announce the release on:
https://www.mongodb.com/community/forums/c/announcements/driver-releases/110
14. File a ticket for DOCSP highlighting changes in server version and Python
version compatibility or the lack thereof, for example:
https://jira.mongodb.org/browse/DOCSP-13536
15. Create a GitHub Release for the tag using
https://github.com/mongodb/mongo-python-driver/releases/new.
The title should be "PyMongo X.Y.Z", and the description should contain
a link to the release notes on the the community forum, e.g.
"Release notes: mongodb.com/community/forums/t/pymongo-4-0-2-released/150457."

View File

@ -39,35 +39,60 @@ 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 bson-stdint-win32.h
2) License Notice for _asyncio_lock.py
-----------------------------------------
ISO C9x compliant stdint.h for Microsoft Visual Studio
Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124
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.
Copyright (c) 2006-2013 Alexander Chemeris
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.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
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.
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
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.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
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.
3. Neither the name of the product nor the names of its contributors may
be used to endorse or promote products derived from this software
without specific prior written permission.
6. This License Agreement will automatically terminate upon a material
breach of its terms and conditions.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
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

@ -23,28 +23,35 @@
/*
* 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;
@ -65,6 +72,7 @@ typedef struct codec_options_t {
unsigned char datetime_conversion;
PyObject* options_obj;
unsigned char is_raw_bson;
unsigned char is_dict_class;
} codec_options_t;
/* C API functions */
@ -86,7 +94,7 @@ typedef struct codec_options_t {
#define _cbson_convert_codec_options_INDEX 4
#define _cbson_convert_codec_options_RETURN int
#define _cbson_convert_codec_options_PROTO (PyObject* options_obj, void* p)
#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

View File

@ -13,8 +13,10 @@
# limitations under the License.
"""Setstate and getstate functions for objects with __slots__, allowing
compatibility with default pickling protocol
compatibility with default pickling protocol
"""
from __future__ import annotations
from typing import Any, Mapping
@ -33,7 +35,7 @@ def _mangle_name(name: str, prefix: str) -> str:
def _getstate_slots(self: Any) -> Mapping[Any, Any]:
prefix = self.__class__.__name__
ret = dict()
ret = {}
for name in self.__slots__:
mangled_name = _mangle_name(name, prefix)
if hasattr(self, mangled_name):

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