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 11from functools import lru_cache
22from pathlib import Path
3+ import math
34import warnings
45import os
56
@@ -145,6 +146,7 @@ def pytest_collection_modifyitems(config, items):
145146
146147 disabled_exts = config .getoption ("--disable-extension" )
147148 disabled_dds = config .getoption ("--disable-data-dependent-shapes" )
149+ unvectorized_max_examples = math .ceil (math .log (config .getoption ("--hypothesis-max-examples" ) or 50 ))
148150
149151 # 2. Iterate through items and apply markers accordingly
150152 # ------------------------------------------------------
@@ -191,6 +193,12 @@ def pytest_collection_modifyitems(config, items):
191193 reason = f"requires ARRAY_API_TESTS_VERSION=>{ min_version } "
192194 )
193195 )
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+
194202
195203 # 3. Warn on bad skipped/xfailed ids
196204 # ----------------------------------
You can’t perform that action at this time.
0 commit comments