Skip to content

Commit 41a760d

Browse files
committed
Merge branch 'master' of github.com:mongodb/mongo-python-driver
2 parents e334c4f + e44ece0 commit 41a760d

File tree

6 files changed

+145
-39
lines changed

6 files changed

+145
-39
lines changed
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
diff --git a/test/connection_logging/connection-logging.json b/test/connection_logging/connection-logging.json
2+
index d40cfbb7e..5799e834d 100644
3+
--- a/test/connection_logging/connection-logging.json
4+
+++ b/test/connection_logging/connection-logging.json
5+
@@ -272,7 +272,13 @@
6+
"level": "debug",
7+
"component": "connection",
8+
"data": {
9+
- "message": "Connection pool closed",
10+
+ "message": "Connection closed",
11+
+ "driverConnectionId": {
12+
+ "$$type": [
13+
+ "int",
14+
+ "long"
15+
+ ]
16+
+ },
17+
"serverHost": {
18+
"$$type": "string"
19+
},
20+
@@ -281,20 +287,15 @@
21+
"int",
22+
"long"
23+
]
24+
- }
25+
+ },
26+
+ "reason": "Connection pool was closed"
27+
}
28+
},
29+
{
30+
"level": "debug",
31+
"component": "connection",
32+
"data": {
33+
- "message": "Connection closed",
34+
- "driverConnectionId": {
35+
- "$$type": [
36+
- "int",
37+
- "long"
38+
- ]
39+
- },
40+
+ "message": "Connection pool closed",
41+
"serverHost": {
42+
"$$type": "string"
43+
},
44+
@@ -303,8 +304,7 @@
45+
"int",
46+
"long"
47+
]
48+
- },
49+
- "reason": "Connection pool was closed"
50+
+ }
51+
}
52+
}
53+
]
54+
@@ -446,22 +446,6 @@
55+
}
56+
}
57+
},
58+
- {
59+
- "level": "debug",
60+
- "component": "connection",
61+
- "data": {
62+
- "message": "Connection pool cleared",
63+
- "serverHost": {
64+
- "$$type": "string"
65+
- },
66+
- "serverPort": {
67+
- "$$type": [
68+
- "int",
69+
- "long"
70+
- ]
71+
- }
72+
- }
73+
- },
74+
{
75+
"level": "debug",
76+
"component": "connection",
77+
@@ -514,6 +498,22 @@
78+
]
79+
}
80+
}
81+
+ },
82+
+ {
83+
+ "level": "debug",
84+
+ "component": "connection",
85+
+ "data": {
86+
+ "message": "Connection pool cleared",
87+
+ "serverHost": {
88+
+ "$$type": "string"
89+
+ },
90+
+ "serverPort": {
91+
+ "$$type": [
92+
+ "int",
93+
+ "long"
94+
+ ]
95+
+ }
96+
+ }
97+
}
98+
]
99+
}

.github/workflows/test-python.yml

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -50,33 +50,31 @@ jobs:
5050
cppcheck pymongo
5151
5252
build:
53-
# supercharge/mongodb-github-action requires containers so we don't test other platforms
5453
runs-on: ${{ matrix.os }}
5554
strategy:
5655
fail-fast: false
5756
matrix:
57+
# Tests currently only pass on ubuntu on GitHub Actions.
5858
os: [ubuntu-latest]
59-
python-version: ["3.9", "pypy-3.10", "3.13", "3.13t"]
59+
python-version: ["3.9", "pypy-3.10", "3.13t"]
60+
mongodb-version: ["8.0"]
61+
6062
name: CPython ${{ matrix.python-version }}-${{ matrix.os }}
6163
steps:
6264
- uses: actions/checkout@v4
6365
with:
6466
persist-credentials: false
65-
- name: Install just
66-
uses: extractions/setup-just@e33e0265a09d6d736e2ee1e0eb685ef1de4669ff # v3
6767
- name: Install uv
6868
uses: astral-sh/setup-uv@e92bafb6253dcd438e0484186d7669ea7a8ca1cc # v5
6969
with:
7070
enable-cache: true
7171
python-version: ${{ matrix.python-version }}
72-
- name: Install dependencies
73-
run: just install
74-
- name: Start MongoDB
75-
uses: supercharge/mongodb-github-action@90004df786821b6308fb02299e5835d0dae05d0d # 1.12.0
72+
- id: setup-mongodb
73+
uses: mongodb-labs/drivers-evergreen-tools@master
7674
with:
77-
mongodb-version: 6.0
75+
version: "${{ matrix.mongodb-version }}"
7876
- name: Run tests
79-
run: just test
77+
run: uv run --extra test pytest -v
8078

