Merge pull request #486 from exarkun/2915.disable-hypothesis-deadline

Disable hypothesis deadline and "too slow" health check on CI
This commit is contained in:
Jean-Paul Calderone 2018-04-04 07:32:13 -04:00 committed by GitHub
commit 890360c8ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 34 additions and 4 deletions

View File

@ -7,6 +7,10 @@ before_cache:
git: git:
depth: 1000 depth: 1000
env:
global:
- TAHOE_LAFS_HYPOTHESIS_PROFILE=ci
install: install:
# ~/.local/bin is on $PATH by default, but on OS-X, --user puts it elsewhere # ~/.local/bin is on $PATH by default, but on OS-X, --user puts it elsewhere
- if [ "${TRAVIS_OS_NAME}" = "osx" ]; then export PATH=$HOME/Library/Python/2.7/bin:$PATH; fi - if [ "${TRAVIS_OS_NAME}" = "osx" ]; then export PATH=$HOME/Library/Python/2.7/bin:$PATH; fi

View File

@ -25,6 +25,34 @@ def disable_foolscap_incidents():
# we disable incident reporting for all unit tests. # we disable incident reporting for all unit tests.
disable_foolscap_incidents() disable_foolscap_incidents()
def _configure_hypothesis():
from os import environ
from hypothesis import (
HealthCheck,
settings,
)
settings.register_profile(
"ci",
suppress_health_check=[
# CPU resources available to CI builds typically varies
# significantly from run to run making it difficult to determine
# if "too slow" data generation is a result of the code or the
# execution environment. Prevent these checks from
# (intermittently) failing tests that are otherwise fine.
HealthCheck.too_slow,
],
# With the same reasoning, disable the test deadline.
deadline=None,
)
profile_name = environ.get("TAHOE_LAFS_HYPOTHESIS_PROFILE", "default")
settings.load_profile(profile_name)
_configure_hypothesis()
import sys import sys
if sys.platform == "win32": if sys.platform == "win32":
from allmydata.windows.fixups import initialize from allmydata.windows.fixups import initialize

View File

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from twisted.trial import unittest from twisted.trial import unittest
from hypothesis import given, settings, HealthCheck from hypothesis import given
from hypothesis.strategies import text, sets from hypothesis.strategies import text, sets
from allmydata.immutable import happiness_upload from allmydata.immutable import happiness_upload
@ -225,7 +225,6 @@ class PlacementTests(unittest.TestCase):
sets(elements=text(min_size=1, max_size=30), min_size=4, max_size=4), sets(elements=text(min_size=1, max_size=30), min_size=4, max_size=4),
sets(elements=text(min_size=1, max_size=30), min_size=4), sets(elements=text(min_size=1, max_size=30), min_size=4),
) )
@settings(suppress_health_check=[HealthCheck.too_slow])
def test_hypothesis_unhappy(self, peers, shares): def test_hypothesis_unhappy(self, peers, shares):
""" """
similar to test_unhappy we test that the resulting happiness is similar to test_unhappy we test that the resulting happiness is
@ -245,7 +244,6 @@ class PlacementTests(unittest.TestCase):
# can we make a readonly_peers that's a subset of ^ # can we make a readonly_peers that's a subset of ^
sets(elements=text(min_size=1, max_size=30), min_size=1, max_size=20), sets(elements=text(min_size=1, max_size=30), min_size=1, max_size=20),
) )
@settings(suppress_health_check=[HealthCheck.too_slow])
def test_more_hypothesis(self, peers, shares): def test_more_hypothesis(self, peers, shares):
""" """
similar to test_unhappy we test that the resulting happiness is similar to test_unhappy we test that the resulting happiness is

View File

@ -13,7 +13,7 @@ skipsdist = True
[testenv] [testenv]
basepython=python2.7 basepython=python2.7
passenv = TAHOE_LAFS_TRIAL_ARGS USERPROFILE HOMEDRIVE HOMEPATH passenv = TAHOE_LAFS_* USERPROFILE HOMEDRIVE HOMEPATH
# Pre-install "incremental" to avoid bug #2913. Basically if Twisted's # Pre-install "incremental" to avoid bug #2913. Basically if Twisted's
# setup_requires=["incremental"] causes this to be installed (with # setup_requires=["incremental"] causes this to be installed (with
# setuptools), then it'll fail on travis's OS-X 10.12 machines when PyPI # setuptools), then it'll fail on travis's OS-X 10.12 machines when PyPI