Skip to content

Commit 34c7fdc

Browse files
committed
Use pytest-beartype rather than decorating test functions
1 parent 7f9f33b commit 34c7fdc

File tree

2 files changed

+2
-10
lines changed

2 files changed

+2
-10
lines changed

conftest.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
from pathlib import Path
1010

1111
import pytest
12-
from beartype import beartype
1312
from mock_vws import MockVWS
1413
from mock_vws.database import VuforiaDatabase
1514
from sybil import Sybil
@@ -20,15 +19,6 @@
2019
)
2120

2221

23-
def pytest_collection_modifyitems(items: list[pytest.Item]) -> None:
24-
"""
25-
Apply the beartype decorator to all collected test functions.
26-
"""
27-
for item in items:
28-
if isinstance(item, pytest.Function):
29-
item.obj = beartype(obj=item.obj)
30-
31-
3222
@pytest.fixture(name="make_image_file")
3323
def fixture_make_image_file(
3424
high_quality_image: io.BytesIO,

pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ optional-dependencies.dev = [
5757
"pyright==1.1.405",
5858
"pyroma==5.0",
5959
"pytest==8.4.2",
60+
"pytest-beartype>=0.2.0",
6061
"pytest-cov==7.0.0",
6162
"pyyaml==6.0.2",
6263
"ruff==0.13.0",
@@ -316,6 +317,7 @@ max_supported_python = "3.13"
316317

317318
xfail_strict = true
318319
log_cli = true
320+
addopts = "--beartype-packages=tests"
319321

320322
[tool.coverage.run]
321323

0 commit comments

Comments
 (0)