diff --git a/elementary/monitor/api/tests/schema.py b/elementary/monitor/api/tests/schema.py index 83664cfcd..7c2410aca 100644 --- a/elementary/monitor/api/tests/schema.py +++ b/elementary/monitor/api/tests/schema.py @@ -79,6 +79,7 @@ class TestSchema(BaseModel): display_name: str original_path: Optional[str] = None type: str + is_singular: Optional[bool] = None test_type: Optional[str] = None test_sub_type: Optional[str] = None test_params: dict diff --git a/elementary/monitor/api/tests/tests.py b/elementary/monitor/api/tests/tests.py index fce744d6d..aedbe41a9 100644 --- a/elementary/monitor/api/tests/tests.py +++ b/elementary/monitor/api/tests/tests.py @@ -443,6 +443,14 @@ def _get_normalized_full_path( return f"{package_name}/{original_path}" return original_path + @staticmethod + def _get_is_singular(original_path: Optional[str]) -> Optional[bool]: + return ( + (original_path.startswith("tests/") and original_path.endswith(".sql")) + if original_path + else None + ) + @classmethod def _parse_test_db_row(cls, test_db_row: TestDBRowSchema) -> TestSchema: latest_run_datetime = ( @@ -467,6 +475,7 @@ def _parse_test_db_row(cls, test_db_row: TestDBRowSchema) -> TestSchema: display_name=cls._get_display_name(test_db_row.name), original_path=test_db_row.original_path, type=test_db_row.type, + is_singular=cls._get_is_singular(test_db_row.original_path), test_type=test_db_row.test_type, test_sub_type=test_db_row.test_sub_type, test_params=test_db_row.test_params,