Skip to content

Commit 780008e

Browse files
authored
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
1 parent f6eec46 commit 780008e

File tree

1 file changed

+7
-19
lines changed

1 file changed

+7
-19
lines changed

tests/integration/conftest.py

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -674,7 +674,7 @@ def with_dummy_grants_and_tacls(self):
674674
Grant,
675675
)
676676

677-
@cached_property
677+
@property
678678
def created_databases(self) -> list[str]:
679679
created_databases: set[str] = set()
680680
for udf_info in self._udfs:
@@ -699,29 +699,17 @@ def created_databases(self) -> list[str]:
699699
created_databases.add(grant.database)
700700
return list(created_databases)
701701

702-
@cached_property
702+
@property
703703
def created_groups(self) -> list[str]:
704-
created_groups = []
705-
for group in self._groups:
706-
if group.display_name is not None:
707-
created_groups.append(group.display_name)
708-
return created_groups
704+
return [group.display_name for group in self._groups if group.display_name is not None]
709705

710-
@cached_property
706+
@property
711707
def created_jobs(self) -> list[int]:
712-
created_jobs = []
713-
for job in self._jobs:
714-
if job.job_id is not None:
715-
created_jobs.append(job.job_id)
716-
return created_jobs
708+
return [job.job_id for job in self._jobs if job.job_id is not None]
717709

718-
@cached_property
710+
@property
719711
def created_dashboards(self) -> list[str]:
720-
created_dashboards = []
721-
for dashboard in self._dashboards:
722-
if dashboard.id is not None:
723-
created_dashboards.append(dashboard.id)
724-
return created_dashboards
712+
return [dashboard.id for dashboard in self._dashboards if dashboard.id is not None]
725713

726714
@cached_property
727715
def azure_service_principal_crawler(self) -> StaticServicePrincipalCrawler:

0 commit comments

Comments
 (0)