Skip to content

Commit b1ec397

Browse files
committed
chore(tests):
- handle and reduce test warning feedback by ignoring known deprecations. - fix meaningful test warnings - upgrade pytest to 9.x and config to match
1 parent 46159c4 commit b1ec397

File tree

6 files changed

+21
-14
lines changed

6 files changed

+21
-14
lines changed

packages/cm-models/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ dependencies = [
1414

1515
[dependency-groups]
1616
dev = [
17-
"pytest>=8.3.3",
17+
"pytest>=9.0.0",
1818
"pytest-asyncio>=0.24.0",
1919
"pytest-cov>=6.0.0",
2020
]

pyproject.toml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ dev = [
7373
"json-schema-for-humans",
7474
"mypy>=1.17.0",
7575
"pre-commit>=4.5.1",
76-
"pytest>=8.3.3",
76+
"pytest>=9.0.0",
7777
"pytest-asyncio>=0.24.0",
7878
"pytest-cov>=6.0.0",
7979
"pytest-playwright>=0.5.2",
@@ -213,11 +213,17 @@ max-doc-length = 79
213213
[tool.ruff.lint.pydocstyle]
214214
convention = "numpy"
215215

216-
[tool.pytest.ini_options]
217-
addopts = "--import-mode=importlib"
216+
[tool.pytest]
217+
minversion = "9.0"
218+
addopts = ["--import-mode=importlib"]
218219
asyncio_mode = "auto"
219220
asyncio_default_fixture_loop_scope="function"
220221
testpaths=["tests", "packages/**/*_tests"]
222+
filterwarnings= [
223+
'ignore:(\n)?.*you probably want.*:DeprecationWarning', # Ignore sqlmodel execute deprecation
224+
'ignore:.*route_prefix.*:DeprecationWarning', # Ignore asgi field deprecation
225+
'ignore::DeprecationWarning:jinja2',
226+
]
221227

222228
[tool.mypy]
223229
disallow_untyped_defs = true

src/lsst/cmservice/common/launchers.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,15 @@
66
from datetime import datetime
77
from typing import Any
88

9-
from pydantic import BaseModel, Field, field_serializer
9+
from pydantic import BaseModel, ConfigDict, Field, field_serializer
1010

1111
from lsst.cmservice.models.lib.timestamp import element_time
1212

1313

1414
class LauncherCheckResponse(BaseModel):
1515
"""A model describing a response from a Launcher's check method."""
1616

17-
class Config:
18-
validate_assignment = True
17+
model_config = ConfigDict(validate_assignment=True)
1918

2019
success: bool = Field(
2120
description="A boolean describing whether the check returned a successful result", default=False

src/lsst/cmservice/config.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -479,8 +479,10 @@ class AsgiConfiguration(BaseModel):
479479
description="The URL prefix used for API routers, i.e., a permanent subpath "
480480
"onto which the API routers are mounted. This should include a leading slash and no trailing slash.",
481481
default="",
482-
deprecated=True,
483-
examples=["cm-service"],
482+
deprecated="`route_prefix` is deprecated. Use `root_path` instead, which will cause uvicorn to "
483+
"rewrite any paths for the indicated reverse proxy/ingress path. For direct local access and tests, "
484+
"use the API version directly and alone in the URI.",
485+
examples=["/cm-service"],
484486
)
485487

486488
root_path: str = Field(

tests/v2/test_machines.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ async def test_group_prepare_replace(
395395
# Assert the artifact path exists
396396
group_path = group.metadata_.get("artifact_path")
397397
assert group_path is not None
398-
assert Path(group_path).exists()
398+
assert await Path(group_path).exists()
399399

400400
# Replace the group with a new version
401401
x = await aclient.patch(
@@ -433,7 +433,7 @@ async def test_group_prepare_replace(
433433
# group's path does not interfere
434434
group_path = group.metadata_.get("artifact_path")
435435
assert group_path is not None
436-
assert Path(group_path).exists()
436+
assert await Path(group_path).exists()
437437

438438

439439
async def test_group_fail_retry(
@@ -511,7 +511,7 @@ async def test_group_fail_retry(
511511
await group_machine.trigger("finish")
512512

513513
# The artifact path should exist
514-
assert Path(group_artifact_path).exists()
514+
assert await Path(group_artifact_path).exists()
515515

516516
await session.refresh(group, ["status"])
517517
group_status = group.status

uv.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)