From 780008eb364d0000dbe42b0a31797c1077532ee4 Mon Sep 17 00:00:00 2001 From: Andrew Snare Date: Tue, 26 Nov 2024 13:28:13 +0100 Subject: [PATCH] Tech debt: avoid caching with some test context properties (#3379) ## Changes This PR modifies some properties on the integration test context so that they don't cache their return values; these properties are based on internal mutable state and the current caching situation makes it difficult to know if they are yielding the current value or an earlier one that might no longer be correct. ### Tests - existing integration tests --- tests/integration/conftest.py | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/tests/integration/conftest.py b/tests/integration/conftest.py index 13007f0165..0fa8a6d163 100644 --- a/tests/integration/conftest.py +++ b/tests/integration/conftest.py @@ -674,7 +674,7 @@ def with_dummy_grants_and_tacls(self): Grant, ) - @cached_property + @property def created_databases(self) -> list[str]: created_databases: set[str] = set() for udf_info in self._udfs: @@ -699,29 +699,17 @@ def created_databases(self) -> list[str]: created_databases.add(grant.database) return list(created_databases) - @cached_property + @property def created_groups(self) -> list[str]: - created_groups = [] - for group in self._groups: - if group.display_name is not None: - created_groups.append(group.display_name) - return created_groups + return [group.display_name for group in self._groups if group.display_name is not None] - @cached_property + @property def created_jobs(self) -> list[int]: - created_jobs = [] - for job in self._jobs: - if job.job_id is not None: - created_jobs.append(job.job_id) - return created_jobs + return [job.job_id for job in self._jobs if job.job_id is not None] - @cached_property + @property def created_dashboards(self) -> list[str]: - created_dashboards = [] - for dashboard in self._dashboards: - if dashboard.id is not None: - created_dashboards.append(dashboard.id) - return created_dashboards + return [dashboard.id for dashboard in self._dashboards if dashboard.id is not None] @cached_property def azure_service_principal_crawler(self) -> StaticServicePrincipalCrawler: