def test_get_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.get_run("invalid-run-id")
def test_get_run_client_error(mocker): mock_client = mocker.Mock() mock_client.get_run.side_effect = HttpError( mocker.Mock(), "Experiment run with ID _ not found in project _") mocker.patch("faculty.client", return_value=mock_client) store = FacultyRestStore(STORE_URI) with pytest.raises( MlflowException, match="Experiment run with ID _ not found in project _", ): store.get_run(RUN_UUID_HEX_STR)
def test_get_run(mocker): mock_client = mocker.Mock() mock_client.get_run.return_value = FACULTY_RUN mocker.patch("faculty.client", return_value=mock_client) mock_mlflow_run = mocker.Mock() converter_mock = mocker.patch( "mlflow_faculty.tracking.faculty_run_to_mlflow_run", return_value=mock_mlflow_run, ) store = FacultyRestStore(STORE_URI) run = store.get_run(RUN_UUID_HEX_STR) assert run == mock_mlflow_run mock_client.get_run.assert_called_once_with(PROJECT_ID, RUN_UUID) converter_mock.assert_called_once_with(FACULTY_RUN)