Skip to content

Commit ad1183e

Browse files
Add sleep time for WB and FB IDs
1 parent fb10806 commit ad1183e

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

tests/test_info.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,15 @@
22
import unittest.mock
33
import pandas as pd
44
import json
5+
import time
56
from gget.gget_info import info
67

78
# Load dictionary containing arguments and expected results
89
with open("./tests/fixtures/test_info.json") as json_file:
910
info_dict = json.load(json_file)
1011

12+
# Sleep time in seconds (wait [sleep_time] seconds between server requests to avoid 502 errors for WB and FB IDs)
13+
sleep_time = 10
1114

1215
# todo convert to json loading once wormbase & flybase IDs are fixed. At that point, the json test framework will need a way to handle the ANY values
1316
class TestInfo(unittest.TestCase):
@@ -17,6 +20,7 @@ def test_info_WB_transcript(self):
1720
test = "test2"
1821
expected_result = info_dict[test]["expected_result"]
1922
result_to_test = info(**info_dict[test]["args"])
23+
time.sleep(sleep_time)
2024
# If result is a DataFrame, convert to list
2125
if isinstance(result_to_test, pd.DataFrame):
2226
result_to_test = result_to_test.dropna(axis=1).values.tolist()
@@ -27,6 +31,7 @@ def test_info_FB_gene(self):
2731
test = "test3"
2832
expected_result = info_dict[test]["expected_result"]
2933
result_to_test = info(**info_dict[test]["args"])
34+
time.sleep(sleep_time)
3035
# If result is a DataFrame, convert to list
3136
if isinstance(result_to_test, pd.DataFrame):
3237
result_to_test = result_to_test.dropna(axis=1).values.tolist()

0 commit comments

Comments
 (0)