
    3g                         d dl Z d dlmZ d dlmZmZmZmZmZ  G d d      Z	 G d d      Z
 G d d	      Z G d
 de      Z G d de      Z G d de      Zy)    N)default_plugins)BaseTestSuiteBaseTestRunnerMutationTestResultCoverageTestResultBaseTestc                   *    e Zd Zd Zd Zd Zd Zd Zy)PytestMutpyPluginc                 0    || _         t               | _        y N)skipped_testsr   mutation_test_result)selfr   s     /home/xtuchyna/.var/app/com.visualstudio.code/data/virtualenvs/gen-test-bench-v8TMe8KL/lib/python3.12/site-packages/mutpy/test_runners/pytest_runner.py__init__zPytestMutpyPlugin.__init__	   s    *$6$8!    c                 Z    t        fd| j                  j                  D        d       d uS )Nc              3   B   K   | ]  }|j                   k(  s|  y wr   name.0testnodeids     r   	<genexpr>z6PytestMutpyPlugin.has_failed_before.<locals>.<genexpr>   s      ^&Fd$))W]J]T&F   )nextr   failedr   r   s    `r   has_failed_beforez#PytestMutpyPlugin.has_failed_before   s)    ^d&?&?&F&F^`demqqqr   c                 Z    t        fd| j                  j                  D        d       d uS )Nc              3   B   K   | ]  }|j                   k(  s|  y wr   r   r   s     r   r   z<PytestMutpyPlugin.has_been_skipped_before.<locals>.<genexpr>   s      _&Gd499X^K^T&Gr   )r   r   skippedr   s    `r   has_been_skipped_beforez)PytestMutpyPlugin.has_been_skipped_before   s)    _d&?&?&G&G_aefnrrrr   c                     |D ]D  }|j                   | j                  v s|j                  t        j                  j
                         F y r   )r   r   
add_markerpytestmarkskipr   itemsitems      r   pytest_collection_modifyitemsz/PytestMutpyPlugin.pytest_collection_modifyitems   s4    D{{d000 0 01 r   c                    |j                   r&| j                  j                  |j                         y |j                  r,| j                  |j                        sd|j                  j                  j                  v rB| j                  j                  t        t        |j                  j                                     y t        |d      s?t        dd      5 }|j                  |j                  dz   t        |      z          d d d        | j                  j!                  |j                  |j                  j                  j                  j#                         d   |j$                         y |j&                  rn|j(                  dk(  r^| j                  |j                        sB| j+                  |j                        s&| j                  j-                  |j                         y y y y y # 1 sw Y   xY w)N	TypeErrorlongreprtextz
Output.txtw r   teardown)r#   r   add_skippedr   r   r    longrepr	reprcrashmessageset_type_errorr/   strhasattropenwritevars
add_failed
splitlinesr0   passedwhenr$   
add_passed)r   report	text_files      r   pytest_runtest_logreportz*PytestMutpyPlugin.pytest_runtest_logreport   sb   >>%%11&--@]]4#9#9&--#Hfoo77???))883vG`G`Ca9bcv~6lC0I!(;d6l(JK 1))44V]]FOOD]D]DeDeDpDpDrstDu5;5H5HJ]]v{{j8AWAWX^XeXeAf44V]]C%%00? D Bg8]	 10s   +G''G0N)__name__
__module____qualname__r   r    r$   r-   rE    r   r   r
   r
      s    9rs2
@r   r
   c                       e Zd Zd Zd Zd Zy)PytestMutpyCoveragePluginc                 4    d | _         t        |      | _        y )Ncoverage_injector)current_testr   coverage_result)r   rN   s     r   r   z"PytestMutpyCoveragePlugin.__init__+   s     1DUVr   c                 F    | j                   j                          || _        y r   )rP   start_measure_coveragerO   )r   r,   s     r   pytest_runtest_setupz.PytestMutpyCoveragePlugin.pytest_runtest_setup/   s    335 r   c                 n    | j                   j                  t        | j                               d | _        y r   )rP   stop_measure_coverage
PytestTestrO   )r   nextitems     r   pytest_runtest_teardownz1PytestMutpyCoveragePlugin.pytest_runtest_teardown3   s)    22:d>O>O3PQ r   N)rF   rG   rH   r   rS   rX   rI   r   r   rK   rK   )   s    W!!r   rK   c                       e Zd Zd Zd Zy)PytestMutpyTestDiscoveryPluginc                     g | _         y r   )testsr   s    r   r   z'PytestMutpyTestDiscoveryPlugin.__init__9   s	    
r   c                 H    |D ]  }| j                   j                  |        y r   )r\   appendr*   s      r   r-   z<PytestMutpyTestDiscoveryPlugin.pytest_collection_modifyitems<   s    DJJd# r   N)rF   rG   rH   r   r-   rI   r   r   rZ   rZ   8   s    $r   rZ   c                   2    e Zd Zd Zd Zd Zd ZddZd Zy)	PytestTestSuitec                 @    t               | _        t               | _        y r   )setr\   r   r]   s    r   r   zPytestTestSuite.__init__B   s    U
 Ur   c                 "   |r6| j                   j                  dj                  |j                  |             y t	        |d      r&| j                   j                  |j                         y | j                   j                  |j
                         y )Nz{0}::{1}__file__)r\   addformatre   r:   rF   )r   test_moduletarget_tests      r   	add_testszPytestTestSuite.add_testsF   s^    JJNN:,,[-A-A;OP[*-JJNN;//0JJNN;//0r   c                 b    | j                   j                  |j                  j                         y r   )r   rf   internal_test_objr   )r   r   s     r   	skip_testzPytestTestSuite.skip_testN   s"    t55<<=r   c                     t        | j                        }t        j                  t	        | j
                        g dz   t	        t              |gz          |j                  S )N)r   )z-x-pno:terminalargsplugins)r
   r   r'   mainlistr\   r   r   )r   mutpy_plugins     r   runzPytestTestSuite.runQ   sK    (t7I7IJdjj),GGQUVeQfjviwQwx000r   Nc                     t        |      }t        j                  t        | j                        ddgz   t        t
              |gz          |j                  S )NrM   ro   rp   )rs   )rK   r'   rt   ru   r\   r   rP   )r   rN   rv   s      r   run_with_coveragez!PytestTestSuite.run_with_coverageV   sH    0CTUD$m'<<d?F[_k^lFlm+++r   c              #      K   t               }t        j                  t        | j                        g dz   t        t
              |gz          |j                  D ]  }t        |        y w)N)z--collect-onlyro   rp   rq   )rZ   r'   rt   ru   r\   r   rV   )r   rv   r   s      r   __iter__zPytestTestSuite.__iter__[   sV     57djj),SS 1\NB	D &&DT"" 's   A*A,r   )	rF   rG   rH   r   rj   rm   rw   ry   r{   rI   r   r   ra   ra   A   s     #1>1
,
#r   ra   c                       e Zd Zd Zd Zy)rV   c                 .    | j                   j                  S r   )rl   r   r]   s    r   __repr__zPytestTest.__repr__e   s    %%,,,r   c                     || _         y r   )rl   )r   rl   s     r   r   zPytestTest.__init__h   s
    !2r   N)rF   rG   rH   r~   r   rI   r   r   rV   rV   c   s    -3r   rV   c                       e Zd ZeZy)PytestTestRunnerN)rF   rG   rH   ra   test_suite_clsrI   r   r   r   r   l   s    $Nr   r   )r'   _pytest.configr   mutpy.test_runners.baser   r   r   r   r   r
   rK   rZ   ra   rV   r   rI   r   r   <module>r      sW     * s s@ @D! !$ $#m #D3 3%~ %r   