Compare commits

...

6 Commits

Author SHA1 Message Date
Gergő Jedlicska f6917b0761 Merge pull request #318 from specklesystems/gergo/markLogs
feat: reduce log message context for object results
2023-11-13 11:39:49 +01:00
Gergő Jedlicska 04764b17eb feat: reduce log message context for object results 2023-11-13 09:14:06 +01:00
Gergő Jedlicska dbe3d759f6 Merge pull request #317 from specklesystems/KatKatKateryna-patch-1
handle "append" with incoming type "list"
2023-11-13 09:09:23 +01:00
KatKatKateryna f6ff484e66 handle "append" with incoming type "list" 2023-11-13 04:53:03 +08:00
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 16 additions and 12 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>"]
+7 -3
View File
@@ -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(
+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()