From d39efbc8112509eca774ca3003f17a949d44ac60 Mon Sep 17 00:00:00 2001 From: gonzaponte Date: Fri, 22 Nov 2019 19:50:56 +0200 Subject: [PATCH 1/6] Suppress HealthChecks in spefic tests --- invisible_cities/reco/monitor_functions_test.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/invisible_cities/reco/monitor_functions_test.py b/invisible_cities/reco/monitor_functions_test.py index b83e40d5f8..231f605d8d 100644 --- a/invisible_cities/reco/monitor_functions_test.py +++ b/invisible_cities/reco/monitor_functions_test.py @@ -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 @@ -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) @@ -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) From 61aa115a8b80bed59427dc668bb66f308f66ab08 Mon Sep 17 00:00:00 2001 From: Gonzalo Date: Tue, 10 Mar 2020 21:10:11 +0200 Subject: [PATCH 2/6] Remove parallel execution of tests To see if this is causing the problem --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 69ebb7e917..f553ac76cd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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=hard bash manage.sh run_tests From d4537ec39d2a7b25858098264993aa50d2eb36d2 Mon Sep 17 00:00:00 2001 From: Gonzalo Date: Tue, 10 Mar 2020 22:05:22 +0200 Subject: [PATCH 3/6] Create new hypothesis profile with increased deadline --- conftest.py | 1 + 1 file changed, 1 insertion(+) diff --git a/conftest.py b/conftest.py index 71ad854e6d..b45e9aa305 100644 --- a/conftest.py +++ b/conftest.py @@ -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)) From 65d3cdf9981480d7fa12e8ce5d12cbcef86bf871 Mon Sep 17 00:00:00 2001 From: Gonzalo Date: Tue, 10 Mar 2020 22:05:58 +0200 Subject: [PATCH 4/6] Run new profile on travis --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index f553ac76cd..a1868111eb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 + - HYPOTHESIS_PROFILE=travis-ci bash manage.sh run_tests From c958cc30bbad11e533f4c1c01070f2010f260313 Mon Sep 17 00:00:00 2001 From: Gonzalo Date: Tue, 10 Mar 2020 23:09:58 +0200 Subject: [PATCH 5/6] Go back to running tests in parallel, but without forcing #procesors --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index a1868111eb..1c183a008d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,4 +21,4 @@ install: - source manage.sh work_in_python_version_no_tests ${IC_PYTHON_VERSION} script: - - HYPOTHESIS_PROFILE=travis-ci bash manage.sh run_tests + - HYPOTHESIS_PROFILE=travis-ci bash manage.sh run_tests_par From 3fb5a6a9b500dd5908ac8ad5632b2c1e1b24e8ab Mon Sep 17 00:00:00 2001 From: Gonzalo Date: Mon, 9 Mar 2020 15:22:31 +0200 Subject: [PATCH 6/6] Limit the size of drawn dataframes drawn in test --- invisible_cities/core/testing_utils_test.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/invisible_cities/core/testing_utils_test.py b/invisible_cities/core/testing_utils_test.py index cb6e9e147b..74a354269b 100644 --- a/invisible_cities/core/testing_utils_test.py +++ b/invisible_cities/core/testing_utils_test.py @@ -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 @@ -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)