Your IP : 216.73.216.213


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.opt-1.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.Z
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r
rrr�existsZhandle_file_does_not_existrZ
parse_file�_load_lines)r�filenamer�rules�line_generatorr	r	r
r"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r
rrZparse_stdinr)rrrrr	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)rZ	directoryr�dirpathZdirnames�	filenamesrrr	r	r
r;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�ZtestZplanZbail�version)�category�
ignored_linesrrZsaw_test�skipZhandle_skipping_planZsaw_planZhandle_bailZsaw_version_at�check)rrrrrZline_counter�liner	r	r
rBs(








zLoader._load_linesN)�__name__�
__module__�__qualname__�__doc__�setr&rrrrrrr	r	r	r
rs
r)
rrZtap.adapterrZ
tap.parserrZ	tap.rulesr�objectrr	r	r	r
�<module>s