File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed
Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -98,3 +98,32 @@ def fake_github_actions_metadata_service():
9898 """Emulates the GitHub Actions metadata service."""
9999 with FakeGitHubActionsService () as server :
100100 yield server
101+
102+
103+ @pytest .fixture (autouse = True )
104+ def crl_cache_tmpdir (request , tmp_path , monkeypatch ):
105+ """
106+ Fixture that patches the CRL cache directory to use a temporary directory.
107+
108+ This prevents tests from creating the cache folder in the real system location
109+ (e.g., ~/Library/Caches/Snowflake/crls on macOS) and ensures test isolation.
110+ """
111+ # Exclude test checking default cache path
112+ if "test_platform_specific_cache_path" in request .node .name :
113+ return None
114+
115+ from snowflake .connector import crl_cache
116+
117+ # Create a temporary cache directory for this test
118+ temp_crl_cache = tmp_path / "crl_cache"
119+ temp_crl_cache .mkdir (mode = 0o700 )
120+
121+ # Patch the function that returns the default cache path
122+ monkeypatch .setattr (
123+ crl_cache , "_get_default_crl_cache_path" , lambda : temp_crl_cache
124+ )
125+
126+ # Also reset the file cache singleton to ensure each test gets a fresh cache
127+ monkeypatch .setattr (crl_cache .CRLCacheFactory , "_file_cache_instance" , None )
128+
129+ return temp_crl_cache
You can’t perform that action at this time.
0 commit comments