Skip to content

Commit 359aca7

Browse files
committed
add simple uvloop tests
1 parent a7a645f commit 359aca7

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

.github/workflows/test-python.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ jobs:
7575
version: "${{ matrix.mongodb-version }}"
7676
- name: Run tests
7777
run: uv run --extra test pytest -v
78+
- name: Run uvloop test
79+
run: uv run tools/test_uv_loop.py
7880

7981
doctest:
8082
runs-on: ubuntu-latest

tools/test_uv_loop.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# /// script
2+
# dependencies = [
3+
# "uvloop>=0.18"
4+
# ]
5+
# requires-python = ">=3.11"
6+
# ///
7+
from __future__ import annotations
8+
9+
import sys
10+
from pathlib import Path
11+
12+
import uvloop
13+
14+
# Use pymongo from parent directory.
15+
root = Path(__file__).parent.parent
16+
sys.path.insert(0, str(root))
17+
18+
from pymongo import AsyncMongoClient # noqa: E402
19+
20+
21+
async def main():
22+
client = AsyncMongoClient()
23+
print(await client.admin.command("ping"))
24+
25+
26+
uvloop.run(main())

0 commit comments

Comments
 (0)