File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change 1
1
from functools import lru_cache
2
2
from pathlib import Path
3
+ import math
3
4
import warnings
4
5
import os
5
6
@@ -145,6 +146,7 @@ def pytest_collection_modifyitems(config, items):
145
146
146
147
disabled_exts = config .getoption ("--disable-extension" )
147
148
disabled_dds = config .getoption ("--disable-data-dependent-shapes" )
149
+ unvectorized_max_examples = math .ceil (math .log (config .getoption ("--hypothesis-max-examples" ) or 50 ))
148
150
149
151
# 2. Iterate through items and apply markers accordingly
150
152
# ------------------------------------------------------
@@ -191,6 +193,12 @@ def pytest_collection_modifyitems(config, items):
191
193
reason = f"requires ARRAY_API_TESTS_VERSION=>{ min_version } "
192
194
)
193
195
)
196
+ # reduce max generated Hypothesis example for unvectorized tests
197
+ if any (m .name == "unvectorized" for m in markers ):
198
+ # TODO: limit generated examples when settings already applied
199
+ if not hasattr (item .obj , "_hypothesis_internal_settings_applied" ):
200
+ item .obj = settings (max_examples = unvectorized_max_examples )(item .obj )
201
+
194
202
195
203
# 3. Warn on bad skipped/xfailed ids
196
204
# ----------------------------------
You can’t perform that action at this time.
0 commit comments