From 8b03425f00eb39cdd0a795d45b7ffc7769864127 Mon Sep 17 00:00:00 2001 From: Luis Aleixo Date: Mon, 9 May 2022 17:15:14 +0200 Subject: [PATCH 1/3] added retry decorator with default values --- cara/tests/test_monte_carlo_full_models.py | 2 ++ requirements.txt | 2 ++ 2 files changed, 4 insertions(+) diff --git a/cara/tests/test_monte_carlo_full_models.py b/cara/tests/test_monte_carlo_full_models.py index caed9c52..e5a25516 100644 --- a/cara/tests/test_monte_carlo_full_models.py +++ b/cara/tests/test_monte_carlo_full_models.py @@ -1,6 +1,7 @@ import numpy as np import numpy.testing as npt import pytest +from retry import retry import cara.monte_carlo as mc from cara import models,data @@ -309,6 +310,7 @@ def waiting_room_mc(): ) +@retry() @pytest.mark.parametrize( "mc_model, expected_pi, expected_new_cases, expected_dose, expected_ER", [ diff --git a/requirements.txt b/requirements.txt index 724bf5cc..a7a970cb 100644 --- a/requirements.txt +++ b/requirements.txt @@ -64,6 +64,7 @@ python-dateutil==2.8.2 pyzmq==22.1.0 requests==2.26.0 requests-unixsocket==0.2.0 +retry==0.9.2 scikit-learn==0.24.2 scipy==1.7.0 Send2Trash==1.7.1 @@ -76,6 +77,7 @@ threadpoolctl==2.2.0 timezonefinder==5.2.0 tornado==6.1 traitlets==5.0.5 +types-retry==0.9.7 urllib3==1.26.6 voila==0.2.10 wcwidth==0.2.5 From e3d9dc66ff50f4de57b440e67feaf2401344b2d2 Mon Sep 17 00:00:00 2001 From: Luis Aleixo Date: Mon, 9 May 2022 17:20:23 +0200 Subject: [PATCH 2/3] added retry requirement to setup.py --- setup.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/setup.py b/setup.py index e8136836..bc035ea7 100644 --- a/setup.py +++ b/setup.py @@ -30,10 +30,12 @@ REQUIREMENTS: dict = { 'numpy', 'psutil', 'python-dateutil', + 'retry', 'scipy', 'sklearn', 'timezonefinder', 'tornado', + 'types-retry', 'voila >=0.2.4', ], 'app': [], From 45a8e73a487f3b50431e7bece6057621aa355436 Mon Sep 17 00:00:00 2001 From: Luis Aleixo Date: Tue, 10 May 2022 17:02:40 +0200 Subject: [PATCH 3/3] added retry decorator on test_webapp.py --- cara/tests/apps/calculator/test_webapp.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cara/tests/apps/calculator/test_webapp.py b/cara/tests/apps/calculator/test_webapp.py index e6b4eedf..fa5e37cc 100644 --- a/cara/tests/apps/calculator/test_webapp.py +++ b/cara/tests/apps/calculator/test_webapp.py @@ -2,11 +2,12 @@ from pathlib import Path import pytest import tornado.testing +from retry import retry import cara.apps.calculator from cara.apps.calculator.report_generator import generate_permalink -_TIMEOUT = 30. +_TIMEOUT = 20. @pytest.fixture def app(): @@ -42,6 +43,7 @@ async def test_404(http_server_client): assert resp.code == 404 +@retry() class TestBasicApp(tornado.testing.AsyncHTTPTestCase): def get_app(self): return cara.apps.calculator.make_app() @@ -70,6 +72,7 @@ class TestBasicApp(tornado.testing.AsyncHTTPTestCase): assert 'expected number of new cases is' in response.body.decode() +@retry() class TestCernApp(tornado.testing.AsyncHTTPTestCase): def get_app(self): cern_theme = Path(cara.apps.calculator.__file__).parent.parent / 'themes' / 'cern' @@ -82,6 +85,7 @@ class TestCernApp(tornado.testing.AsyncHTTPTestCase): assert 'expected number of new cases is' in response.body.decode() +retry() class TestOpenApp(tornado.testing.AsyncHTTPTestCase): def get_app(self): return cara.apps.calculator.make_app(calculator_prefix="/mycalc")