Exemplo n.º 1
0
def test_restore_experiment_invalid_experiment_id(mocker):
    mocker.patch("faculty.client")

    store = FacultyRestStore(STORE_URI)

    with pytest.raises(ValueError):
        store.restore_experiment("invalid-experiment-id")
Exemplo n.º 2
0
def test_restore_experiment(mocker):
    mock_client = mocker.Mock()
    mocker.patch("faculty.client", return_value=mock_client)

    store = FacultyRestStore(STORE_URI)
    store.restore_experiment(EXPERIMENT_ID)

    mock_client.restore.assert_called_once_with(PROJECT_ID, EXPERIMENT_ID)
Exemplo n.º 3
0
def test_restore_experiment_client_error(mocker):
    mock_client = mocker.Mock()
    mock_client.restore.side_effect = HttpError(
        mocker.Mock(), "Experiment with ID _ not found in project _")
    mocker.patch("faculty.client", return_value=mock_client)

    store = FacultyRestStore(STORE_URI)

    with pytest.raises(MlflowException,
                       match="Experiment with ID _ not found in project _"):
        store.restore_experiment(EXPERIMENT_ID)

    mock_client.restore.assert_called_once_with(PROJECT_ID, EXPERIMENT_ID)