-
Notifications
You must be signed in to change notification settings - Fork 1.1k
PYTHON-5343 Clean up contributing docs #2390
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -190,13 +190,15 @@ 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 | ||
|
||
- Ensure you have started the appropriate Mongo Server(s). | ||
- 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, remove the `.venv` folder and set `PYTHON_BINARY` 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-orchestration.sh`](https://github.com/mongodb-labs/drivers-evergreen-tools/blob/master/.evergreen/run-orchestration.sh). Run `$DRIVERS_TOOLS/evergreen/run-orchestration.sh -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 | ||
|
@@ -213,18 +215,36 @@ the pages will re-render and the browser will automatically refresh. | |
`git clone [email protected]:mongodb-labs/drivers-evergreen-tools.git`. | ||
- Run `export DRIVERS_TOOLS=$PWD/drivers-evergreen-tools`. This can be put into a `.bashrc` file | ||
for convenience. | ||
- Set up access to [Drivers test secrets](https://github.com/mongodb-labs/drivers-evergreen-tools/tree/master/.evergreen/secrets_handling#secrets-handling). | ||
- 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. All given options will be passed to | ||
`run-orchestration.sh` in `$DRIVERS_TOOLS`. See `$DRIVERS_TOOLS/evergreen/run-orchestration.sh -h` | ||
for a full list of options. | ||
- 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. | ||
|
@@ -434,6 +454,7 @@ run `pre-commit run --all-files --hook-stage manual ruff` and fix all reported e | |
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. | ||
|
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line is just a repeat of the previous one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, they use different targets