File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -250,14 +250,12 @@ def test_proxy_error_propagates(self):
250250# ---------------------------------------------------------------------------
251251
252252class TestCache :
253- def test_second_call_uses_cache (self , mocker ):
254- # Prime the cache with the first call, then spy on open() to confirm
255- # the second call does NOT read the file again.
253+ def test_second_call_uses_cache (self , reset_cache ):
254+ from unittest .mock import patch , MagicMock
256255 Endpoint .get_contentstack_endpoint ("na" , "contentDelivery" )
257- spy = mocker .patch ("builtins.open" , wraps = open )
258- Endpoint .get_contentstack_endpoint ("eu" , "contentDelivery" )
259- # The cached path must not trigger any file reads.
260- spy .assert_not_called ()
256+ with patch ("builtins.open" , wraps = open ) as spy :
257+ Endpoint .get_contentstack_endpoint ("eu" , "contentDelivery" )
258+ spy .assert_not_called ()
261259
262260 def test_reset_cache_clears_data (self ):
263261 Endpoint .get_contentstack_endpoint ("na" ) # primes cache
You can’t perform that action at this time.
0 commit comments