-
Notifications
You must be signed in to change notification settings - Fork 1.1k
PYTHON-5550 Add a test that uses uvloop as the event loop #2543
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
blink1073
wants to merge
10
commits into
mongodb:master
Choose a base branch
from
blink1073:PYTHON-5550
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 9 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
359aca7
add simple uvloop tests
blink1073 7f8006a
PYTHON-5550 Add a test that uses uvloop as the event loop
blink1073 16ee095
fix typo
blink1073 01289b0
remove stale test
blink1073 8e108fb
limit perms
blink1073 38a4fb6
cleanup
blink1073 d6c6a15
Support running ssl-enabled integration tests
blink1073 bc0c118
no need to specify ssl
blink1073 e3b6ec6
wip
blink1073 1fae50e
Merge branch 'master' into PYTHON-5550
blink1073 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Integration Tests | ||
|
||
A set of tests that verify the usage of PyMongo with downstream packages or frameworks. | ||
|
||
Each test uses [PEP 723 inline metadata](https://packaging.python.org/en/latest/specifications/inline-script-metadata/) and can be run using `pipx` or `uv`. | ||
|
||
The `run.sh` convenience script can be used to run all of the files using `uv`. | ||
|
||
Here is an example header for the script with the inline dependencies: | ||
|
||
```python | ||
# /// script | ||
# dependencies = [ | ||
# "uvloop>=0.18" | ||
# ] | ||
# requires-python = ">=3.10" | ||
# /// | ||
``` | ||
|
||
Here is an example of using the test helper function to create a configured client for the test: | ||
|
||
|
||
```python | ||
import asyncio | ||
import sys | ||
from pathlib import Path | ||
|
||
# Use pymongo from parent directory. | ||
root = Path(__file__).parent.parent | ||
sys.path.insert(0, str(root)) | ||
|
||
from test.asynchronous import async_simple_test_client # noqa: E402 | ||
|
||
|
||
async def main(): | ||
async with async_simple_test_client() as client: | ||
result = await client.admin.command("ping") | ||
assert result["ok"] | ||
|
||
|
||
asyncio.run(main()) | ||
``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/bash | ||
# Run all of the integration test files using `uv run`. | ||
set -eu | ||
|
||
for file in integration_tests/test_*.py ; do | ||
echo "-----------------" | ||
echo "Running $file..." | ||
uv run $file | ||
echo "Running $file...done." | ||
echo "-----------------" | ||
done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# /// script | ||
# dependencies = [ | ||
# "uvloop>=0.18" | ||
# ] | ||
# requires-python = ">=3.10" | ||
# /// | ||
from __future__ import annotations | ||
|
||
import sys | ||
from pathlib import Path | ||
|
||
import uvloop | ||
|
||
# Use pymongo from parent directory. | ||
root = Path(__file__).parent.parent | ||
sys.path.insert(0, str(root)) | ||
|
||
from test.asynchronous import async_simple_test_client # noqa: E402 | ||
|
||
|
||
async def main(): | ||
async with async_simple_test_client() as client: | ||
result = await client.admin.command("ping") | ||
assert result["ok"] | ||
|
||
|
||
uvloop.run(main()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.