Files
speckle-automate-checker/tests/test_function.py
T
Jonathon Broughton 129132dd3a
build and deploy Speckle functions / publish-automate-function-version (push) Has been cancelled
Fixes (#63)
* Improves rule number handling

Adds a fallback mechanism for retrieving rule numbers.

This ensures the system can handle cases where the primary
"Rule Number" field is missing or empty, defaulting to "Rule #"
to maintain data integrity.
Also corrects some docstring formatting.

* Improves rule processing efficiency

Avoids unnecessary rule processing by checking rule severity against the minimum configured severity level. Also ensures that results are only attached to failed objects if they exist and meet the minimum severity criteria. Addresses a potential issue where rules with no "Report Severity" column could cause errors, by considering an alternative "Severity" column.

* Adds Python compatibility inspection

Ensures that the project is compatible with Python 3 by adding a compatibility inspection setting.

This will help to identify and address any potential compatibility issues early on.

* Updates integration test URL and severity.

Updates the default URL used in the integration test to a new speckle model checker endpoint.

Changes the minimum severity level from warning to info, increasing the detail of reported results.
2025-05-12 15:53:33 +01:00

44 lines
1.5 KiB
Python

"""Run integration tests with a speckle server."""
from speckle_automate import (
AutomationContext,
AutomationRunData,
AutomationStatus,
run_function,
)
from speckle_automate.fixtures import * # noqa: F401, F403
from inputs import MinimumSeverity
from src.function import automate_function
from src.helpers import speckle_print
from src.inputs import FunctionInputs
class TestFunction:
"""Test suite for the automate function."""
def test_function_run(self, test_automation_run_data: AutomationRunData, test_automation_token: str):
"""Run an integration test for the automate function.
Args:
test_automation_run_data (AutomationRunData): The automation run data provided by sdk.
test_automation_token (str): The automation token.
"""
speckle_print(str(test_automation_run_data))
speckle_print(str(test_automation_token))
"""Run an integration test for the automate function."""
automation_context = AutomationContext.initialize(test_automation_run_data, test_automation_token)
default_url: str = (
"https://speckle-model-checker-cedxvz7lzq-ew.a.run.app/r/6hdycwPELyTIT7Ueedh0UsWdJlTBefwSjDlcnd8LXGg/tsv"
)
automate_sdk = run_function(
automation_context,
automate_function,
FunctionInputs(spreadsheet_url=default_url, minimum_severity=MinimumSeverity.INFO, hide_skipped=True),
)
assert automate_sdk.run_status == AutomationStatus.SUCCEEDED