-
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
9
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.
+140
−2
Open
Changes from 4 commits
Commits
Show all changes
9 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 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
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,19 @@ | ||
# 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`. | ||
|
||
When creating a new script, use the following snippet to ensure that the local version of PyMongo is used: | ||
|
||
|
||
```python | ||
# Use pymongo from parent directory. | ||
import sys | ||
from pathlib import Path | ||
|
||
root = Path(__file__).parent.parent | ||
sys.path.insert(0, str(root)) | ||
``` |
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,17 @@ | ||
#!/bin/bash | ||
# Run all of the integration test files using `uv run`. | ||
set -eu | ||
|
||
HERE=$(dirname ${BASH_SOURCE:-$0}) | ||
pushd "$HERE" > /dev/null | ||
trap 'popd' ERR | ||
|
||
for file in test_*.py ; do | ||
echo "-----------------" | ||
echo "Running $file..." | ||
uv run $file | ||
echo "Running $file...done." | ||
echo "-----------------" | ||
done | ||
|
||
popd |
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 pymongo import AsyncMongoClient # noqa: E402 | ||
|
||
|
||
async def main(): | ||
client = AsyncMongoClient() | ||
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
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.