Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f6917b0761 | |||
| 04764b17eb | |||
| dbe3d759f6 | |||
| f6ff484e66 | |||
| bd000395af | |||
| 10f49579fd |
+1
-1
@@ -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} "
|
||||
@@ -177,7 +181,7 @@ class AutomationContext:
|
||||
else []
|
||||
)
|
||||
if resource_ids:
|
||||
link_resources.append(*resource_ids)
|
||||
link_resources.extend(resource_ids)
|
||||
if not link_resources:
|
||||
raise Exception(
|
||||
"We do not have enough resource ids to compose a context view"
|
||||
@@ -401,8 +405,8 @@ class AutomationContext:
|
||||
else:
|
||||
id_list = [object_ids]
|
||||
print(
|
||||
f"Object {', '.join(id_list)} was marked with {level.value.upper()}",
|
||||
f"/{category} cause: {message}",
|
||||
f"Created new {level.value.upper()}"
|
||||
f" category: {category} caused by: {message}"
|
||||
)
|
||||
self._automation_result.object_results.append(
|
||||
ResultCase(
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user