Your IP : 216.73.216.213


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

B

.��V��@s�ddlZddlZddlZddlZyddlmZWnek
rLddlZYnXddlmZddlm	Z	ddl
mZGdd�de�ZdS)�N)�mock)�_)�Loader)�TestCasec@sReZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	e
�d�dd��ZdS)�
TestLoaderzTests for tap.loader.LoadercCsVt�d�}tjdd�}|�|�d��|��t�}|�|j	�}|�
dt|j��dS)zThe loader handles a file.z�TAP version 13
            1..2
            # This is a diagnostic.
            ok 1 A passing test
            not ok 2 A failing test
            This is an unknown line.
            Bail out! This test would abort.
            F)�deletezutf-8�N)
�inspect�cleandoc�tempfile�NamedTemporaryFile�write�encode�closer�load_suite_from_file�name�assertEqual�len�_tests)�self�sample�temp�loader�suite�r�F/opt/alt/python37/lib/python3.7/site-packages/tap/tests/test_loader.py�test_handles_fileszTestLoader.test_handles_filecCsHt�}|�d�}|�dt|j��|�td�jdd�|jdjj�dS)z8The loader records a failure when a file does not exist.z	phony.tap�z{filename} does not exist.)�filenamerN)	rrrrrr�format�_line�description)rrrrrr�test_file_does_not_exist*s
z#TestLoader.test_file_does_not_existc	Cs�t��}tj�|d�}t�|�ttj�|d�d��}|�d�WdQRXttj�|d�d��}|�d�WdQRXt�}|�	|g�}|�
dt|j��dS)N�subz
a_file.tap�wzok A passing testzanother_file.tapznot ok A failing test�)
r�mkdtemp�os�path�join�mkdir�openr
r�loadrrr)r�	directoryZ
sub_directory�frrrrr�test_handles_directory5s
z!TestLoader.test_handles_directorycCspt�d�}tjdd�}|�|�d��|��t�}|�|j	�}|�
dt|j��|�
t
d�|jdjj�dS)NzGTAP version 13
            TAP version 13
            1..0
            F)rzutf-8rz Multiple version lines appeared.r)r	r
rrr
rrrrrrrrrr r!)rrrrrrrr�'test_errors_with_multiple_version_linesCsz2TestLoader.test_errors_with_multiple_version_linescCspt�d�}tjdd�}|�|�d��|��t�}|�|j	�}|�
dt|j��|�
t
d�|jdjj�dS)NzY# Something that doesn't belong.
            TAP version 13
            1..0
            F)rzutf-8rz&The version must be on the first line.r)r	r
rrr
rrrrrrrrrr r!)rrrrrrrr�*test_errors_with_version_not_on_first_lineUsz5TestLoader.test_errors_with_version_not_on_first_linecCslt�d�}tjdd�}|�|�d��|��t�}|�|j	�}|�
dt|j��|�
d|jdj
j�dS)NzZ1..0 # Skipping this test file.
            ok This should not get processed.
            F)rzutf-8rzSkipping this test file.r)r	r
rrr
rrrrrrrrr r!)rrrrrrrr�test_skip_plan_aborts_loadinggsz(TestLoader.test_skip_plan_aborts_loadingztap.parser.syscCs$t�}|��}|�t|tj��dS)N)rZload_suite_from_stdin�
assertTrue�
isinstance�unittest�	TestSuite)rZmock_sysrrrrr�test_loads_from_streamwsz!TestLoader.test_loads_from_streamN)
�__name__�
__module__�__qualname__�__doc__rr"r/r0r1r2r�patchr7rrrrrsr)
r	r'rr5r�ImportError�tap.i18nrZ
tap.loaderrZ	tap.testsrrrrrr�<module>s