From 58a6feb0c0b680991b51964337288b34c2fee603 Mon Sep 17 00:00:00 2001 From: Xiao Gui Date: Mon, 28 Oct 2024 12:44:44 +0100 Subject: [PATCH] debug: attempt to fix timeout --- siibra/deps/test_spatial_backend.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/siibra/deps/test_spatial_backend.py b/siibra/deps/test_spatial_backend.py index 98e6a1c..1583efb 100644 --- a/siibra/deps/test_spatial_backend.py +++ b/siibra/deps/test_spatial_backend.py @@ -26,10 +26,16 @@ def slowdown(): # spatial transform often struggles with successive requests # 1 sec sleep allow the requests to be spread out +@pytest.fixture(scope="session") +def session(): + sess = requests.Session() + sess.get(endpoint) + yield sess + @pytest.mark.parametrize("source_space, target_space", perm) -@pytest.mark.timeout(5) # 5 sec timeout -def test_spatial_transform(source_space: str, target_space: str): - resp = requests.post(endpoint, json={ +@pytest.mark.timeout(5, func_only=True) # 5 sec timeout +def test_spatial_transform(source_space: str, target_space: str, session): + resp = session.post(endpoint, json={ "source_points": [ [-56.180688,-32,35.406444], ], @@ -37,3 +43,4 @@ def test_spatial_transform(source_space: str, target_space: str): "target_space": target_space, }) resp.raise_for_status() + resp.json()