Skip to content

Commit 98893a4

Browse files
authored
Merge branch 'master' into PYTHON-5401
2 parents 9981938 + 80c3ff2 commit 98893a4

35 files changed

+1983
-1323
lines changed

.evergreen/scripts/resync-all-specs.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
from argparse import Namespace
88
from subprocess import CalledProcessError
99

10+
JIRA_FILTER = "https://jira.mongodb.org/issues/?jql=labels%20%3D%20automated-sync%20AND%20status%20!%3D%20Closed"
11+
1012

1113
def resync_specs(directory: pathlib.Path, errored: dict[str, str]) -> None:
1214
"""Actually sync the specs"""
@@ -117,6 +119,7 @@ def write_summary(errored: dict[str, str], new: list[str], filename: str | None)
117119
pr_body += "\n -".join(new)
118120
pr_body += "\n"
119121
if pr_body != "":
122+
pr_body = f"Jira tickets: {JIRA_FILTER}\n\n" + pr_body
120123
if filename is None:
121124
print(f"\n{pr_body}")
122125
else:

.evergreen/scripts/setup_tests.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,10 @@ def handle_test_env() -> None:
153153
# Start compiling the args we'll pass to uv.
154154
UV_ARGS = ["--extra test --no-group dev"]
155155

156+
# If USE_ACTIVE_VENV is set, add --active to UV_ARGS so run-tests.sh uses the active venv.
157+
if is_set("USE_ACTIVE_VENV"):
158+
UV_ARGS.append("--active")
159+
156160
test_title = test_name
157161
if sub_test_name:
158162
test_title += f" {sub_test_name}"

.github/copilot-instructions.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
When reviewing code, focus on:
2+
3+
## Security Critical Issues
4+
- Check for hardcoded secrets, API keys, or credentials.
5+
- Check for instances of potential method call injection, dynamic code execution, symbol injection or other code injection vulnerabilities.
6+
7+
## Performance Red Flags
8+
- Spot inefficient loops and algorithmic issues.
9+
- Check for memory leaks and resource cleanup.
10+
11+
## Code Quality Essentials
12+
- Methods should be focused and appropriately sized. If a method is doing too much, suggest refactorings to split it up.
13+
- Use clear, descriptive naming conventions.
14+
- Avoid encapsulation violations and ensure proper separation of concerns.
15+
- All public classes, modules, and methods should have clear documentation in Sphinx format.
16+
17+
## PyMongo-specific Concerns
18+
- Do not review files within `pymongo/synchronous` or files in `test/` that also have a file of the same name in `test/asynchronous` unless the reviewed changes include a `_IS_SYNC` statement. PyMongo generates these files from `pymongo/asynchronous` and `test/asynchronous` using `tools/synchro.py`.
19+
- All asynchronous functions must not call any blocking I/O.
20+
21+
## Review Style
22+
- Be specific and actionable in feedback.
23+
- Explain the "why" behind recommendations.
24+
- Acknowledge good patterns when you see them.
25+
- Ask clarifying questions when code intent is unclear.
26+
27+
Always prioritize security vulnerabilities and performance issues that could impact users.
28+
29+
Always suggest changes to improve readability and testability. For example, this suggestion seeks to make the code more readable, reusable, and testable:
30+
31+
```python
32+
# Instead of:
33+
if user.email and "@" in user.email and len(user.email) > 5:
34+
submit_button.enabled = True
35+
else:
36+
submit_button.enabled = False
37+
38+
# Consider:
39+
def valid_email(email):
40+
return email and "@" in email and len(email) > 5
41+
42+
43+
submit_button.enabled = valid_email(user.email)
44+
```

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,4 @@ test/lambda/*.json
4343
xunit-results/
4444
coverage.xml
4545
server.log
46+
.coverage

CONTRIBUTING.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@ the pages will re-render and the browser will automatically refresh.
209209
and the `<class_name>` to test a full module. For example:
210210
`just test test/test_change_stream.py::TestUnifiedChangeStreamsErrors::test_change_stream_errors_on_ElectionInProgress`.
211211
- Use the `-k` argument to select tests by pattern.
212+
- Run `just test-coverage` to run tests with coverage and display a report. After running tests with coverage, use `just coverage-html` to generate an HTML report in `htmlcov/index.html`.
212213

213214

214215
## Running tests that require secrets, services, or other configuration

0 commit comments

Comments
 (0)