Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions .evergreen/run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,7 @@ else
exit 1
fi

# List the packages.
uv sync ${UV_ARGS} --reinstall --quiet
uv pip list

# Start the test runner.
uv run ${UV_ARGS} .evergreen/scripts/run_tests.py "$@"
uv run ${UV_ARGS} --reinstall .evergreen/scripts/run_tests.py "$@"

popd
2 changes: 1 addition & 1 deletion .evergreen/scripts/generate_config_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ def generate_yaml(tasks=None, variants=None):
out = ShrubService.generate_yaml(project)
# Dedent by two spaces to match what we use in config.yml
lines = [line[2:] for line in out.splitlines()]
print("\n".join(lines)) # noqa: T201
print("\n".join(lines))


##################
Expand Down
8 changes: 4 additions & 4 deletions .evergreen/scripts/resync-all-specs.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

def resync_specs(directory: pathlib.Path, errored: dict[str, str]) -> None:
"""Actually sync the specs"""
print("Beginning to sync specs") # noqa: T201
print("Beginning to sync specs")
for spec in os.scandir(directory):
if not spec.is_dir():
continue
Expand All @@ -27,11 +27,11 @@ def resync_specs(directory: pathlib.Path, errored: dict[str, str]) -> None:
)
except CalledProcessError as exc:
errored[spec.name] = exc.stderr
print("Done syncing specs") # noqa: T201
print("Done syncing specs")


def apply_patches():
print("Beginning to apply patches") # noqa: T201
print("Beginning to apply patches")
subprocess.run(["bash", "./.evergreen/remove-unimplemented-tests.sh"], check=True) # noqa: S603, S607
subprocess.run(
["git apply -R --allow-empty --whitespace=fix ./.evergreen/spec-patch/*"], # noqa: S607
Expand Down Expand Up @@ -96,7 +96,7 @@ def write_summary(errored: dict[str, str], new: list[str], filename: Optional[st
pr_body += "\n"
if pr_body != "":
if filename is None:
print(f"\n{pr_body}") # noqa: T201
print(f"\n{pr_body}")
else:
with open(filename, "w") as f:
# replacements made for proper json
Expand Down
24 changes: 24 additions & 0 deletions .evergreen/scripts/run_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@
from pathlib import Path
from shutil import which

try:
import importlib_metadata
except ImportError:
from importlib import metadata as importlib_metadata


import pytest
from utils import DRIVERS_TOOLS, LOGGER, ROOT, run_command

Expand All @@ -23,6 +29,21 @@
SUB_TEST_NAME = os.environ.get("SUB_TEST_NAME")


def list_packages():
packages = dict()
for distribution in importlib_metadata.distributions():
packages[distribution.name] = distribution
print("Package Version URL")
print("------------------- ----------- ----------------------------------------------------")
for name in sorted(packages):
distribution = packages[name]
url = ""
if distribution.origin is not None:
url = distribution.origin.url
print(f"{name:20s}{distribution.version:12s}{url}")
print("------------------- ----------- ----------------------------------------------------\n")


def handle_perf(start_time: datetime):
end_time = datetime.now()
elapsed_secs = (end_time - start_time).total_seconds()
Expand Down Expand Up @@ -121,6 +142,9 @@ def handle_aws_lambda() -> None:


def run() -> None:
# List the installed packages.
list_packages()

# Handle green framework first so they can patch modules.
if GREEN_FRAMEWORK:
handle_green_framework()
Expand Down
4 changes: 3 additions & 1 deletion .evergreen/scripts/setup_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,9 @@ def handle_test_env() -> None:
setup_libmongocrypt()

# TODO: Test with 'pip install pymongocrypt'
UV_ARGS.append("--group pymongocrypt_source")
UV_ARGS.append(
"--with pymongocrypt@git+https://github.com/mongodb/libmongocrypt@master#subdirectory=bindings/python"
)

# Use the nocrypto build to avoid dependency issues with older windows/python versions.
BASE = ROOT / "libmongocrypt/nocrypto"
Expand Down
4 changes: 1 addition & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,6 @@ coverage = [
mockupdb = [
"mockupdb@git+https://github.com/mongodb-labs/mongo-mockup-db@master"
]
pymongocrypt_source = [
"pymongocrypt@git+https://github.com/mongodb/libmongocrypt@master#subdirectory=bindings/python"
]
perf = ["simplejson"]
typing = [
"mypy==1.18.1",
Expand Down Expand Up @@ -239,6 +236,7 @@ dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?)|dummy.*)$"

[tool.ruff.lint.per-file-ignores]
"pymongo/__init__.py" = ["E402"]
".evergreen/scripts/*.py" = ["T201"]
"test/*.py" = ["PT", "E402", "PLW", "SIM", "E741", "PTH", "S", "B904", "E722", "T201",
"RET", "ARG", "F405", "B028", "PGH001", "B018", "F403", "RUF015", "E731", "B007",
"UP031", "F401", "B023", "F811"]
Expand Down
1 change: 1 addition & 0 deletions requirements/test.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
pytest>=8.2
pytest-asyncio>=0.24.0
importlib_metadata>=7.0;python_version < "3.13"
19 changes: 12 additions & 7 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading