@@ -20,17 +20,19 @@ def __check_request(seconds, *args, **kwargs):
2020 time_taken = datetime .now () - now
2121 if check_stmts :
2222 assert resp .statements , "Got no statements."
23+ assert time_taken .total_seconds () < seconds , \
24+ "Request took too long: %s" % time_taken .total_seconds ()
2325 return resp
2426
2527
2628@pytest .mark .nonpublic
2729def test_simple_request ():
28- __check_request (6 , 'MAP2K1' , 'MAPK1' , stmt_type = 'Phosphorylation' )
30+ __check_request (40 , 'MAP2K1' , 'MAPK1' , stmt_type = 'Phosphorylation' )
2931
3032
3133@pytest .mark .nonpublic
3234def test_request_for_complex ():
33- __check_request (30 , agents = ['MEK@FPLX' , 'ERK@FPLX' ], stmt_type = 'Complex' )
35+ __check_request (100 , agents = ['MEK@FPLX' , 'ERK@FPLX' ], stmt_type = 'Complex' )
3436
3537
3638@pytest .mark .nonpublic
@@ -47,20 +49,20 @@ def test_null_request():
4749@pytest .mark .nonpublic
4850@pytest .mark .slow
4951def test_large_request ():
50- __check_request (40 , agents = ['AKT1' ])
52+ __check_request (100 , agents = ['AKT1' ])
5153
5254
5355@pytest .mark .nonpublic
5456@pytest .mark .slow
5557def test_bigger_request ():
56- __check_request (60 , agents = ['MAPK1' ])
58+ __check_request (100 , agents = ['MAPK1' ])
5759
5860
5961@pytest .mark .nonpublic
60- def test_timeout_no_persist_nfkb ():
61- resp = dbr .get_statements (agents = ["NFkappaB@FPLX " ], persist = False , timeout = 0 )
62+ def test_timeout_no_persist_gcg ():
63+ resp = dbr .get_statements (agents = ["GCG " ], persist = False , timeout = 0 )
6264 assert resp .is_working (), "Lookup resolved too fast."
63- resp .wait_until_done (70 )
65+ resp .wait_until_done (40 ) # typically 20-30 s when slow/uncached
6466 assert len (resp .statements ) > 0.9 * EXPECTED_BATCH_SIZE , len (resp .statements )
6567
6668
@@ -173,7 +175,7 @@ def test_regulate_amount():
173175
174176@pytest .mark .nonpublic
175177def test_get_statements_by_hash ():
176- hash_list = [30674674032092136 , - 22289282229858243 , - 25056605420392180 ]
178+ hash_list = [11163570810003104 , - 22289282229858243 , - 25056605420392180 ]
177179 p = dbr .get_statements_by_hash (hash_list )
178180 stmts = p .statements
179181 print ({s .get_hash (shallow = True ): s for s in stmts })
@@ -244,14 +246,16 @@ def test_get_statement_queries():
244246
245247@pytest .mark .nonpublic
246248def test_get_statements_end_on_limit ():
249+ """Test that the query ends when the limit is reached"""
247250 p = dbr .get_statements (subject = "TNF" , limit = 1400 , timeout = 1 )
248251 try :
249252 t = 0
250253 violations = 0
251254 violations_allowed = 3
252255 while p .is_working ():
253- assert t < 100 , t
254256 limit = p ._get_next_limit ()
257+ assert t < 100 , f"Test timed out with limit { limit } and" \
258+ f"{ violations } violations"
255259 if limit == 0 and p .is_working ():
256260 violations += 1
257261 assert violations <= violations_allowed
@@ -286,9 +290,12 @@ def test_get_statements_strict_stop_short():
286290
287291@pytest .mark .nonpublic
288292def test_get_statements_strict_stop_long ():
289- timeout = 31
293+ """Test that the query ends when the limit is reached"""
294+ timeout = 70 # Typically 30+ s when slow/uncached
290295 start = datetime .now ()
291- p = dbr .get_statements ("TNF" , timeout = timeout , strict_stop = True )
296+ p = dbr .get_statements (
297+ "VEGF" , timeout = timeout , strict_stop = True
298+ )
292299 end = datetime .now ()
293300 sleep (5 )
294301 assert not p .is_working ()
0 commit comments