관리-도구
편집 파일: lib.cpython-311.pyc
� �܋fw � � � d Z ddlmZ ddlZddlZddlmZ ddlmZ ddlZddl Z ddl Z ddlZddlZddl Z ddlZddlmZ G d� de j � � Zd � Zd � Zdd�Zdd�Zdd�Zd� Zdd�Z G d� d� � Z G d� de� � ZdS )zUtilities used in ODB testing� )�OStreamN)�array)�BytesIO)�wrapsc �6 � � e Zd ZdZdZe� fd�� � Z� xZS )�TestBasez�Base class for all tests TestCase providing access to readonly repositories using the following member variables. * gitrepopath * read-only base path of the git source repository, i.e. .../git/.git �GITDB_TEST_GIT_REPO_BASEc �� �� t � � � � � n# t $ r Y nw xY wt j � | j � � | _ | j spt j d| j � � t j j }t j � | | |t � � � � � � d� � | _ | j � d� � sJ �d S )NzpYou can set the %s environment variable to a .git repository of your choice - defaulting to the gitdb repositoryz.git)�super� setUpClass�AttributeError�os�environ�get�k_env_git_repo�gitrepopath�logging�info�path�dirname�join�__file__�endswith)�cls�ospd� __class__s ��_/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/gitdb/test/lib.pyr zTestBase.setUpClass( s� �� � ��G�G��� � � � ��� � � ��D� ���� �*�.�.��);�<�<����� O��L� C� EH� EW� X� X� X��7�?�D� �g�l�l�4�4���T�T�(�^�^�0D�0D�+E�+E�v�N�N�C�O���'�'��/�/�/�/�/�/�/s � $ � 1�1)�__name__� __module__�__qualname__�__doc__r �classmethodr � __classcell__)r s @r r r sU �� � � � � �� � 0�N� � 0� 0� 0� 0� �[� 0� 0� 0� 0� 0� r c �* � � � fd�}� j |_ |S )z�Create a temporary directory which can be written to, remove it if the test succeeds, but leave it otherwise to aid additional debuggingc �� �� t j �j �� � }t j |� � d} �| |� � |s(t j � � t j |� � S S # t $ rD t j � dt | � � j � d�j � d|�d�� � d}� w xY w# |s(t j � � t j |� � w w xY w)N)�prefixFzTest �.z failed, output is at � T)�tempfile�mktempr r �mkdir�gc�collect�shutil�rmtree� Exception�sys�stderr�write�type)�selfr �keep�funcs �r �wrapperz"with_rw_directory.<locals>.wrapperA s �� ���d�m�4�4�4�� �������� $� ��t�D�$�'�'� � $�� ����� �d�#�#�#�#� $�� � � � �� � � �!n��d���)<�!n�!n�t�}�!n�!n�dh�!n�!n�!n�o�o�o���� ����� � $�� ����� �d�#�#�#�#� $���s �A* �*AB8�8B; �;,C'�r �r8 r9 s ` r �with_rw_directoryr<