Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix hypothesis health checks #680

Merged
merged 6 commits into from
Mar 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ install:
- source manage.sh work_in_python_version_no_tests ${IC_PYTHON_VERSION}

script:
- HYPOTHESIS_PROFILE=hard bash manage.sh run_tests_par 4
- HYPOTHESIS_PROFILE=travis-ci bash manage.sh run_tests_par
1 change: 1 addition & 0 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from hypothesis import Verbosity

# In addition to the 'default' profile, we provide
settings.register_profile("travis-ci" , settings(max_examples = 1000, deadline=300))
settings.register_profile("hard" , settings(max_examples = 1000))
settings.register_profile("dev" , settings(max_examples = 10))
settings.register_profile("hard_nocov", settings(max_examples = 1000, use_coverage=False))
Expand Down
4 changes: 3 additions & 1 deletion invisible_cities/core/testing_utils_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from hypothesis.strategies import integers
from hypothesis. extra.pandas import data_frames
from hypothesis. extra.pandas import column
from hypothesis. extra.pandas import range_indexes
from . testing_utils import all_elements_close
from . testing_utils import assert_tables_equality

Expand All @@ -31,7 +32,8 @@ def test_all_elements_close_par(mu, sigma):

@given(data_frames([column('A', dtype=int ),
column('B', dtype=float),
column('C', dtype=str )]))
column('C', dtype=str )],
index = range_indexes(max_size=5)))
def test_assert_tables_equality(df):
table = df.to_records(index=False)
assert_tables_equality(table, table)
Expand Down
5 changes: 3 additions & 2 deletions invisible_cities/reco/monitor_functions_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

from hypothesis import given
from hypothesis import settings
from hypothesis import HealthCheck
from hypothesis.extra.pandas import columns, data_frames
from hypothesis.strategies import floats

Expand Down Expand Up @@ -417,7 +418,7 @@ def test_kdst_bins():


@given(data_frames(columns=columns(kdst_variables, elements=floats(allow_nan=False))))
@settings(deadline=None)
@settings(deadline=None, suppress_health_check=(HealthCheck.too_slow,))
def test_fill_kdst_var_1d(kdst):
var_dict = defaultdict(list)
monf.fill_kdst_var_1d (kdst, var_dict)
Expand All @@ -430,7 +431,7 @@ def test_fill_kdst_var_1d(kdst):


@given(data_frames(columns=columns(kdst_variables, elements=floats(allow_nan=False))))
@settings(deadline=None)
@settings(deadline=None, suppress_health_check=(HealthCheck.too_slow,))
def test_fill_kdst_var_2d(kdst):
var_dict = defaultdict(list)
monf.fill_kdst_var_1d (kdst, var_dict)
Expand Down