Skip to content

Commit f5ac198

Browse files
authored
feat: improve expression language object accessing (#53)
* fix: improve expression language object accessing and refactor expression transformer * chore: bump version * refactor: dry grammar and transformer * refactor: dry grammar and transformer * refactor: dry grammar and transformer * chore: bump cicd package version * fix: apply PR feedback
1 parent 739ae1a commit f5ac198

19 files changed

+454
-248
lines changed

.github/workflows/ci-cd.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ jobs:
5151
run: poetry run pytest .
5252
- name: Set build version and build package
5353
run: |
54-
poetry version 0.0.0.alpha${{ github.run_number}}
54+
poetry version 0.0.1.alpha${{ github.run_number}}
5555
poetry build
5656
- name: Publish package distributions to PyPI
5757
if: github.ref == 'refs/heads/main'

examples/data_factory/batch_job/test_data_factory_batchjob_functional.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def test_batch_job_pipeline(request: pytest.FixtureRequest) -> None:
3737
"WorkloadUserAssignedIdentityClientId",
3838
"/subscriptions/SUBSCRIPTION_ID/resourcegroups/RESOURCE_GROUP/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-application-identity-name",
3939
),
40-
RunParameter(RunParameterType.Pipeline, "JobAdditionalEnvironmentSettings", "[]"),
40+
RunParameter(RunParameterType.Pipeline, "JobAdditionalEnvironmentSettings", []),
4141
RunParameter(
4242
RunParameterType.Pipeline,
4343
"OutputStorageAccountName",
@@ -82,7 +82,7 @@ def test_batch_job_pipeline(request: pytest.FixtureRequest) -> None:
8282
assert activity.name == "Set CommonEnvironmentSettings"
8383
assert activity.type_properties["variableName"] == "CommonEnvironmentSettings"
8484

85-
common_environment_settings = activity.type_properties["value"].get_json_value()
85+
common_environment_settings = activity.type_properties["value"].value
8686
assert len(common_environment_settings) == 8
8787
assert common_environment_settings[0]["name"] == "WORKLOAD_APP_PACKAGE"
8888
assert common_environment_settings[0]["value"] == "test-application"

examples/data_factory/batch_job/test_data_factory_batchjob_unit.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ def test_set_common_environment_settings(test_framework: TestFramework, pipeline
155155
activity.evaluate(state)
156156

157157
# Assert
158-
env_settings = activity.type_properties["value"].get_json_value()
158+
env_settings = activity.type_properties["value"].value
159159
assert env_settings[0]["name"] == "WORKLOAD_APP_PACKAGE"
160160
assert env_settings[0]["value"] == "workload"
161161
assert env_settings[1]["name"] == "WORKLOAD_APP_PACKAGE_VERSION"
@@ -260,7 +260,7 @@ def test_start_job_pipeline(test_framework: TestFramework, pipeline: Pipeline) -
260260
RunParameter[str](
261261
RunParameterType.Pipeline,
262262
"JobAdditionalEnvironmentSettings",
263-
'[{"name": "STORAGE_ACCOUNT_NAME", "value": "teststorage"}]',
263+
[{"name": "STORAGE_ACCOUNT_NAME", "value": "teststorage"}],
264264
),
265265
],
266266
variables=[
@@ -281,7 +281,7 @@ def test_start_job_pipeline(test_framework: TestFramework, pipeline: Pipeline) -
281281
default_value="$AZ_BATCH_APP_PACKAGE_workload_0_13_2/workload.tar.gz",
282282
),
283283
PipelineRunVariable(
284-
name="CommonEnvironmentSettings", default_value='[{"name":"COMMON_ENV_SETTING","value":"dummy"}]'
284+
name="CommonEnvironmentSettings", default_value=[{"name": "COMMON_ENV_SETTING", "value": "dummy"}]
285285
),
286286
],
287287
)

