관리-도구
편집 파일: loader.cpython-311.pyc
� �܋f� � �V � d dl Z d dlZd dlmZ d dlmZ d dlmZ G d� de� � Z dS )� N)�Adapter)�Parser)�Rulesc �P � e Zd ZdZ eddg� � Zd� Zd� Zd� Zd� Z d� Z d � Zd S )�Loaderz*Load TAP lines into unittest-able objects.� diagnostic�unknownc �, � t � � | _ d S )N)r �_parser)�selfs �[/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/tap/loader.py�__init__zLoader.__init__ s � ��x�x����� c �� � t j � � }|D ]`}t j � |� � r| � ||� � �8|� | � |� � � � �a|S )z�Load any files found into a suite. Any directories are walked and their files are added as TAP files. :returns: A ``unittest.TestSuite`` instance )�unittest� TestSuite�os�path�isdir�_find_tests_in_directory�addTest�load_suite_from_file)r �files�suite�filepaths r �loadzLoader.load s{ � � �"�$�$��� C� C�H��w�}�}�X�&�&� C��-�-�h��>�>�>�>�� � �d�7�7��A�A�B�B�B�B��r c � � t j � � }t ||� � }t j � |� � s|� � � |S | j � |� � }| � ||||� � S )z{Load a test suite with test lines from the provided TAP file. :returns: A ``unittest.TestSuite`` instance ) r r r r r �exists�handle_file_does_not_existr � parse_file�_load_lines)r �filenamer �rules�line_generators r r zLoader.load_suite_from_file s} � � �"�$�$���h��&�&���w�~�~�h�'�'� ��,�,�.�.�.��L���0�0��:�:������.�%��G�G�Gr c � � t j � � }t d|� � }| j � � � }| � d|||� � S )z}Load a test suite with test lines from the TAP stream on STDIN. :returns: A ``unittest.TestSuite`` instance �stream)r r r r �parse_stdinr! )r r r# r$ s r �load_suite_from_stdinzLoader.load_suite_from_stdin/ sN � � �"�$�$���h��&�&����1�1�3�3������.�%��G�G�Gr c �� � t j |� � D ]S\ }}}|D ]J}t j � ||� � }|� | � |� � � � �K�TdS )z;Find test files in the directory and add them to the suite.N)r �walkr �joinr r )r � directoryr �dirpath�dirnames� filenamesr"