From 6cd6356c2e82bae8f690a75402f64e3c8558bc46 Mon Sep 17 00:00:00 2001 From: Adam Dangoor Date: Sun, 19 Apr 2026 09:55: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. --- pyproject.toml | 5 ++++- tests/conftest.py | 9 --------- uv.lock | 18 ++++++++++++++++++ 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 11b18923..6f15e2e3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -86,6 +86,7 @@ optional-dependencies.dev = [ "vws-test-fixtures==2023.3.5", "yamlfix==1.19.1", "zizmor==1.24.1", + "pytest-beartype-tests==2026.4.19.1", ] optional-dependencies.release = [ "check-wheel-contents==0.6.3", @@ -364,7 +365,6 @@ ignore_path = [ ignore_names = [ # pytest configuration "pytest_collect_file", - "pytest_collection_modifyitems", "pytest_plugins", # pytest fixtures - we name fixtures like this for this purpose "fixture_*", @@ -405,3 +405,6 @@ exclude = [ [tool.yamlfix] section_whitelines = 1 whitelines = 1 + +[dependency-groups] +dev = [] diff --git a/tests/conftest.py b/tests/conftest.py index 3810e32a..836a94d6 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -3,21 +3,12 @@ from collections.abc import Iterator import pytest -from beartype import beartype from mock_vws import MockVWS from mock_vws.database import CloudDatabase, VuMarkDatabase from mock_vws.target import VuMarkTarget from vws import VWS, CloudRecoService -@beartype -def pytest_collection_modifyitems(items: list[pytest.Item]) -> None: - """Apply the beartype decorator to all collected test functions.""" - for item in items: - assert isinstance(item, pytest.Function) - item.obj = beartype(obj=item.obj) - - @pytest.fixture(name="mock_database") def fixture_mock_database() -> Iterator[CloudDatabase]: """Yield a mock ``CloudDatabase``.""" diff --git a/uv.lock b/uv.lock index 31535d2d..8ee1dcd7 100644 --- a/uv.lock +++ b/uv.lock @@ -1401,6 +1401,19 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/d4/24/a372aaf5c9b7208e7112038812994107bc65a84cd00e0354a88c2c77a617/pytest-9.0.3-py3-none-any.whl", hash = "sha256:2c5efc453d45394fdd706ade797c0a81091eccd1d6e4bccfcd476e2b8e0ab5d9", size = 375249, upload-time = "2026-04-07T17:16:16.13Z" }, ] +[[package]] +name = "pytest-beartype-tests" +version = "2026.4.19.1" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "beartype" }, + { name = "pytest" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/4c/85/2a4abab012ea412757aee0c77a63759c9df997456ae75dc0a590071bf11d/pytest_beartype_tests-2026.4.19.1.tar.gz", hash = "sha256:02662a7c189666eac26d5994d8d750106c73b0cd31ed0d01222db59ba1cb6e5a", size = 85947, upload-time = "2026-04-19T07:56:18.409Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/d2/c0/8c57af81595948ddab76b78635931ed5adac38fc46565e8419dc3a5046b3/pytest_beartype_tests-2026.4.19.1-py3-none-any.whl", hash = "sha256:20618dd92dc2c8e1cab94f5984a382c95d03376ef94558e54665908e56ad8cc4", size = 5198, upload-time = "2026-04-19T07:56:16.711Z" }, +] + [[package]] name = "pytest-cov" version = "7.1.0" @@ -2345,6 +2358,7 @@ dev = [ { name = "pyright" }, { name = "pyroma" }, { name = "pytest" }, + { name = "pytest-beartype-tests" }, { name = "pytest-cov" }, { name = "pytest-regressions" }, { name = "ruff" }, @@ -2401,6 +2415,7 @@ requires-dist = [ { name = "pyright", marker = "extra == 'dev'", specifier = "==1.1.408" }, { name = "pyroma", marker = "extra == 'dev'", specifier = "==5.0.1" }, { name = "pytest", marker = "extra == 'dev'", specifier = "==9.0.3" }, + { name = "pytest-beartype-tests", marker = "extra == 'dev'", specifier = "==2026.4.19.1" }, { name = "pytest-cov", marker = "extra == 'dev'", specifier = "==7.1.0" }, { name = "pytest-regressions", marker = "extra == 'dev'", specifier = "==2.10.0" }, { name = "pyyaml", specifier = "==6.0.3" }, @@ -2429,6 +2444,9 @@ requires-dist = [ ] provides-extras = ["dev", "release"] +[package.metadata.requires-dev] +dev = [] + [[package]] name = "vws-python" version = "2026.2.25.1" From 7310c1ac3443fef07bb4de47dcd6e2b4e3a7a1e9 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci-lite[bot]" <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com> Date: Sun, 19 Apr 2026 08:57:15 +0000 Subject: [PATCH 2/2] [pre-commit.ci lite] apply automatic fixes --- pyproject.toml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 6f15e2e3..a535b1f9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -57,6 +57,7 @@ optional-dependencies.dev = [ "pyright==1.1.408", "pyroma==5.0.1", "pytest==9.0.3", + "pytest-beartype-tests==2026.4.19.1", "pytest-cov==7.1.0", "pytest-regressions==2.10.0", "ruff==0.15.11", @@ -86,7 +87,6 @@ optional-dependencies.dev = [ "vws-test-fixtures==2023.3.5", "yamlfix==1.19.1", "zizmor==1.24.1", - "pytest-beartype-tests==2026.4.19.1", ] optional-dependencies.release = [ "check-wheel-contents==0.6.3", @@ -98,6 +98,9 @@ scripts.vuforia-cloud-reco = "vws_cli.query:vuforia_cloud_reco" scripts.vumark = "vws_cli.vumark:generate_vumark" scripts.vws = "vws_cli:vws_group" +[dependency-groups] +dev = [] + [tool.setuptools] zip-safe = false package-data.vws_cli = [ @@ -405,6 +408,3 @@ exclude = [ [tool.yamlfix] section_whitelines = 1 whitelines = 1 - -[dependency-groups] -dev = []