Skip to content

Commit

Permalink
test: none regular file
Browse files Browse the repository at this point in the history
  • Loading branch information
ZiniuYu committed Jul 12, 2022
1 parent 56d0dd3 commit 94008ac
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
1 change: 0 additions & 1 deletion server/clip_server/model/clip.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ def _download(
os.path.getsize(tmp_file_path) if os.path.exists(tmp_file_path) else 0
)

total_bytes = -1
try:
# resolve the 403 error by passing a valid user-agent
req = urllib.request.Request(url, headers={'User-Agent': 'Mozilla/5.0'})
Expand Down
16 changes: 16 additions & 0 deletions tests/test_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,22 @@ def test_server_download_md5(tmpdir, md5):
)


def test_server_download_not_regular_file(tmpdir):
with pytest.raises(Exception):
_download(
url='https://docarray.jina.ai/_static/favicon.png',
target_folder=tmpdir,
md5sum='',
with_resume=False,
)
_download(
url='https://docarray.jina.ai/_static/',
target_folder=tmpdir,
md5sum='',
with_resume=False,
)


def test_make_onnx_flow_custom_path_wrong_name(port_generator):
from clip_server.executors.clip_onnx import CLIPEncoder

Expand Down

0 comments on commit 94008ac

Please sign in to comment.