Your IP : 216.73.216.196


Current Path : /opt/alt/python37/lib/python3.7/site-packages/tap/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib/python3.7/site-packages/tap/__pycache__/loader.cpython-37.pyc

B

.��V��@sHddlZddlZddlmZddlmZddlmZGdd�de�Z	dS)�N)�Adapter)�Parser)�Rulesc@sLeZdZdZeddg�Zdd�Zdd�Zdd	�Zd
d�Z	dd
�Z
dd�ZdS)�Loaderz*Load TAP lines into unittest-able objects.�
diagnostic�unknowncCst�|_dS)N)r�_parser)�self�r
�;/opt/alt/python37/lib/python3.7/site-packages/tap/loader.py�__init__szLoader.__init__cCsDt��}x6|D].}tj�|�r,|�||�q|�|�|��qW|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�filepathr
r
r�loads
zLoader.loadcCsFt��}t||�}tj�|�s*|��|S|j�|�}|�	||||�S)z{Load a test suite with test lines from the provided TAP file.

        :returns: A ``unittest.TestSuite`` instance
        )
r
rrrr�existsZhandle_file_does_not_existr�
parse_file�_load_lines)r	�filenamer�rules�line_generatorr
r
rr"s
zLoader.load_suite_from_filecCs,t��}td|�}|j��}|�d|||�S)z}Load a test suite with test lines from the TAP stream on STDIN.

        :returns: A ``unittest.TestSuite`` instance
        �stream)r
rrrZparse_stdinr)r	rrrr
r
r�load_suite_from_stdin1s

zLoader.load_suite_from_stdincCsJxDt�|�D]6\}}}x*|D]"}tj�||�}|�|�|��qWqWdS)z;Find test files in the directory and add them to the suite.N)r�walkr�joinrr)r	�	directoryr�dirpath�dirnames�	filenamesrrr
r
rr;s
zLoader._find_tests_in_directorycCs�d}x�|D]�}|d7}|j|jkr$q
|jdkrH|�t||��|��q
|jdkrt|jrf|�|�|S|�||�q
|jdkr�|�|�|S|jdkr
|�	|�q
W|�
|�|S)z7Load a suite with lines produced by the line generator.r��test�plan�bail�version)�category�
ignored_linesrrZsaw_test�skipZhandle_skipping_planZsaw_planZhandle_bailZsaw_version_at�check)r	rrrrZline_counter�liner
r
rrBs(








zLoader._load_linesN)�__name__�
__module__�__qualname__�__doc__�setr-rrrr rrr
r
r
rrs
r)
rr
Ztap.adapterrZ
tap.parserrZ	tap.rulesr�objectrr
r
r
r�<module>s