examples/fabric/batch_job/test_fabric_batchjob_functional.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def test_batch_job_pipeline(request: pytest.FixtureRequest) -> None:
3535
"WorkloadUserAssignedIdentityClientId",
3636
"/subscriptions/SUBSCRIPTION_ID/resourcegroups/RESOURCE_GROUP/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-application-identity-name",
3737
),
38-
RunParameter(RunParameterType.Pipeline, "JobAdditionalEnvironmentSettings", "[]"),
38+
RunParameter(RunParameterType.Pipeline, "JobAdditionalEnvironmentSettings", []),
3939
RunParameter(
4040
RunParameterType.Pipeline,
4141
"OutputStorageAccountName",
@@ -82,7 +82,7 @@ def test_batch_job_pipeline(request: pytest.FixtureRequest) -> None:
8282
assert activity.name == "Set CommonEnvironmentSettings"
8383
assert activity.type_properties["variableName"] == "CommonEnvironmentSettings"
8484

85-
common_environment_settings = activity.type_properties["value"].get_json_value()
85+
common_environment_settings = activity.type_properties["value"].value
8686
assert len(common_environment_settings) == 8
8787
assert common_environment_settings[0]["name"] == "WORKLOAD_APP_PACKAGE"
8888
assert common_environment_settings[0]["value"] == "test-application"

examples/fabric/batch_job/test_fabric_batchjob_unit.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ def test_set_common_environment_settings(test_framework: TestFramework, pipeline
156156
activity.evaluate(state)
157157

158158
# Assert
159-
env_settings = activity.type_properties["value"].get_json_value()
159+
env_settings = activity.type_properties["value"].value
160160
assert env_settings[0]["name"] == "WORKLOAD_APP_PACKAGE"
161161
assert env_settings[0]["value"] == "workload"
162162
assert env_settings[1]["name"] == "WORKLOAD_APP_PACKAGE_VERSION"
@@ -254,10 +254,10 @@ def test_start_job_pipeline(test_framework: TestFramework, pipeline: Pipeline) -
254254
"WorkloadUserAssignedIdentityClientId",
255255
"test-application-identity-client-id",
256256
),
257-
RunParameter[str](
257+
RunParameter(
258258
RunParameterType.Pipeline,
259259
"JobAdditionalEnvironmentSettings",
260-
'[{"name": "STORAGE_ACCOUNT_NAME", "value": "teststorage"}]',
260+
[{"name": "STORAGE_ACCOUNT_NAME", "value": "teststorage"}],
261261
),
262262
],
263263
variables=[
@@ -275,7 +275,7 @@ def test_start_job_pipeline(test_framework: TestFramework, pipeline: Pipeline) -
275275
default_value="$AZ_BATCH_APP_PACKAGE_workload_0_13_2/workload.tar.gz",
276276
),
277277
PipelineRunVariable(
278-
name="CommonEnvironmentSettings", default_value='[{"name": "COMMON_ENV_SETTING", "value": "dummy"}]'
278+
name="CommonEnvironmentSettings", default_value=[{"name": "COMMON_ENV_SETTING", "value": "dummy"}]
279279
),
280280
],
281281
)

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "data-factory-testing-framework"
3-
version = "0.0.0"
3+
version = "0.0.1"
44
description = "A unit test framework that allows you to write unit and functional tests for Data Factory pipelines against the git integrated json resource files."
55
authors = ["Arjen Kroezen <arjenkroezen@microsoft.com>", "Yennifer Santos <ysantos@microsoft.com>", "Jaya Kumar <kumarjaya@microsoft.com>", "Leonard Herold <lherold@microsoft.com>"]
66
readme = "README.md"

src/data_factory_testing_framework/exceptions/dataset_parameter_not_found_error.py

Lines changed: 0 additions & 4 deletions
This file was deleted.

src/data_factory_testing_framework/exceptions/expression_parameter_not_found_error.py

Lines changed: 0 additions & 4 deletions
This file was deleted.

src/data_factory_testing_framework/exceptions/linked_service_parameter_not_found_error.py

Lines changed: 0 additions & 4 deletions
This file was deleted.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
class ParameterNotFoundError(Exception):
2+
def __init__(self, pipeline_type: str, name: str) -> None:
3+
"""Error raised when a parameter is not found."""
4+
super().__init__(f"Parameter: '{name}' of type '{pipeline_type}' not found")

0 commit comments

Comments
 (0)