File tree Expand file tree Collapse file tree 1 file changed +24
-9
lines changed
Expand file tree Collapse file tree 1 file changed +24
-9
lines changed Original file line number Diff line number Diff line change 11import json
22import logging
33import os
4+ import time
45from collections .abc import Iterator
56from pathlib import Path
67from typing import Literal
@@ -170,8 +171,15 @@ def test_retrieve_init_args(
170171 pipeline_id = pipeline_id ,
171172 num_results = 2 ,
172173 )
173- docs = retriever .invoke (input = "What are you?" )
174- assert len (docs ) == 2
174+ start = time .time ()
175+ while True :
176+ docs = retriever .invoke (input = "What are you?" )
177+ if len (docs ) == 2 :
178+ break
179+ if time .time () - start > 180 :
180+ msg = "Docs not retrieved in time"
181+ raise RuntimeError (msg )
182+ time .sleep (1 )
175183
176184
177185def test_retrieve_invoke_args (
@@ -181,10 +189,17 @@ def test_retrieve_invoke_args(
181189 pipeline_id : str ,
182190) -> None :
183191 retriever = VectorizeRetriever (environment = environment , api_token = api_token )
184- docs = retriever .invoke (
185- input = "What are you?" ,
186- organization = org_id ,
187- pipeline_id = pipeline_id ,
188- num_results = 2 ,
189- )
190- assert len (docs ) == 2
192+ start = time .time ()
193+ while True :
194+ docs = retriever .invoke (
195+ input = "What are you?" ,
196+ organization = org_id ,
197+ pipeline_id = pipeline_id ,
198+ num_results = 2 ,
199+ )
200+ if len (docs ) == 2 :
201+ break
202+ if time .time () - start > 180 :
203+ msg = "Docs not retrieved in time"
204+ raise RuntimeError (msg )
205+ time .sleep (1 )
You can’t perform that action at this time.
0 commit comments