File tree Expand file tree Collapse file tree 1 file changed +5
-11
lines changed
_test_unstructured_client Expand file tree Collapse file tree 1 file changed +5
-11
lines changed Original file line number Diff line number Diff line change 11import pytest
22import logging
3+ import re
34
45import requests_mock
56
@@ -27,10 +28,7 @@ def test_retry_with_backoff_does_retry(caplog):
2728 session = UnstructuredClient (api_key_auth = FAKE_KEY )
2829
2930 with open (filename , "rb" ) as f :
30- files = shared .Files (
31- content = f .read (),
32- file_name = filename ,
33- )
31+ files = shared .Files (content = f .read (), file_name = filename )
3432
3533 req = shared .PartitionParameters (files = files )
3634
@@ -59,14 +57,10 @@ def test_backoff_strategy_logs_retries(caplog):
5957 session = UnstructuredClient (api_key_auth = FAKE_KEY )
6058
6159 with open (filename , "rb" ) as f :
62- files = shared .Files (
63- content = f .read (),
64- file_name = filename ,
65- )
60+ files = shared .Files (content = f .read (), file_name = filename )
6661
6762 req = shared .PartitionParameters (files = files )
6863 with pytest .raises (Exception ):
6964 session .general .partition (req , retries = retries )
70-
71-
72- assert "seconds before retry" in caplog .text
65+ pattern = re .compile (f"{ re .escape ('Retry attempt #1. Sleeping' )} .*{ 'seconds before retry' } " )
66+ assert bool (pattern .search (caplog .text ))
You can’t perform that action at this time.
0 commit comments