Skip to content

Commit 3e16e1c

Browse files
added caching back in to see if it runs on github actions tests
1 parent fe14cd8 commit 3e16e1c

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

src/snowflake/connector/platform_detection.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,14 @@
44
import re
55
from concurrent.futures.thread import ThreadPoolExecutor
66
from enum import Enum
7+
from functools import cache
78

89
import boto3
910
from botocore.config import Config
1011
from botocore.utils import IMDSFetcher
1112

1213
from .vendored import requests
1314

14-
# TODO: add this back
15-
# from functools import cache
16-
1715

1816
class _DetectionState(Enum):
1917
"""Internal enum to represent the detection state of a platform."""
@@ -361,8 +359,7 @@ def is_github_action():
361359
)
362360

363361

364-
# TODO: add cache back in once I verify this is the root cause issue
365-
# @cache
362+
@cache
366363
def detect_platforms(timeout_seconds: float | None) -> list[str]:
367364
"""
368365
Detect all potential platforms that the current environment may be running on.

test/unit/test_detect_platforms.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@ class TestDetectPlatforms:
2121
def teardown(self):
2222
with patch.dict(os.environ, clear=True):
2323
yield
24-
25-
# TODO: add this back probably once I verify caching is causing the test failures
26-
# detect_platforms.cache_clear() # clear cache after each test
24+
detect_platforms.cache_clear() # clear cache after each test
2725

2826
def test_no_platforms_detected(self, broken_metadata_service):
2927
result = detect_platforms(timeout_seconds=None)

0 commit comments

Comments
 (0)