Skip to content

Commit f1189c8

Browse files
committed
Run beartype on all tests
1 parent 7fe320b commit f1189c8

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

conftest.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,25 @@
22

33
from doctest import ELLIPSIS
44

5+
import pytest
6+
from beartype import beartype
57
from sybil import Sybil
68
from sybil.parsers.rest import (
79
ClearNamespaceParser,
810
DocTestParser,
911
PythonCodeBlockParser,
1012
)
1113

14+
15+
def pytest_collection_modifyitems(items: list[pytest.Item]) -> None:
16+
"""
17+
Apply the beartype decorator to all collected test functions.
18+
"""
19+
for item in items:
20+
if isinstance(item, pytest.Function):
21+
item.obj = beartype(obj=item.obj)
22+
23+
1224
pytest_collect_file = Sybil(
1325
parsers=[
1426
ClearNamespaceParser(),

0 commit comments

Comments
 (0)