
    z	i;	                     ^    S r SSKrSSKJr  SSKJr  SSKJr   " S S\R                  5      r	g)zTests for stevedore._cache
    N)mock)_cache)utilsc                       \ rS rSrS rS r\R                  " S5      \R                  " S5      S 5       5       rS r	Sr
g	)
	TestCache   c                     [         R                  R                  [        SS5         [        R
                  " 5       nU R                  UR                  5        SSS5        g! , (       d  f       g= f)zYTest caching is disabled if python interpreter is located under /tmp
directory (Ansible)

executablez	/tmp/fakeN)r   patchobjectsysr   Cache
assertTrue_disable_caching)selfsots     T/home/james-whalen/.local/lib/python3.13/site-packages/stevedore/tests/test_cache.pytest_disable_caching_executable)TestCache.test_disable_caching_executable   sC     ZZsL+>,,.COOC001 ?>>s   1A  
A.c                    [         R                  " 5       n[        R                  " S5       nSUl        [         R
                  " 5       nUR                  SU-  5        U R                  UR                  5        SUl        [         R
                  " 5       nU R                  UR                  5        SSS5        g! , (       d  f       g= f)zCTest caching is disabled if .disable file is present in target
dir
zos.path.isfileTz%s/.disableFN)
r   _get_cache_dirr   r   return_valuer   assert_called_withr   r   assertFalse)r   	cache_dir	mock_pathr   s       r   test_disable_caching_file#TestCache.test_disable_caching_file!   s     ))+	ZZ()Y%)I",,.C(()BCOOC001%*I",,.CS112 *))s   BB88
Czos.makedirszbuiltins.openc                     [         R                  " 5       nSUl        [        Ul        UR                  S5        UR                  5         g )NTfake)r   r   r   IOErrorside_effect_get_data_for_pathassert_not_called)r   	mock_open
mock_mkdirr   s       r    test__get_data_for_path_no_write*TestCache.test__get_data_for_path_no_write1   s9     lln# '	v&$$&    c                 `    [         R                  " 5       nU R                  US   [        5        g )Ngroups)r   _build_cacheable_dataassertIsInstancedict)r   rets     r   test__build_cacheable_data$TestCache.test__build_cacheable_data:   s&    
 **,c(mT2r)    N)__name__
__module____qualname____firstlineno__r   r   r   r   r'   r0   __static_attributes__r2   r)   r   r   r      s?    23  
ZZ	ZZ ' ! '3r)   r   )
__doc__r   unittestr   	stevedorer   stevedore.testsr   TestCaser   r2   r)   r   <module>r=      s&    
   !)3 )3r)   