8179
doctest:
8280
runs-on: ubuntu-latest
@@ -92,10 +90,10 @@ jobs:
9290
with:
9391
enable-cache: true
9492
python-version: "3.9"
95-
- name: Start MongoDB
96-
uses: supercharge/mongodb-github-action@90004df786821b6308fb02299e5835d0dae05d0d # 1.12.0
93+
- id: setup-mongodb
94+
uses: mongodb-labs/drivers-evergreen-tools@master
9795
with:
98-
mongodb-version: '8.0.0-rc4'
96+
version: "8.0"
9997
- name: Install dependencies
10098
run: just install
10199
- name: Run tests
@@ -210,8 +208,8 @@ jobs:
210208
cache-dependency-path: 'sdist/test/pyproject.toml'
211209
# Test sdist on lowest supported Python
212210
python-version: '3.9'
213-
- name: Start MongoDB
214-
uses: supercharge/mongodb-github-action@90004df786821b6308fb02299e5835d0dae05d0d # 1.12.0
211+
- id: setup-mongodb
212+
uses: mongodb-labs/drivers-evergreen-tools@master
215213
- name: Run connect test from sdist
216214
shell: bash
217215
run: |
@@ -234,10 +232,10 @@ jobs:
234232
uses: astral-sh/setup-uv@e92bafb6253dcd438e0484186d7669ea7a8ca1cc # v5
235233
with:
236234
python-version: '3.9'
237-
- name: Start MongoDB
238-
uses: supercharge/mongodb-github-action@90004df786821b6308fb02299e5835d0dae05d0d # 1.12.0
235+
- id: setup-mongodb
236+
uses: mongodb-labs/drivers-evergreen-tools@master
239237
with:
240-
mongodb-version: 6.0
238+
version: "8.0"
241239
# Async and our test_dns do not support dnspython 1.X, so we don't run async or dns tests here
242240
- name: Run tests
243241
shell: bash
@@ -260,10 +258,10 @@ jobs:
260258
uses: astral-sh/setup-uv@e92bafb6253dcd438e0484186d7669ea7a8ca1cc # v5
261259
with:
262260
python-version: '3.9'
263-
- name: Start MongoDB
264-
uses: supercharge/mongodb-github-action@90004df786821b6308fb02299e5835d0dae05d0d # 1.12.0
261+
- id: setup-mongodb
262+
uses: mongodb-labs/drivers-evergreen-tools@master
265263
with:
266-
mongodb-version: 6.0
264+
version: "8.0"
267265
# The lifetime kwarg we use in srv resolution was added to the async resolver API in dnspython 2.1.0
268266
- name: Run tests
269267
shell: bash

.github/zizmor.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
rules:
2+
unpinned-uses:
3+
config:
4+
policies:
5+
actions/*: ref-pin
6+
mongodb-labs/drivers-github-tools/*: ref-pin
7+
mongodb-labs/drivers-evergreen-tools: ref-pin

test/asynchronous/test_pooling.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
import socket
2222
import sys
2323
import time
24-
from test.asynchronous.utils import async_get_pool, async_joinall
24+
from test.asynchronous.utils import async_get_pool, async_joinall, flaky
2525

2626
from bson.codec_options import DEFAULT_CODEC_OPTIONS
2727
from bson.son import SON
@@ -429,6 +429,7 @@ async def find_one():
429429
# maxConnecting = unbounded: 30+ connections in ~0.140+ seconds
430430
print(len(pool.conns))
431431

432+
@flaky(reason="PYTHON-5492")
432433
@async_client_context.require_failCommand_appName
433434
async def test_csot_timeout_message(self):
434435
client = await self.async_rs_or_single_client(appName="connectionTimeoutApp")

test/connection_logging/connection-logging.json

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -446,22 +446,6 @@
446446
}
447447
}
448448
},
449-
{
450-
"level": "debug",
451-
"component": "connection",
452-
"data": {
453-
"message": "Connection pool cleared",
454-
"serverHost": {
455-
"$$type": "string"
456-
},
457-
"serverPort": {
458-
"$$type": [
459-
"int",
460-
"long"
461-
]
462-
}
463-
}
464-
},
465449
{
466450
"level": "debug",
467451
"component": "connection",
@@ -514,6 +498,22 @@
514498
]
515499
}
516500
}
501+
},
502+
{
503+
"level": "debug",
504+
"component": "connection",
505+
"data": {
506+
"message": "Connection pool cleared",
507+
"serverHost": {
508+
"$$type": "string"
509+
},
510+
"serverPort": {
511+
"$$type": [
512+
"int",
513+
"long"
514+
]
515+
}
516+
}
517517
}
518518
]
519519
}

test/test_pooling.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
import socket
2222
import sys
2323
import time
24-
from test.utils import get_pool, joinall
24+
from test.utils import flaky, get_pool, joinall
2525

2626
from bson.codec_options import DEFAULT_CODEC_OPTIONS
2727
from bson.son import SON
@@ -429,6 +429,7 @@ def find_one():
429429
# maxConnecting = unbounded: 30+ connections in ~0.140+ seconds
430430
print(len(pool.conns))
431431

432+
@flaky(reason="PYTHON-5492")
432433
@client_context.require_failCommand_appName
433434
def test_csot_timeout_message(self):
434435
client = self.rs_or_single_client(appName="connectionTimeoutApp")

0 commit comments

Comments
 (0)