Skip to content

Commit

Permalink
Complete tests configurations
Browse files Browse the repository at this point in the history
  • Loading branch information
lycantropos committed Apr 7, 2022
1 parent e6ab93f commit d3655f6
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,27 @@
import os
import platform
from datetime import timedelta

import pytest
from hypothesis import (HealthCheck,
settings)

on_ci = bool(os.getenv('CI', False))
is_pypy = platform.python_implementation() == 'PyPy'
max_examples = (-(-settings.default.max_examples // 10)
if is_pypy and on_ci
else settings.default.max_examples)
settings.register_profile('default',
max_examples=(settings.default.max_examples
// (1 + 9 * is_pypy)
if on_ci
else settings.default.max_examples),
deadline=None,
deadline=(timedelta(hours=1) / max_examples
if on_ci
else None),
max_examples=max_examples,
suppress_health_check=[HealthCheck.filter_too_much,
HealthCheck.too_slow])


@pytest.hookimpl(trylast=True)
def pytest_sessionfinish(session: pytest.Session,
exitstatus: pytest.ExitCode) -> None:
if exitstatus == pytest.ExitCode.NO_TESTS_COLLECTED:
session.exitstatus = pytest.ExitCode.OK

0 comments on commit d3655f6

Please sign in to comment.