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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
13 changes: 5 additions & 8 deletions .evergreen/scripts/generate_config_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def create_variant_generic(
task_refs.append(t)
else:
task_refs.append(EvgTaskRef(name=t))
expansions = expansions and expansions.copy() or dict()
expansions = (expansions and expansions.copy()) or dict()
if "run_on" in kwargs:
run_on = kwargs.pop("run_on")
elif host:
Expand Down Expand Up @@ -137,15 +137,12 @@ def create_variant(
expansions: dict | None = None,
**kwargs: Any,
) -> BuildVariant:
expansions = expansions and expansions.copy() or dict()
expansions = (expansions and expansions.copy()) or dict()
if version:
expansions["VERSION"] = version
# 8.0+ Windows builds must run on win-latest
if (
"win64" in display_name.lower()
or "win32" in display_name.lower()
and version
and version >= "8.0"
if "win64" in display_name.lower() or (
"win32" in display_name.lower() and version and version >= "8.0"
):
kwargs["run_on"] = HOSTS["win-latest"].run_on
return create_variant_generic(
Expand All @@ -166,7 +163,7 @@ def get_versions_until(max_version: str) -> list[str]:
max_version_float = float(max_version)
versions = [v for v in ALL_VERSIONS if v not in ["rapid", "latest"]]
versions = [v for v in versions if float(v) <= max_version_float]
if not len(versions):
if not versions:
raise ValueError(f"No server versions found less <= {max_version}")
return versions

Expand Down
12 changes: 6 additions & 6 deletions .evergreen/scripts/kms_tester.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,9 @@ def setup_kms(sub_test_name: str) -> None:
os.environ["AZUREKMS_VMNAME_PREFIX"] = "PYTHON_DRIVER"

# Found using "az vm image list --output table"
os.environ[
"AZUREKMS_IMAGE"
] = "Canonical:0001-com-ubuntu-server-jammy:22_04-lts-gen2:latest"
os.environ["AZUREKMS_IMAGE"] = (
"Canonical:0001-com-ubuntu-server-jammy:22_04-lts-gen2:latest"
)
else:
os.environ["GCPKMS_IMAGEFAMILY"] = "debian-12"

Expand All @@ -127,9 +127,9 @@ def test_kms_send_to_remote(sub_test_name: str) -> None:
if sub_test_name == "azure":
key_name = os.environ["KEY_NAME"]
key_vault_endpoint = os.environ["KEY_VAULT_ENDPOINT"]
env[
"AZUREKMS_CMD"
] = f'KEY_NAME="{key_name}" KEY_VAULT_ENDPOINT="{key_vault_endpoint}" bash ./.evergreen/just.sh run-tests'
env["AZUREKMS_CMD"] = (
f'KEY_NAME="{key_name}" KEY_VAULT_ENDPOINT="{key_vault_endpoint}" bash ./.evergreen/just.sh run-tests'
)
else:
env["GCPKMS_CMD"] = "./.evergreen/just.sh run-tests"
cmd = f"{DIRS[sub_test_name]}/run-command.sh"
Expand Down
6 changes: 3 additions & 3 deletions .evergreen/scripts/oidc_tester.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ def test_oidc_send_to_remote(sub_test_name: str) -> None:
if sub_test_name in ["azure", "gcp"]:
upper_name = sub_test_name.upper()
env[f"{upper_name}OIDC_DRIVERS_TAR_FILE"] = TMP_DRIVER_FILE
env[
f"{upper_name}OIDC_TEST_CMD"
] = f"OIDC_ENV={sub_test_name} ./.evergreen/run-mongodb-oidc-test.sh"
env[f"{upper_name}OIDC_TEST_CMD"] = (
f"OIDC_ENV={sub_test_name} ./.evergreen/run-mongodb-oidc-test.sh"
)
elif sub_test_name in K8S_NAMES:
env["K8S_DRIVERS_TAR_FILE"] = TMP_DRIVER_FILE
env["K8S_TEST_CMD"] = "OIDC_ENV=k8s ./.evergreen/run-mongodb-oidc-test.sh"
Expand Down
12 changes: 6 additions & 6 deletions .evergreen/scripts/resync-all-specs.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ def resync_specs(directory: pathlib.Path, errored: dict[str, str]) -> None:
if spec.name in ["asynchronous"]:
continue
try:
subprocess.run(
["bash", "./.evergreen/resync-specs.sh", spec.name], # noqa: S603, S607
subprocess.run( # noqa: S603
["bash", "./.evergreen/resync-specs.sh", spec.name], # noqa: S607
capture_output=True,
text=True,
check=True,
Expand All @@ -34,7 +34,7 @@ def resync_specs(directory: pathlib.Path, errored: dict[str, str]) -> None:
def apply_patches(errored):
print("Beginning to apply patches")
subprocess.run(
["bash", "./.evergreen/remove-unimplemented-tests.sh"], # noqa: S603, S607
["bash", "./.evergreen/remove-unimplemented-tests.sh"], # noqa: S607
check=True,
)
try:
Expand All @@ -46,8 +46,8 @@ def apply_patches(errored):
if patches:
for patch in patches:
print(f"Applying patch {patch}")
subprocess.run(
[ # noqa: S603, S607
subprocess.run( # noqa: S603
[ # noqa: S607
"git",
"apply",
"-R",
Expand Down Expand Up @@ -96,7 +96,7 @@ def write_summary(errored: dict[str, str], new: list[str], filename: str | None)
pr_body = ""
# Avoid shell=True and complex pipes by using Python to process git output
process = subprocess.run(
["git", "diff", "--name-only"], # noqa: S603, S607
["git", "diff", "--name-only"], # noqa: S607
capture_output=True,
text=True,
check=True,
Expand Down
2 changes: 1 addition & 1 deletion .evergreen/scripts/run_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ def run() -> None:
if TEST_NAME == "doctest":
from sphinx.cmd.build import main

result = main("-E -b doctest doc ./doc/_build/doctest".split())
result = main(["-E", "-b", "doctest", "doc", "./doc/_build/doctest"])
sys.exit(result)

# Send ecs tests to run remotely.
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ repos:

- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.1.3
rev: v0.15.16
hooks:
- id: ruff
args: ["--fix", "--show-fixes"]
Expand All @@ -35,7 +35,7 @@ repos:
require_serial: true
fail_fast: true
additional_dependencies:
- ruff==0.1.3
- ruff==0.15.16
- unasync

- repo: https://github.com/adamchainz/blacken-docs
Expand Down
4 changes: 2 additions & 2 deletions _setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def run(self):
if os.environ.get("PYMONGO_C_EXT_MUST_BUILD"):
raise
e = sys.exc_info()[1]
sys.stdout.write("%s\n" % str(e))
sys.stdout.write(f"{e!s}\n")
warnings.warn(
self.warning_message
% (
Expand All @@ -94,7 +94,7 @@ def build_extension(self, ext):
if os.environ.get("PYMONGO_C_EXT_MUST_BUILD"):
raise
e = sys.exc_info()[1]
sys.stdout.write("%s\n" % str(e))
sys.stdout.write(f"{e!s}\n")
warnings.warn(
self.warning_message
% (
Expand Down
Loading
Loading