def test_restore_run_invalid_run_id(mocker): mock_client = mocker.Mock() mocker.patch("faculty.client", return_value=mock_client) store = FacultyRestStore(STORE_URI) with pytest.raises(ValueError): store.restore_run("invalid-run-id")
def test_restore_run_failures(mocker, response, message): mock_client = mocker.Mock() mock_client.restore_runs.return_value = response mocker.patch("faculty.client", return_value=mock_client) store = FacultyRestStore(STORE_URI) with pytest.raises(MlflowException, match=message): store.restore_run(RUN_UUID_HEX_STR)
def test_restore_run_client_error(mocker): mock_client = mocker.Mock() mock_client.restore_runs.side_effect = HttpError(mocker.Mock(), "An error") mocker.patch("faculty.client", return_value=mock_client) store = FacultyRestStore(STORE_URI) with pytest.raises(MlflowException, match="An error"): store.restore_run(RUN_UUID_HEX_STR)
def test_restore_run(mocker): mock_client = mocker.Mock() mock_client.restore_runs.return_value = RestoreExperimentRunsResponse( restored_run_ids=[RUN_UUID], conflicted_run_ids=[]) mocker.patch("faculty.client", return_value=mock_client) store = FacultyRestStore(STORE_URI) store.restore_run(RUN_UUID_HEX_STR) mock_client.restore_runs.assert_called_once_with(PROJECT_ID, [RUN_UUID])