← Back
Editing: test_cache.cpython-311.pyc
� ��Oc; � �\ � d Z ddlZddlmZ ddlmZ ddlmZ G d� dej � � Z dS )zTests for stevedore._cache � N)�mock)�_cache)�utilsc �~ � e Zd Zd� Zd� Z ej d� � ej d� � d� � � � � Zd� ZdS )� TestCachec �� � t j � t dd� � 5 t j � � }| � |j � � ddd� � dS # 1 swxY w Y dS )ziTest 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 �</usr/lib/python3/dist-packages/stevedore/tests/test_cache.py�test_disable_caching_executablez)TestCache.test_disable_caching_executable s� � � �Z� � �s�L�+� >� >� 2� 2��,�.�.�C��O�O�C�0�1�1�1� 2� 2� 2� 2� 2� 2� 2� 2� 2� 2� 2� 2���� 2� 2� 2� 2� 2� 2s �.A"�"A&�)A&c � � t j � � }t j d� � 5 }d|_ t j � � }|� d|z � � | � |j � � d|_ t j � � }| � |j � � ddd� � dS # 1 swxY w Y dS )zSTest caching is disabled if .disable file is present in target dir zos.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_filez#TestCache.test_disable_caching_file! s� � � �)�+�+� � �Z�(� )� )� 3�Y�%)�I�"��,�.�.�C��(�(���)B�C�C�C��O�O�C�0�1�1�1�%*�I�"��,�.�.�C����S�1�2�2�2� 3� 3� 3� 3� 3� 3� 3� 3� 3� 3� 3� 3���� 3� 3� 3� 3� 3� 3s �BB6�6B:�=B:zos.makedirsz builtins.openc � � t j � � }d|_ t |_ |� d� � |� � � d S )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_writez*TestCache.test__get_data_for_path_no_write1 sK � � �l�n�n��#��� '� �����v�&�&�&��$�$�&�&�&�&�&� c �n � t j � � }| � |d t � � d S )N�groups)r �_build_cacheable_data�assertIsInstance�dict)r �rets r �test__build_cacheable_dataz$TestCache.test__build_cacheable_data: s2 � � �*�,�,�����c�(�m�T�2�2�2�2�2r% N) �__name__� __module__�__qualname__r r r r r$ r, � r% r r r s� � � � � � �2� 2� 2�3� 3� 3� �T�Z� ����T�Z�� � �'� '� !� � ��'�3� 3� 3� 3� 3r% r ) �__doc__r �unittestr � stevedorer �stevedore.testsr �TestCaser r0 r% r �<module>r6 s� ��� � � � � � � � � � � � � � � � � � !� !� !� !� !� !�)3� )3� )3� )3� )3��� )3� )3� )3� )3� )3r%
Save File
Cancel