From 5c9b7a6ab1b9430432e58ceda38d2524e62d8947 Mon Sep 17 00:00:00 2001 From: Adam Dangoor Date: Sun, 19 Apr 2026 09:59:59 +0100 Subject: [PATCH 1/2] Use pytest-beartype-tests plugin for test beartype Replace manual pytest_collection_modifyitems hooks with the https://github.com/adamtheturtle/pytest-beartype-tests dev dependency. Made-with: Cursor --- conftest.py | 9 --------- pyproject.toml | 4 ++++ 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/conftest.py b/conftest.py index 93484cd3e..72eedd78c 100644 --- a/conftest.py +++ b/conftest.py @@ -12,15 +12,6 @@ from tests.mock_vws.utils.retries import RETRY_EXCEPTIONS - -@beartype -def pytest_collection_modifyitems(items: list[pytest.Item]) -> None: - """Apply the beartype decorator to all collected test functions.""" - for item in items: - if isinstance(item, pytest.Function): - item.obj = beartype(obj=item.obj) - - pytest_collect_file = Sybil( parsers=[ DocTestParser(optionflags=ELLIPSIS), diff --git a/pyproject.toml b/pyproject.toml index 293256d0d..8e111ccd8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -77,6 +77,7 @@ optional-dependencies.dev = [ "pyright==1.1.408", "pyroma==5.0.1", "pytest==9.0.3", + "pytest-beartype-tests==2026.4.19.1", "pytest-retry==1.7.0", "pytest-xdist==3.8.0", "pyyaml==6.0.3", @@ -114,6 +115,9 @@ optional-dependencies.release = [ "check-wheel-contents==0.6.3" ] urls.Documentation = "https://vws-python.github.io/vws-python-mock/" urls.Source = "https://github.com/VWS-Python/vws-python-mock" +[dependency-groups] +dev = [] + [tool.setuptools] zip-safe = false package-data.mock_vws = [ From 43b5b5186daeb6df89ce20a736d50adf0c983d74 Mon Sep 17 00:00:00 2001 From: Adam Dangoor Date: Sun, 19 Apr 2026 10:10:53 +0100 Subject: [PATCH 2/2] Pin pytest-beartype-tests to git revision (Sybil-safe) Use git+https dependency until the next PyPI release includes https://github.com/adamtheturtle/pytest-beartype-tests/commit/bc81d99. --- pyproject.toml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 8e111ccd8..ec141ca87 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -77,7 +77,7 @@ optional-dependencies.dev = [ "pyright==1.1.408", "pyroma==5.0.1", "pytest==9.0.3", - "pytest-beartype-tests==2026.4.19.1", + "pytest-beartype-tests", "pytest-retry==1.7.0", "pytest-xdist==3.8.0", "pyyaml==6.0.3", @@ -145,6 +145,7 @@ fallback_version = "0.0.0" version_scheme = "post-release" [tool.uv] +sources.pytest-beartype-tests = { git = "https://github.com/adamtheturtle/pytest-beartype-tests.git", rev = "bc81d99" } sources.torch = { index = "pytorch-cpu" } sources.torchvision = { index = "pytorch-cpu" } index = [ { name = "pytorch-cpu", url = "https://download.pytorch.org/whl/cpu", explicit = true } ]