Пример #1
0
def test_plugin_raising_error():
    client = deployments.get_deploy_client(f_target)
    # special case to raise error
    os.environ['raiseError'] = 'True'
    with pytest.raises(RuntimeError):
        client.list_deployments()
    os.environ['raiseError'] = 'False'
Пример #2
0
def test_create_success():
    client = deployments.get_deploy_client(f_target)
    ret = client.create_deployment(f_deployment_id,
                                   f_model_uri,
                                   f_flavor,
                                   config={})
    assert isinstance(ret, dict)
    assert ret['name'] == f_deployment_id
    assert ret['flavor'] == f_flavor

    ret2 = client.create_deployment(f_deployment_id, f_model_uri)
    assert ret2['flavor'] is None
Пример #3
0
def test_target_uri_parsing():
    deployments.get_deploy_client(f_target)
    deployments.get_deploy_client(
        "{target}:/somesuffix".format(target=f_target))
    with pytest.raises(MlflowException):
        deployments.get_deploy_client(
            "{target}://somesuffix".format(target=f_target))
Пример #4
0
def test_wrong_target_name():
    with pytest.raises(MlflowException):
        deployments.get_deploy_client('wrong_target')
Пример #5
0
def test_get_success():
    client = deployments.get_deploy_client(f_target)
    ret = client.get_deployment(f_deployment_id)
    assert ret['key1'] == 'val1'
Пример #6
0
def test_list_success():
    client = deployments.get_deploy_client(f_target)
    ret = client.list_deployments()
    assert ret[0] == f_deployment_id
Пример #7
0
def test_update_success():
    client = deployments.get_deploy_client(f_target)
    res = client.update_deployment(f_deployment_id, f_model_uri, f_flavor)
    assert res['flavor'] == f_flavor
Пример #8
0
def test_delete_success():
    client = deployments.get_deploy_client(f_target)
    assert client.delete_deployment(f_deployment_id) is None