diff --git a/src/python/data_factory_testing_framework/functions/__init__.py b/src/python/data_factory_testing_framework/functions/__init__.py index e69de29b..4a7a578c 100644 --- a/src/python/data_factory_testing_framework/functions/__init__.py +++ b/src/python/data_factory_testing_framework/functions/__init__.py @@ -0,0 +1,11 @@ +from data_factory_testing_framework.functions.function_argument import FunctionArgument +from data_factory_testing_framework.functions.function_call import FunctionCall +from data_factory_testing_framework.functions.function_parser import parse_expression +from data_factory_testing_framework.functions.functions_repository import FunctionsRepository + +__all__ = [ + "FunctionArgument", + "FunctionCall", + "parse_expression", + "FunctionsRepository", +] \ No newline at end of file diff --git a/src/python/data_factory_testing_framework/functions/expressions/expression_activity.py b/src/python/data_factory_testing_framework/functions/_expression_activity.py similarity index 89% rename from src/python/data_factory_testing_framework/functions/expressions/expression_activity.py rename to src/python/data_factory_testing_framework/functions/_expression_activity.py index 1072c290..a4ca66d8 100644 --- a/src/python/data_factory_testing_framework/functions/expressions/expression_activity.py +++ b/src/python/data_factory_testing_framework/functions/_expression_activity.py @@ -1,7 +1,7 @@ import re from data_factory_testing_framework.exceptions.activity_not_found_error import ActivityNotFoundError -from data_factory_testing_framework.models.state.pipeline_run_state import PipelineRunState +from data_factory_testing_framework.state import PipelineRunState def find_and_replace_activity(expression: str, state: PipelineRunState) -> str: diff --git a/src/python/data_factory_testing_framework/functions/expressions/expression_dataset.py b/src/python/data_factory_testing_framework/functions/_expression_dataset.py similarity index 81% rename from src/python/data_factory_testing_framework/functions/expressions/expression_dataset.py rename to src/python/data_factory_testing_framework/functions/_expression_dataset.py index 5287bc58..da0a6f84 100644 --- a/src/python/data_factory_testing_framework/functions/expressions/expression_dataset.py +++ b/src/python/data_factory_testing_framework/functions/_expression_dataset.py @@ -1,8 +1,8 @@ import re from data_factory_testing_framework.exceptions.dataset_parameter_not_found_error import DatasetParameterNotFoundError -from data_factory_testing_framework.models.base.run_parameter_type import RunParameterType -from data_factory_testing_framework.models.state.pipeline_run_state import PipelineRunState +from data_factory_testing_framework.state import RunParameterType +from data_factory_testing_framework.state import PipelineRunState def find_and_replace_dataset(expression: str, state: PipelineRunState) -> str: diff --git a/src/python/data_factory_testing_framework/functions/expressions/expression_iteration_item.py b/src/python/data_factory_testing_framework/functions/_expression_iteration_item.py similarity index 85% rename from src/python/data_factory_testing_framework/functions/expressions/expression_iteration_item.py rename to src/python/data_factory_testing_framework/functions/_expression_iteration_item.py index 931671af..52a3eab1 100644 --- a/src/python/data_factory_testing_framework/functions/expressions/expression_iteration_item.py +++ b/src/python/data_factory_testing_framework/functions/_expression_iteration_item.py @@ -1,7 +1,7 @@ import re from data_factory_testing_framework.exceptions.state_iteration_item_not_set_error import StateIterationItemNotSetError -from data_factory_testing_framework.models.state.pipeline_run_state import PipelineRunState +from data_factory_testing_framework.state import PipelineRunState def find_and_replace_iteration_item(expression: str, state: PipelineRunState) -> str: diff --git a/src/python/data_factory_testing_framework/functions/expressions/expression_linked_service.py b/src/python/data_factory_testing_framework/functions/_expression_linked_service.py similarity index 83% rename from src/python/data_factory_testing_framework/functions/expressions/expression_linked_service.py rename to src/python/data_factory_testing_framework/functions/_expression_linked_service.py index 24e89d69..eebab884 100644 --- a/src/python/data_factory_testing_framework/functions/expressions/expression_linked_service.py +++ b/src/python/data_factory_testing_framework/functions/_expression_linked_service.py @@ -3,8 +3,8 @@ from data_factory_testing_framework.exceptions.linked_service_parameter_not_found_error import ( LinkedServiceParameterNotFoundError, ) -from data_factory_testing_framework.models.base.run_parameter_type import RunParameterType -from data_factory_testing_framework.models.state.pipeline_run_state import PipelineRunState +from data_factory_testing_framework.state import RunParameterType +from data_factory_testing_framework.state import PipelineRunState def find_and_replace_linked_services(expression: str, state: PipelineRunState) -> str: diff --git a/src/python/data_factory_testing_framework/functions/expressions/expression_parameter.py b/src/python/data_factory_testing_framework/functions/_expression_parameter.py similarity index 86% rename from src/python/data_factory_testing_framework/functions/expressions/expression_parameter.py rename to src/python/data_factory_testing_framework/functions/_expression_parameter.py index e9258a2e..2baa9215 100644 --- a/src/python/data_factory_testing_framework/functions/expressions/expression_parameter.py +++ b/src/python/data_factory_testing_framework/functions/_expression_parameter.py @@ -3,8 +3,8 @@ from data_factory_testing_framework.exceptions.expression_parameter_not_found_error import ( ExpressionParameterNotFoundError, ) -from data_factory_testing_framework.models.base.run_parameter_type import RunParameterType -from data_factory_testing_framework.models.state.pipeline_run_state import PipelineRunState +from data_factory_testing_framework.state import RunParameterType +from data_factory_testing_framework.state import PipelineRunState def find_and_replace_parameters(expression: str, parameter_type: RunParameterType, state: PipelineRunState) -> str: diff --git a/src/python/data_factory_testing_framework/functions/expressions/expression_variable.py b/src/python/data_factory_testing_framework/functions/_expression_variable.py similarity index 87% rename from src/python/data_factory_testing_framework/functions/expressions/expression_variable.py rename to src/python/data_factory_testing_framework/functions/_expression_variable.py index f78e3659..ccdd4721 100644 --- a/src/python/data_factory_testing_framework/functions/expressions/expression_variable.py +++ b/src/python/data_factory_testing_framework/functions/_expression_variable.py @@ -1,7 +1,7 @@ import re from data_factory_testing_framework.exceptions.variable_not_found_error import VariableNotFoundError -from data_factory_testing_framework.models.state.pipeline_run_state import PipelineRunState +from data_factory_testing_framework.state import PipelineRunState def find_and_replace_variables(expression: str, state: PipelineRunState) -> str: diff --git a/src/python/data_factory_testing_framework/functions/expressions/__init__.py b/src/python/data_factory_testing_framework/functions/expressions/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/src/python/data_factory_testing_framework/functions/function_argument.py b/src/python/data_factory_testing_framework/functions/function_argument.py index ae21eab0..587cdc1d 100644 --- a/src/python/data_factory_testing_framework/functions/function_argument.py +++ b/src/python/data_factory_testing_framework/functions/function_argument.py @@ -1,16 +1,16 @@ -from data_factory_testing_framework.functions.expressions.expression_activity import find_and_replace_activity -from data_factory_testing_framework.functions.expressions.expression_dataset import find_and_replace_dataset -from data_factory_testing_framework.functions.expressions.expression_iteration_item import ( +from data_factory_testing_framework.functions._expression_activity import find_and_replace_activity +from data_factory_testing_framework.functions._expression_dataset import find_and_replace_dataset +from data_factory_testing_framework.functions._expression_iteration_item import ( find_and_replace_iteration_item, ) -from data_factory_testing_framework.functions.expressions.expression_linked_service import ( +from data_factory_testing_framework.functions._expression_linked_service import ( find_and_replace_linked_services, ) -from data_factory_testing_framework.functions.expressions.expression_parameter import find_and_replace_parameters -from data_factory_testing_framework.functions.expressions.expression_variable import find_and_replace_variables -from data_factory_testing_framework.models.base.run_parameter_type import RunParameterType -from data_factory_testing_framework.models.state.pipeline_run_state import PipelineRunState -from data_factory_testing_framework.models.state.run_state import RunState +from data_factory_testing_framework.functions._expression_parameter import find_and_replace_parameters +from data_factory_testing_framework.functions._expression_variable import find_and_replace_variables +from data_factory_testing_framework.state import RunParameterType +from data_factory_testing_framework.state import PipelineRunState +from data_factory_testing_framework.state import RunState def trim_one_char(text: str, character: str) -> str: diff --git a/src/python/data_factory_testing_framework/functions/function_call.py b/src/python/data_factory_testing_framework/functions/function_call.py index 1efb3782..35864e88 100644 --- a/src/python/data_factory_testing_framework/functions/function_call.py +++ b/src/python/data_factory_testing_framework/functions/function_call.py @@ -6,7 +6,7 @@ from data_factory_testing_framework.exceptions.unsupported_function_error import UnsupportedFunctionError from data_factory_testing_framework.functions.function_argument import FunctionArgument from data_factory_testing_framework.functions.functions_repository import FunctionsRepository -from data_factory_testing_framework.models.state.run_state import RunState +from data_factory_testing_framework.state import RunState class FunctionCall: diff --git a/src/python/data_factory_testing_framework/generated/models/data_factory_element.py b/src/python/data_factory_testing_framework/generated/data_factory_element.py similarity index 100% rename from src/python/data_factory_testing_framework/generated/models/data_factory_element.py rename to src/python/data_factory_testing_framework/generated/data_factory_element.py diff --git a/src/python/data_factory_testing_framework/generated/models/_models_py3_modified.py b/src/python/data_factory_testing_framework/generated/models/_models_py3_modified.py index 576763e6..5d5b03a5 100644 --- a/src/python/data_factory_testing_framework/generated/models/_models_py3_modified.py +++ b/src/python/data_factory_testing_framework/generated/models/_models_py3_modified.py @@ -1,12 +1,9 @@ -import collections import datetime import sys -from abc import ABC from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union, Generator, Callable from azure.mgmt.datafactory import _serialization -from .data_factory_element import DataFactoryElement -from ...models.state.run_state import RunState +from data_factory_testing_framework.generated.data_factory_element import DataFactoryElement if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -91,7 +88,7 @@ def __init__(self, *, name: str, additional_properties: Optional[Dict[str, JSON] self.depends_on = depends_on self.user_properties = user_properties - def evaluate(self, state: RunState) -> str: + def evaluate(self, state) -> str: pass class ActivityDependency(_serialization.Model): @@ -2301,8 +2298,8 @@ def __init__(self, *, name: str, additional_properties: Optional[Dict[str, JSON] def evaluate_control_activity_iterations( self, - state: RunState, - evaluate_activities: Callable[[RunState], Generator[Activity, None, None]], + state, + evaluate_activities: Callable, ) -> Generator[Activity, None, None]: return [] diff --git a/src/python/data_factory_testing_framework/models/__init__.py b/src/python/data_factory_testing_framework/models/__init__.py index e69de29b..0354b4a1 100644 --- a/src/python/data_factory_testing_framework/models/__init__.py +++ b/src/python/data_factory_testing_framework/models/__init__.py @@ -0,0 +1,9 @@ +from data_factory_testing_framework.models.repositories.data_factory_repository_factory import DataFactoryRepositoryFactory +from data_factory_testing_framework.models.repositories.data_factory_repository import DataFactoryRepository + +__all__ = [ + "DataFactoryRepositoryFactory", + "DataFactoryRepository", +] + + diff --git a/src/python/data_factory_testing_framework/models/patch_models.py b/src/python/data_factory_testing_framework/models/_patch_models.py similarity index 86% rename from src/python/data_factory_testing_framework/models/patch_models.py rename to src/python/data_factory_testing_framework/models/_patch_models.py index d806953e..809b159e 100644 --- a/src/python/data_factory_testing_framework/models/patch_models.py +++ b/src/python/data_factory_testing_framework/models/_patch_models.py @@ -1,5 +1,7 @@ from data_factory_testing_framework.generated import models as _models -from data_factory_testing_framework.models.activities.base import Activity +from data_factory_testing_framework.models.expressions._data_factory_element import DataFactoryElement +from data_factory_testing_framework.models.expressions._expression import Expression +from data_factory_testing_framework.models.activities.base.activity import Activity from data_factory_testing_framework.models.activities.control_activities.execute_pipeline_activity import ( ExecutePipelineActivity, ) @@ -9,8 +11,6 @@ ) from data_factory_testing_framework.models.activities.control_activities.until_activity import UntilActivity from data_factory_testing_framework.models.activities.set_variable_activity import SetVariableActivity -from data_factory_testing_framework.models.data_factory_element import DataFactoryElement -from data_factory_testing_framework.models.expression import Expression from data_factory_testing_framework.models.pipelines.pipeline_resource import PipelineResource diff --git a/src/python/data_factory_testing_framework/models/activities/__init__.py b/src/python/data_factory_testing_framework/models/activities/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/src/python/data_factory_testing_framework/models/activities/base/__init__.py b/src/python/data_factory_testing_framework/models/activities/base/__init__.py deleted file mode 100644 index bfea9e6d..00000000 --- a/src/python/data_factory_testing_framework/models/activities/base/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -from .activity import Activity - -__all__ = ["Activity"] diff --git a/src/python/data_factory_testing_framework/models/activities/base/activity.py b/src/python/data_factory_testing_framework/models/activities/base/activity.py index 44cec30a..d6b8b2b1 100644 --- a/src/python/data_factory_testing_framework/models/activities/base/activity.py +++ b/src/python/data_factory_testing_framework/models/activities/base/activity.py @@ -2,7 +2,7 @@ from data_factory_testing_framework.generated.models import Activity, DataFactoryElement, DependencyCondition from data_factory_testing_framework.generated.models import Activity as GeneratedActivity -from data_factory_testing_framework.models.state.pipeline_run_state import PipelineRunState +from data_factory_testing_framework.state import PipelineRunState class Activity: diff --git a/src/python/data_factory_testing_framework/models/activities/control_activities/__init__.py b/src/python/data_factory_testing_framework/models/activities/control_activities/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/src/python/data_factory_testing_framework/models/activities/control_activities/execute_pipeline_activity.py b/src/python/data_factory_testing_framework/models/activities/control_activities/execute_pipeline_activity.py index e49b9de6..ce9bf433 100644 --- a/src/python/data_factory_testing_framework/models/activities/control_activities/execute_pipeline_activity.py +++ b/src/python/data_factory_testing_framework/models/activities/control_activities/execute_pipeline_activity.py @@ -1,8 +1,8 @@ from typing import List -from data_factory_testing_framework.models.base.run_parameter import RunParameter -from data_factory_testing_framework.models.base.run_parameter_type import RunParameterType -from data_factory_testing_framework.models.state.pipeline_run_state import PipelineRunState +from data_factory_testing_framework.state.run_parameter import RunParameter +from data_factory_testing_framework.state import RunParameterType +from data_factory_testing_framework.state import PipelineRunState class ExecutePipelineActivity: diff --git a/src/python/data_factory_testing_framework/models/activities/control_activities/for_each_activity.py b/src/python/data_factory_testing_framework/models/activities/control_activities/for_each_activity.py index 2719d8af..f3993d07 100644 --- a/src/python/data_factory_testing_framework/models/activities/control_activities/for_each_activity.py +++ b/src/python/data_factory_testing_framework/models/activities/control_activities/for_each_activity.py @@ -1,7 +1,7 @@ from typing import Callable, Generator from data_factory_testing_framework.generated.models import Activity, ControlActivity, ForEachActivity -from data_factory_testing_framework.models.state.pipeline_run_state import PipelineRunState +from data_factory_testing_framework.state import PipelineRunState class ForEachActivity: diff --git a/src/python/data_factory_testing_framework/models/activities/control_activities/if_condition_activity.py b/src/python/data_factory_testing_framework/models/activities/control_activities/if_condition_activity.py index d0c83a2d..d00b2517 100644 --- a/src/python/data_factory_testing_framework/models/activities/control_activities/if_condition_activity.py +++ b/src/python/data_factory_testing_framework/models/activities/control_activities/if_condition_activity.py @@ -5,7 +5,7 @@ ControlActivity, IfConditionActivity, ) -from data_factory_testing_framework.models.state.pipeline_run_state import PipelineRunState +from data_factory_testing_framework.state import PipelineRunState class IfConditionActivity: diff --git a/src/python/data_factory_testing_framework/models/activities/control_activities/until_activity.py b/src/python/data_factory_testing_framework/models/activities/control_activities/until_activity.py index b662332a..aa899041 100644 --- a/src/python/data_factory_testing_framework/models/activities/control_activities/until_activity.py +++ b/src/python/data_factory_testing_framework/models/activities/control_activities/until_activity.py @@ -1,7 +1,7 @@ from typing import Callable, Generator from data_factory_testing_framework.generated.models import Activity, ControlActivity, UntilActivity -from data_factory_testing_framework.models.state.pipeline_run_state import PipelineRunState +from data_factory_testing_framework.state import PipelineRunState class UntilActivity: diff --git a/src/python/data_factory_testing_framework/models/activities/set_variable_activity.py b/src/python/data_factory_testing_framework/models/activities/set_variable_activity.py index 8d27f18d..e5150def 100644 --- a/src/python/data_factory_testing_framework/models/activities/set_variable_activity.py +++ b/src/python/data_factory_testing_framework/models/activities/set_variable_activity.py @@ -1,5 +1,5 @@ from data_factory_testing_framework.generated.models import ControlActivity, SetVariableActivity -from data_factory_testing_framework.models.state.pipeline_run_state import PipelineRunState +from data_factory_testing_framework.state import PipelineRunState class SetVariableActivity: diff --git a/src/python/data_factory_testing_framework/models/data_factory_element.py b/src/python/data_factory_testing_framework/models/data_factory_element.py deleted file mode 100644 index eafee582..00000000 --- a/src/python/data_factory_testing_framework/models/data_factory_element.py +++ /dev/null @@ -1,15 +0,0 @@ -from typing import Union - -from data_factory_testing_framework.functions.function_parser import parse_expression -from data_factory_testing_framework.generated.models import DataFactoryElement -from data_factory_testing_framework.models.state.run_state import RunState - - -class DataFactoryElement(): - def __init__(self) -> None: - """DataFactoryElement.""" - self.value: Union[str, int, bool] = None - - def evaluate(self: DataFactoryElement, state: RunState) -> None: - self.value = parse_expression(self.expression).evaluate(state) - return self.value diff --git a/src/python/data_factory_testing_framework/models/expressions/_data_factory_element.py b/src/python/data_factory_testing_framework/models/expressions/_data_factory_element.py new file mode 100644 index 00000000..c259ebbb --- /dev/null +++ b/src/python/data_factory_testing_framework/models/expressions/_data_factory_element.py @@ -0,0 +1,17 @@ +from typing import Union, Generic, TypeVar + +from data_factory_testing_framework.functions import parse_expression +from data_factory_testing_framework.generated.models import DataFactoryElement +from data_factory_testing_framework.state import RunState + +T = TypeVar("T") + + +class DataFactoryElement(Generic[T]): + def __init__(self) -> None: + """DataFactoryElement.""" + self.value: Union[str, int, bool] = None + + def evaluate(self: DataFactoryElement, state: RunState) -> Union[str, int, bool]: + self.value = parse_expression(self.expression).evaluate(state) + return self.value diff --git a/src/python/data_factory_testing_framework/models/expression.py b/src/python/data_factory_testing_framework/models/expressions/_expression.py similarity index 88% rename from src/python/data_factory_testing_framework/models/expression.py rename to src/python/data_factory_testing_framework/models/expressions/_expression.py index 51d27e87..a1b4f383 100644 --- a/src/python/data_factory_testing_framework/models/expression.py +++ b/src/python/data_factory_testing_framework/models/expressions/_expression.py @@ -2,7 +2,7 @@ from data_factory_testing_framework.functions.function_parser import parse_expression from data_factory_testing_framework.generated.models import Expression -from data_factory_testing_framework.models.state.pipeline_run_state import PipelineRunState +from data_factory_testing_framework.state import PipelineRunState class Expression: diff --git a/src/python/data_factory_testing_framework/models/pipelines/pipeline_resource.py b/src/python/data_factory_testing_framework/models/pipelines/pipeline_resource.py index 21dd441d..7a958b16 100644 --- a/src/python/data_factory_testing_framework/models/pipelines/pipeline_resource.py +++ b/src/python/data_factory_testing_framework/models/pipelines/pipeline_resource.py @@ -2,8 +2,8 @@ from data_factory_testing_framework.exceptions.activity_not_found_error import ActivityNotFoundError from data_factory_testing_framework.generated.models import Activity, PipelineResource -from data_factory_testing_framework.models.base.run_parameter import RunParameter -from data_factory_testing_framework.models.base.run_parameter_type import RunParameterType +from data_factory_testing_framework.state.run_parameter import RunParameter +from data_factory_testing_framework.state import RunParameterType class PipelineResource: diff --git a/src/python/data_factory_testing_framework/models/repositories/__init__.py b/src/python/data_factory_testing_framework/models/repositories/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/src/python/data_factory_testing_framework/models/repositories/data_factory_repository_factory.py b/src/python/data_factory_testing_framework/models/repositories/data_factory_repository_factory.py index 9070e6af..bf16331a 100644 --- a/src/python/data_factory_testing_framework/models/repositories/data_factory_repository_factory.py +++ b/src/python/data_factory_testing_framework/models/repositories/data_factory_repository_factory.py @@ -3,7 +3,7 @@ from data_factory_testing_framework.generated import Deserializer from data_factory_testing_framework.generated import models as _models -from data_factory_testing_framework.models.patch_models import patch_models +from data_factory_testing_framework.models._patch_models import patch_models from data_factory_testing_framework.models.repositories.data_factory_repository import DataFactoryRepository patch_models() diff --git a/src/python/data_factory_testing_framework/models/state/__init__.py b/src/python/data_factory_testing_framework/models/state/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/src/python/data_factory_testing_framework/scripts/utils/__init__.py b/src/python/data_factory_testing_framework/scripts/utils/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/src/python/data_factory_testing_framework/state/__init__.py b/src/python/data_factory_testing_framework/state/__init__.py new file mode 100644 index 00000000..882d09af --- /dev/null +++ b/src/python/data_factory_testing_framework/state/__init__.py @@ -0,0 +1,13 @@ +from .pipeline_run_state import PipelineRunState +from .pipeline_run_variable import PipelineRunVariable +from .run_parameter import RunParameter +from .run_parameter_type import RunParameterType +from .run_state import RunState + +__all__ = [ + "PipelineRunState", + "RunParameter", + "RunParameterType", + "RunState", + "PipelineRunVariable", +] diff --git a/src/python/data_factory_testing_framework/models/state/pipeline_run_state.py b/src/python/data_factory_testing_framework/state/pipeline_run_state.py similarity index 95% rename from src/python/data_factory_testing_framework/models/state/pipeline_run_state.py rename to src/python/data_factory_testing_framework/state/pipeline_run_state.py index 57b7d516..4aee6506 100644 --- a/src/python/data_factory_testing_framework/models/state/pipeline_run_state.py +++ b/src/python/data_factory_testing_framework/state/pipeline_run_state.py @@ -5,9 +5,9 @@ ) from data_factory_testing_framework.exceptions.variable_does_not_exist_error import VariableDoesNotExistError from data_factory_testing_framework.generated.models import DependencyCondition, VariableSpecification -from data_factory_testing_framework.models.base.pipeline_run_variable import PipelineRunVariable -from data_factory_testing_framework.models.base.run_parameter import RunParameter -from data_factory_testing_framework.models.state.run_state import RunState +from data_factory_testing_framework.state.pipeline_run_variable import PipelineRunVariable +from data_factory_testing_framework.state.run_parameter import RunParameter +from data_factory_testing_framework.state.run_state import RunState class PipelineRunState(RunState): diff --git a/src/python/data_factory_testing_framework/models/base/pipeline_run_variable.py b/src/python/data_factory_testing_framework/state/pipeline_run_variable.py similarity index 100% rename from src/python/data_factory_testing_framework/models/base/pipeline_run_variable.py rename to src/python/data_factory_testing_framework/state/pipeline_run_variable.py diff --git a/src/python/data_factory_testing_framework/models/base/run_parameter.py b/src/python/data_factory_testing_framework/state/run_parameter.py similarity index 85% rename from src/python/data_factory_testing_framework/models/base/run_parameter.py rename to src/python/data_factory_testing_framework/state/run_parameter.py index a3ce06fa..a1884519 100644 --- a/src/python/data_factory_testing_framework/models/base/run_parameter.py +++ b/src/python/data_factory_testing_framework/state/run_parameter.py @@ -1,6 +1,6 @@ from typing import Generic, TypeVar -from data_factory_testing_framework.models.base.run_parameter_type import RunParameterType +from data_factory_testing_framework.state.run_parameter_type import RunParameterType T = TypeVar("T") diff --git a/src/python/data_factory_testing_framework/models/base/run_parameter_type.py b/src/python/data_factory_testing_framework/state/run_parameter_type.py similarity index 100% rename from src/python/data_factory_testing_framework/models/base/run_parameter_type.py rename to src/python/data_factory_testing_framework/state/run_parameter_type.py diff --git a/src/python/data_factory_testing_framework/models/state/run_state.py b/src/python/data_factory_testing_framework/state/run_state.py similarity index 84% rename from src/python/data_factory_testing_framework/models/state/run_state.py rename to src/python/data_factory_testing_framework/state/run_state.py index 111fd593..70bda86e 100644 --- a/src/python/data_factory_testing_framework/models/state/run_state.py +++ b/src/python/data_factory_testing_framework/state/run_state.py @@ -1,6 +1,6 @@ from typing import List, Optional -from data_factory_testing_framework.models.base.run_parameter import RunParameter +from data_factory_testing_framework.state.run_parameter import RunParameter class RunState: diff --git a/src/python/data_factory_testing_framework/models/test_framework.py b/src/python/data_factory_testing_framework/test_framework.py similarity index 82% rename from src/python/data_factory_testing_framework/models/test_framework.py rename to src/python/data_factory_testing_framework/test_framework.py index e9ae07b8..bb668a1f 100644 --- a/src/python/data_factory_testing_framework/models/test_framework.py +++ b/src/python/data_factory_testing_framework/test_framework.py @@ -9,11 +9,8 @@ PipelineResource, UntilActivity, ) -from data_factory_testing_framework.models.base.run_parameter import RunParameter -from data_factory_testing_framework.models.repositories.data_factory_repository_factory import ( - DataFactoryRepositoryFactory, -) -from data_factory_testing_framework.models.state.pipeline_run_state import PipelineRunState +from data_factory_testing_framework.models import DataFactoryRepositoryFactory +from data_factory_testing_framework.state import PipelineRunState, RunParameter class TestFramework: @@ -75,13 +72,14 @@ def evaluate_activities(self, activities: List[Activity], state: PipelineRunStat while len(state.scoped_pipeline_activity_results) != len(activities): any_activity_evaluated = False for activity in filter( - lambda a: a.name not in state.scoped_pipeline_activity_results - and a.are_dependency_condition_met(state), - activities, + lambda a: a.name not in state.scoped_pipeline_activity_results + and a.are_dependency_condition_met(state), + activities, ): evaluated_activity = activity.evaluate(state) if not self._is_iteration_activity(evaluated_activity) or ( - isinstance(evaluated_activity, ExecutePipelineActivity) and not self.should_evaluate_child_pipelines + isinstance(evaluated_activity, + ExecutePipelineActivity) and not self.should_evaluate_child_pipelines ): yield evaluated_activity @@ -97,16 +95,16 @@ def evaluate_activities(self, activities: List[Activity], state: PipelineRunStat # Evaluate the pipeline with its own scope for child_activity in self.evaluate_pipeline( - pipeline, - activity.get_child_run_parameters(state), + pipeline, + activity.get_child_run_parameters(state), ): yield child_activity if isinstance(activity, ControlActivity): control_activity: ControlActivity = activity for child_activity in control_activity.evaluate_control_activity_iterations( - state, - self.evaluate_activities, + state, + self.evaluate_activities, ): yield child_activity @@ -118,8 +116,8 @@ def evaluate_activities(self, activities: List[Activity], state: PipelineRunStat @staticmethod def _is_iteration_activity(activity: Activity) -> bool: return ( - isinstance(activity, UntilActivity) - or isinstance(activity, ForEachActivity) - or isinstance(activity, IfConditionActivity) - or isinstance(activity, ExecutePipelineActivity) + isinstance(activity, UntilActivity) + or isinstance(activity, ForEachActivity) + or isinstance(activity, IfConditionActivity) + or isinstance(activity, ExecutePipelineActivity) ) diff --git a/src/python/example/batch_job/batchjob_test.py b/src/python/example/batch_job/batchjob_test.py index c18d80db..79a42cc3 100644 --- a/src/python/example/batch_job/batchjob_test.py +++ b/src/python/example/batch_job/batchjob_test.py @@ -1,9 +1,9 @@ import pytest from data_factory_testing_framework.generated.models import SetVariableActivity -from data_factory_testing_framework.models.base.run_parameter import RunParameter -from data_factory_testing_framework.models.base.run_parameter_type import RunParameterType -from data_factory_testing_framework.models.test_framework import TestFramework +from data_factory_testing_framework.state.run_parameter import RunParameter +from data_factory_testing_framework.state import RunParameterType +from data_factory_testing_framework.test_framework import TestFramework def test_batch_job_pipeline() -> None: diff --git a/src/python/tests/functions/test_function_argument.py b/src/python/tests/functions/test_function_argument.py index 682c4d68..74165f2c 100644 --- a/src/python/tests/functions/test_function_argument.py +++ b/src/python/tests/functions/test_function_argument.py @@ -10,9 +10,9 @@ from data_factory_testing_framework.exceptions.variable_not_found_error import VariableNotFoundError from data_factory_testing_framework.functions.function_argument import FunctionArgument from data_factory_testing_framework.generated.models import DependencyCondition, VariableSpecification -from data_factory_testing_framework.models.base.run_parameter import RunParameter -from data_factory_testing_framework.models.base.run_parameter_type import RunParameterType -from data_factory_testing_framework.models.state.pipeline_run_state import PipelineRunState +from data_factory_testing_framework.state.run_parameter import RunParameter +from data_factory_testing_framework.state import RunParameterType +from data_factory_testing_framework.state import PipelineRunState def test_evaluate_parameter_expression() -> None: diff --git a/src/python/tests/functions/test_function_call.py b/src/python/tests/functions/test_function_call.py index 8ee2b12d..af60881d 100644 --- a/src/python/tests/functions/test_function_call.py +++ b/src/python/tests/functions/test_function_call.py @@ -5,9 +5,9 @@ ) from data_factory_testing_framework.functions.function_parser import parse_expression from data_factory_testing_framework.generated.models import DependencyCondition, VariableSpecification -from data_factory_testing_framework.models.base.run_parameter import RunParameter -from data_factory_testing_framework.models.base.run_parameter_type import RunParameterType -from data_factory_testing_framework.models.state.pipeline_run_state import PipelineRunState +from data_factory_testing_framework.state.run_parameter import RunParameter +from data_factory_testing_framework.state import RunParameterType +from data_factory_testing_framework.state import PipelineRunState def test_evaluate_expression_with_nested_function() -> None: diff --git a/src/python/tests/functions/test_function_parser.py b/src/python/tests/functions/test_function_parser.py index 105ffdbd..29c1efe0 100644 --- a/src/python/tests/functions/test_function_parser.py +++ b/src/python/tests/functions/test_function_parser.py @@ -1,6 +1,6 @@ from data_factory_testing_framework.functions.function_call import FunctionCall from data_factory_testing_framework.functions.function_parser import parse_expression -from data_factory_testing_framework.models.state.pipeline_run_state import PipelineRunState +from data_factory_testing_framework.state import PipelineRunState def test_parse_expression_with_nested_function_and_single_quote() -> None: diff --git a/src/python/tests/models/activities/base/test_activity.py b/src/python/tests/models/activities/base/test_activity.py index d9dbbecd..12715ad4 100644 --- a/src/python/tests/models/activities/base/test_activity.py +++ b/src/python/tests/models/activities/base/test_activity.py @@ -9,10 +9,10 @@ PipelineReference, PipelineReferenceType, ) -from data_factory_testing_framework.models.base.run_parameter import RunParameter -from data_factory_testing_framework.models.base.run_parameter_type import RunParameterType -from data_factory_testing_framework.models.state.pipeline_run_state import PipelineRunState -from data_factory_testing_framework.models.test_framework import TestFramework +from data_factory_testing_framework.state.run_parameter import RunParameter +from data_factory_testing_framework.state import RunParameterType +from data_factory_testing_framework.state import PipelineRunState +from data_factory_testing_framework.test_framework import TestFramework TestFramework() diff --git a/src/python/tests/models/activities/control_activities/test_for_each_activity.py b/src/python/tests/models/activities/control_activities/test_for_each_activity.py index 87e1c3a2..9b45ae46 100644 --- a/src/python/tests/models/activities/control_activities/test_for_each_activity.py +++ b/src/python/tests/models/activities/control_activities/test_for_each_activity.py @@ -8,8 +8,8 @@ SetVariableActivity, VariableSpecification, ) -from data_factory_testing_framework.models.state.pipeline_run_state import PipelineRunState -from data_factory_testing_framework.models.test_framework import TestFramework +from data_factory_testing_framework.state import PipelineRunState +from data_factory_testing_framework.test_framework import TestFramework def test_when_evaluate_child_activities_then_should_return_the_activity_with_item_expression_evaluated() -> None: diff --git a/src/python/tests/models/activities/control_activities/test_if_condition_activity.py b/src/python/tests/models/activities/control_activities/test_if_condition_activity.py index dbb1808d..b418e580 100644 --- a/src/python/tests/models/activities/control_activities/test_if_condition_activity.py +++ b/src/python/tests/models/activities/control_activities/test_if_condition_activity.py @@ -8,8 +8,8 @@ SetVariableActivity, VariableSpecification, ) -from data_factory_testing_framework.models.state.pipeline_run_state import PipelineRunState -from data_factory_testing_framework.models.test_framework import TestFramework +from data_factory_testing_framework.state import PipelineRunState +from data_factory_testing_framework.test_framework import TestFramework TestFramework() diff --git a/src/python/tests/models/activities/control_activities/test_until_activity.py b/src/python/tests/models/activities/control_activities/test_until_activity.py index d5327fa5..3e949b34 100644 --- a/src/python/tests/models/activities/control_activities/test_until_activity.py +++ b/src/python/tests/models/activities/control_activities/test_until_activity.py @@ -8,8 +8,8 @@ UntilActivity, VariableSpecification, ) -from data_factory_testing_framework.models.state.pipeline_run_state import PipelineRunState -from data_factory_testing_framework.models.test_framework import TestFramework +from data_factory_testing_framework.state import PipelineRunState +from data_factory_testing_framework.test_framework import TestFramework def test_when_evaluate_until_activity_should_repeat_until_expression_is_true() -> None: diff --git a/src/python/tests/models/activities/test_set_variable_activity.py b/src/python/tests/models/activities/test_set_variable_activity.py index abe7d800..1a96e960 100644 --- a/src/python/tests/models/activities/test_set_variable_activity.py +++ b/src/python/tests/models/activities/test_set_variable_activity.py @@ -8,8 +8,8 @@ SetVariableActivity, VariableSpecification, ) -from data_factory_testing_framework.models.state.pipeline_run_state import PipelineRunState -from data_factory_testing_framework.models.test_framework import TestFramework +from data_factory_testing_framework.state import PipelineRunState +from data_factory_testing_framework.test_framework import TestFramework def test_when_string_variable_evaluated_then_state_variable_should_be_set() -> None: diff --git a/src/python/tests/models/pipelines/test_pipeline_resource.py b/src/python/tests/models/pipelines/test_pipeline_resource.py index fee758f5..6dce8895 100644 --- a/src/python/tests/models/pipelines/test_pipeline_resource.py +++ b/src/python/tests/models/pipelines/test_pipeline_resource.py @@ -1,9 +1,9 @@ import pytest from data_factory_testing_framework.generated.models import ParameterSpecification, PipelineResource -from data_factory_testing_framework.models.base.run_parameter import RunParameter -from data_factory_testing_framework.models.base.run_parameter_type import RunParameterType -from data_factory_testing_framework.models.test_framework import TestFramework +from data_factory_testing_framework.state.run_parameter import RunParameter +from data_factory_testing_framework.state import RunParameterType +from data_factory_testing_framework.test_framework import TestFramework TestFramework()