Compare commits

...

2 Commits

Author SHA1 Message Date
Gergő Jedlicska bd000395af Merge pull request #316 from specklesystems/gergo/contextViewFix
fix: report relative url for context view
2023-11-11 08:32:40 +01:00
Gergő Jedlicska 10f49579fd fix: report relative url for context view 2023-11-11 08:29:16 +01:00
4 changed files with 13 additions and 9 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
[tool.poetry]
name = "specklepy"
version = "2.17.5"
version = "2.17.8"
description = "The Python SDK for Speckle 2.0"
readme = "README.md"
authors = ["Speckle Systems <devops@speckle.systems>"]
@@ -163,6 +163,10 @@ class AutomationContext:
self._automation_result.result_versions.append(version_id)
return model_id, version_id
@property
def context_view(self) -> Optional[str]:
return self._automation_result.result_view
def set_context_view(
self,
# f"{model_id}@{version_id} or {model_id} "
+2
View File
@@ -146,5 +146,7 @@ def run_function(
"Function error. Check the automation run logs for details."
)
finally:
if not automation_context.context_view:
automation_context.set_context_view()
automation_context.report_run_status()
return automation_context
@@ -255,8 +255,8 @@ def test_create_version_in_project(
def test_set_context_view(automation_context: AutomationContext) -> None:
automation_context.set_context_view()
assert automation_context._automation_result.result_view is not None
assert automation_context._automation_result.result_view.endswith(
assert automation_context.context_view is not None
assert automation_context.context_view.endswith(
f"models/{automation_context.automation_run_data.model_id}@{automation_context.automation_run_data.version_id}"
)
@@ -267,8 +267,8 @@ def test_set_context_view(automation_context: AutomationContext) -> None:
dummy_context = "foo@bar"
automation_context.set_context_view([dummy_context])
assert automation_context._automation_result.result_view is not None
assert automation_context._automation_result.result_view.endswith(
assert automation_context.context_view is not None
assert automation_context.context_view.endswith(
f"models/{automation_context.automation_run_data.model_id}@{automation_context.automation_run_data.version_id},{dummy_context}"
)
automation_context.report_run_status()
@@ -280,8 +280,6 @@ def test_set_context_view(automation_context: AutomationContext) -> None:
[dummy_context], include_source_model_version=False
)
assert automation_context._automation_result.result_view is not None
assert automation_context._automation_result.result_view.endswith(
f"models/{dummy_context}"
)
assert automation_context.context_view is not None
assert automation_context.context_view.endswith(f"models/{dummy_context}")
automation_context.report_run_status()