관리-도구
편집 파일: test_runner.cpython-311.pyc
� �܋fD � �t � d dl Z d dlZd dlZd dlZd dlmZ d dlmZ d dlmZm Z G d� dej � � ZdS )� N)�mock)� TAPTestRunner)� TAPTestResult�_trackerc �j � e Zd Zd� Zd� Zd� Zd� Z ej d� � d� � � Z d� Z d� Zd � Zd S )�TestTAPTestRunnerc �b � t � � }| � |j t � � d S )N)r �assertEqual�resultclassr )�self�runners �f/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/tap/tests/test_runner.py�test_has_tap_test_resultz*TestTAPTestRunner.test_has_tap_test_result s* � ���������+�]�;�;�;�;�;� c �� � t j }t j � � }t j |� � | � |t j � � |t _ dS )z�Test that the test runner sets the outdir so that TAP files will be written to that location. Setting class attributes to get the right behavior is a dirty hack, but the unittest classes aren't very extensible. N)r �outdir�tempfile�mkdtempr � set_outdirr )r �previous_outdirr s r �test_runner_uses_outdirz)TestTAPTestRunner.test_runner_uses_outdir sM � � #�/���!�#�#��� ��(�(�(�������1�1�1�)����r c � � t j }d}t j |� � | � |t j � � |t _ dS )z0Test that format is set on TAPTestResult FORMAT.z"{method_name}: {short_description}N)r �FORMATr � set_formatr )r �previous_format�fmts r �test_runner_uses_formatz)TestTAPTestRunner.test_runner_uses_format! sI � � (�.��2��� ��%�%�%�����m�2�3�3�3�.� ���r c � � t j }t j d� � | � t j � � |t _ dS )zTest that output is combined.TN)r �combinedr �set_combined� assertTrue)r �previous_combineds r �test_runner_uses_combinedz+TestTAPTestRunner.test_runner_uses_combined- sA � � %�-���"�4�(�(�(�����)�*�*�*�-����r zsys.exitc � � t j }d}t j |� � t ddd� � }t j � � }|� |� � | � |j � � |t _ dS )z%A bad format string exits the runner.zNot gonna work {sort_desc}NT� ) r r r r r �Mock�_descriptionr! �called)r � fake_exitr � bad_format�result�tests r �test_bad_format_stringz(TestTAPTestRunner.test_bad_format_string8 su � � (�.��1� �� ��,�,�,��t�T�1�-�-���y�{�{�����D�!�!�!���� �(�)�)�)�.� ���r c �> � t j }t j }t � � }|� d� � | � t j � � | � t j t j � � |t _ |t _ dS )z&The tracker is set for streaming mode.TN)r � streaming�streamr � set_streamr! �sys�stdout�r �previous_streaming�previous_streamr s r �&test_runner_sets_tracker_for_streamingz8TestTAPTestRunner.test_runner_sets_tracker_for_streamingG so � �%�/��"�/���������$��������*�+�+�+��������4�4�4�/���)����r c � � t j }t j }t � � }|� d� � | � |j j j t j � � |t _ |t _ d S )NT) r r/ r0 r r1 r! �name�os�devnullr4 s r �+test_runner_stream_to_devnull_for_streamingz=TestTAPTestRunner.test_runner_stream_to_devnull_for_streamingU s` � �%�/��"�/���������$�������� �,�1�2�:�>�>�>�/���)����r c � � t j }t j d� � | � t j � � t j d� � | � t j � � |t _ dS )z,Test that the case header can be turned off.FTN)r �headerr � set_header�assertFalser! )r �previous_headers r �test_runner_uses_headerz)TestTAPTestRunner.test_runner_uses_headera sb � � #�/��� ��'�'�'������)�)�)�� ��&�&�&������(�(�(�)����r N) �__name__� __module__�__qualname__r r r r# r �patchr- r7 r<