Skip to content

Commit

Permalink
fix: unittest
Browse files Browse the repository at this point in the history
  • Loading branch information
numb3r3 committed Jul 21, 2022
1 parent 031bd45 commit 4839d19
Showing 1 changed file with 6 additions and 27 deletions.
33 changes: 6 additions & 27 deletions tests/test_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,37 +70,16 @@ def test_server_download_not_regular_file(tmpdir):
)


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

f = Flow(port=port_generator()).add(
name='onnx',
uses=CLIPEncoder,
uses_with={
'name': 'ABC',
'model_path': os.path.expanduser('~/.cache/clip/ViT-B-32'),
},
)
with pytest.raises(Exception) as info:
with f:
f.post('/', Document(text='Hello world'))


@pytest.mark.parametrize('path', ['ABC', os.path.expanduser('~/.cache/')])
def test_make_onnx_flow_custom_path_wrong_path(port_generator, path):
from clip_server.executors.clip_onnx import CLIPEncoder
with pytest.raises(Exception):
encoder = CLIPEncoder(
'ABC', model_path=os.path.expanduser('~/.cache/clip/ViT-B-32')
)

f = Flow(port=port_generator()).add(
name='onnx',
uses=CLIPEncoder,
uses_with={
'name': 'ViT-B/32',
'model_path': path,
},
)
with pytest.raises(Exception) as info:
with f:
f.post('/', Document(text='Hello world'))
encoder = CLIPEncoder('ViT-B/32', model_path='~/.cache/')


@pytest.mark.parametrize(
Expand Down

0 comments on commit 4839d19

Please sign in to comment.