Skip to content

feat: add the option to add an error to an ActivityResult #155

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@

* poetry == 1.6.1

### Installing the project

Make sure to create a virtual environment and install the requirements by running:
`poetry install --with dev`

Build the .NET project:
`dotnet build`

### Pre-Commit Hooks

We use pre-commit hooks to ensure that the code is formatted correctly and that the code is linted before committing.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ def evaluate(expression: str, state: PipelineRunState) -> Union[str, int, float,
"body": {
"output": activity.output,
"status": activity.status,
"error": activity.error,
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions src/data_factory_testing_framework/state/_activity_result.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,20 @@ def __init__(
activity_name: str,
status: Optional[DependencyCondition] = None,
output: Optional[Any] = None, # noqa: ANN401
error: Optional[Any] = None, # noqa: ANN401
) -> None:
"""Represents the result of an activity.

Args:
activity_name: Name of the activity.
status: Status of the activity.
output: Output of the activity. (e.g. { "count": 1 } for activity('activityName').output.count)
error: Error of the activity. (e.g. { "code": "ErrorCode", "message": "ErrorMessage" } for activity('activityName').Error)
"""
self.activity_name = activity_name
self.status = status if status is not None else DependencyCondition.SUCCEEDED
self.output = output
self.error = error

def __getitem__(self, item: str) -> Any: # noqa: ANN401
return getattr(self, item)
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,21 @@
"value1",
id="activity_reference_with_nested_property_and_string_reference",
),
p(
"@activity('Error activity').Error.message",
PipelineRunState(
activity_results=[
ActivityResult(
activity_name="Error activity",
status=DependencyCondition.FAILED,
error={"message": "Oh no, something went wrong"},
)
],
),
"@activity('Error activity').Error.message",
"Oh no, something went wrong",
id="activity_reference_with_error_message",
),
],
)
def test_evaluate(
Expand Down