Skip to content

Commit 526c2d4

Browse files
committed
Guard against unforseen problems for decorating unvectorized tests
1 parent f46f45e commit 526c2d4

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

Diff for: conftest.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import os
77

88
from hypothesis import settings
9+
from hypothesis.errors import InvalidArgument
910
from pytest import mark
1011

1112
from array_api_tests import _array_module as xp
@@ -205,7 +206,13 @@ def pytest_collection_modifyitems(config, items):
205206
if any(m.name == "unvectorized" for m in markers):
206207
# TODO: limit generated examples when settings already applied
207208
if not hasattr(item.obj, "_hypothesis_internal_settings_applied"):
208-
item.obj = settings(max_examples=unvectorized_max_examples)(item.obj)
209+
try:
210+
item.obj = settings(max_examples=unvectorized_max_examples)(item.obj)
211+
except InvalidArgument as e:
212+
warnings.warn(
213+
f"Tried decorating {item.name} with settings() but got "
214+
f"hypothesis.errors.InvalidArgument: {e}"
215+
)
209216

210217

211218
# 3. Warn on bad skipped/xfailed ids

0 commit comments

Comments
 (0)