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 16, 2022
1 parent d11b563 commit 648a0cc
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,28 @@
import platform

import pytest
from datetime import timedelta
from ground.base import (Context,
get_context)
from hypothesis import (HealthCheck,
settings)
from hypothesis import settings

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


@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


@pytest.fixture(scope='session')
Expand Down

0 comments on commit 648a0cc

Please sign in to comment.