File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change 1
1
import os
2
2
import sys
3
+ import zlib
3
4
from pathlib import Path
4
5
5
6
import pytest
7
+ from tenacity import Retrying , retry_if_exception_type , stop_after_attempt
6
8
7
9
from paperqa import Docs
8
10
from paperqa .settings import Settings
@@ -76,7 +78,13 @@ def test_cli_can_build_and_search_index(
76
78
settings .agent .index .paper_directory = rel_path_home_to_stub_data
77
79
settings .agent .index .index_directory = agent_index_dir
78
80
index_name = "test"
79
- build_index (index_name , stub_data_dir , settings )
81
+ for attempt in Retrying (
82
+ stop = stop_after_attempt (3 ),
83
+ # zlib.error: Error -5 while decompressing data: incomplete or truncated stream
84
+ retry = retry_if_exception_type (zlib .error ),
85
+ ):
86
+ with attempt :
87
+ build_index (index_name , stub_data_dir , settings )
80
88
result = search_query ("XAI" , index_name , settings )
81
89
assert len (result ) == 1
82
90
assert isinstance (result [0 ][0 ], Docs )
You can’t perform that action at this time.
0 commit comments