Skip to content

Commit

Permalink
conftest.py updates
Browse files Browse the repository at this point in the history
* Set max examples default to 20
  * For faster default runs, over more test quality
* Remove unreachable loading default settings path
  • Loading branch information
honno committed Mar 22, 2024
1 parent 07c8cd0 commit 36f4c1e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ jobs:
env:
ARRAY_API_TESTS_MODULE: array_api_strict
run: |
pytest -v -rxXfE --skips-file array-api-strict-skips.txt array_api_tests/
pytest -v -rxXfE --skips-file array-api-strict-skips.txt array_api_tests/ --hypothesis-disable-deadline
# We also have internal tests that isn't really necessary for adopters
pytest -v -rxXfE meta_tests/
24 changes: 8 additions & 16 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

from reporting import pytest_metadata, pytest_json_modifyreport, add_extra_json_metadata # noqa

settings.register_profile("xp_default", deadline=800)

def pytest_addoption(parser):
# Hypothesis max examples
Expand Down Expand Up @@ -87,21 +86,14 @@ def pytest_configure(config):
"unvectorized: asserts against values via element-wise iteration (not performative!)",
)
# Hypothesis
hypothesis_max_examples = config.getoption("--hypothesis-max-examples")
disable_deadline = config.getoption("--hypothesis-disable-deadline")
derandomize = config.getoption("--hypothesis-derandomize")
profile_settings = {}
if hypothesis_max_examples is not None:
profile_settings["max_examples"] = int(hypothesis_max_examples)
if disable_deadline:
profile_settings = {
"max_examples": config.getoption("--hypothesis-max-examples"),
"derandomize": config.getoption("--hypothesis-derandomize"),
}
if config.getoption("--hypothesis-disable-deadline"):
profile_settings["deadline"] = None
if derandomize:
profile_settings["derandomize"] = True
if profile_settings:
settings.register_profile("xp_override", **profile_settings)
settings.load_profile("xp_override")
else:
settings.load_profile("xp_default")
settings.register_profile("array-api-tests", **profile_settings)
settings.load_profile("array-api-tests")
# CI
if config.getoption("--ci"):
warnings.warn(
Expand Down Expand Up @@ -156,7 +148,7 @@ def pytest_collection_modifyitems(config, items):

disabled_exts = config.getoption("--disable-extension")
disabled_dds = config.getoption("--disable-data-dependent-shapes")
unvectorized_max_examples = math.ceil(math.log(int(config.getoption("--hypothesis-max-examples")) or 50))
unvectorized_max_examples = math.ceil(math.log(config.getoption("--hypothesis-max-examples")))

# 2. Iterate through items and apply markers accordingly
# ------------------------------------------------------
Expand Down

0 comments on commit 36f4c1e

Please sign in to comment.