Skip to content

Commit

Permalink
Merge pull request #316 from specklesystems/gergo/contextViewFix
Browse files Browse the repository at this point in the history
fix: report relative url for context view
  • Loading branch information
gjedlicska authored Nov 11, 2023
2 parents 1693465 + 10f4957 commit bd00039
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>"]
Expand Down
4 changes: 4 additions & 0 deletions src/speckle_automate/automation_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,10 @@ def create_new_version_in_project(
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} "
Expand Down
2 changes: 2 additions & 0 deletions src/speckle_automate/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
14 changes: 6 additions & 8 deletions tests/intergration/speckle_automate/test_automation_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
)

Expand All @@ -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()
Expand All @@ -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()

0 comments on commit bd00039

Please sign in to comment.