bgrddlZddlmZddlZddlZddlZddlmZddlmZddl m Z Gdde Z dS)N)StringIO)mock)Loader)TestCasec|eZdZdZdZdZdZdZdZdZ e j de d d Z d S) TestLoaderzTests for tap.loader.Loadercptjd}tjd}||d|t}||j }| dt|j dS)zThe loader handles a file.zTAP 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. Fdeleteutf-8N) inspectcleandoctempfileNamedTemporaryFilewriteencodecloserload_suite_from_filename assertEquallen_testsselfsampletemploadersuites f/builddir/build/BUILD/cloudlinux-venv-1.0.7/venv/lib/python3.11/site-packages/tap/tests/test_loader.pytest_handles_filezTestLoader.test_handles_files!    *%888 6==))*** ++DI66 C --.....ct}|d}|dt|j|dd|jdjjdS)z8The loader records a failure when a file does not exist.z phony.tapz{filename} does not exist.)filenamerN)rrrrrformat_line descriptionrrrs r test_file_does_not_existz#TestLoader.test_file_does_not_exist%s++K88 C --...  ( / / / E E LO ! -     r"ctj}tj|d}tj|t tj|dd5}|ddddn #1swxYwYt tj|dd5}|ddddn #1swxYwYt}| |g}| dt|j dS)Nsubz a_file.tapwzok A passing testzanother_file.tapznot ok A failing test) rmkdtempospathjoinmkdiropenrrloadrrr)r directory sub_directoryfrrs r test_handles_directoryz!TestLoader.test_handles_directory1s$&&  Y66   "',,y,77 = = ) GG' ( ( ( ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) "',,}.@AA3 G G -1 GG+ , , , - - - - - - - - - - - - - - - YK(( C --.....s$6BBBC33C7:C7ctjd}tjd}||d|t}||j }| dt|j | d|j dj jdS)NzGTAP version 13 TAP version 13 1..0 Fr r r$z Multiple version lines appeared.rrrrrrrrrrrrrrr'r(rs r 'test_errors_with_multiple_version_linesz2TestLoader.test_errors_with_multiple_version_lines?s!    *%888 6==))*** ++DI66 C --...  . Q0E0Q     r"ctjd}tjd}||d|t}||j }| dt|j | d|j dj jdS)NzY# Something that doesn't belong. TAP version 13 1..0 Fr r r$z&The version must be on the first line.rr;rs r *test_errors_with_version_not_on_first_linez5TestLoader.test_errors_with_version_not_on_first_lineRs!    *%888 6==))*** ++DI66 C --...  4 LO ! -     r"ctjd}tjd}||d|t}||j }| dt|j | d|j dj jdS)NzZ1..0 # Skipping this test file. ok This should not get processed. Fr r r$zSkipping this test file.rr;rs r test_skip_plan_aborts_loadingz(TestLoader.test_skip_plan_aborts_loadingfs!    *%888 6==))*** ++DI66 C --... 3U\!_5J5VWWWWWr"ztap.parser.sys.stdinct}|}|t|tjdS)N)rload_suite_from_stdin assertTrue isinstanceunittest TestSuiter)s r test_loads_from_streamz!TestLoader.test_loads_from_streamvsA,,..  5(*<==>>>>>r"N)__name__ __module__ __qualname____doc__r!r*r9r<r>r@rpatchrrHr"r rr s%%///,     / / /   &   (XXX TZ& 66??76???r"r) riorr0rrFr tap.loaderr tap.testsrrrNr"r rRs n?n?n?n?n?n?n?n?n?n?r"