
    Vh
                    r    d Z ddlmZ ddlZddlmZmZmZmZm	Z	m
Z
 ddlmZmZmZ ddlmZ  G d	 d
e      Zy)z'Sanity test for the sanity ignore file.    )annotationsN   )SanityFailureSanityIgnoreParserSanityVersionNeutralSanitySuccessSanityMessageSanityTargets   )calculate_confidencecalculate_best_confidence
TestResult)SanityConfigc                  <    e Zd ZdZedd       Zedd       ZddZy)IgnoresTestz+Sanity test for sanity test ignore entries.c                     y)z)True if the test supports ignore entries.F selfs    ^/home/dcms/DCMS/lib/python3.12/site-packages/ansible_test/_internal/commands/sanity/ignores.py
can_ignorezIgnoresTest.can_ignore   s         c                     y)zPTrue if the test does not use test targets. Mutually exclusive with all_targets.Tr   r   s    r   
no_targetszIgnoresTest.no_targets"   s     r   c                  
 t        j                        
g }|j                  
fd
j                  D               |j                  
fd
j                  D               
j
                  j                         D ]  \  }}|j                         D ]  \  }}
j                  j                  |i       j                  |      }|s4|j                         D ]g  }	|j                  t        d||fz  
j                  |	dj                  j                  r!t        
j                   |	j                        nd              i   |rt#        | j$                  |      S t'        | j$                        S )Nc              3     K   | ]Y  \  }}}t        |j                  ||j                  j                  r!t	        j
                  |j                        nd        [ y w)Nmessagepathlinecolumn
confidence)r	   relative_pathmetadatachangesr   r   ).0r    r!   r   argssanity_ignores       r   	<genexpr>z#IgnoresTest.test.<locals>.<genexpr>.   sg      C $dFG &,,X\XeXeXmXm+M,>,>dmmTsw
 
 Cs   AA"c              3  2  K   | ]  \  }}t        |j                  t        j                  j                        rd ndd|dj
                  |dj                  j                  r&t        j                  |f|dffj                        nd        yw)	DirectoryFilez 'z' does not existr   r   Nr   )	r	   endswithosr   sepr#   r$   r%   r   )r&   r    r   r'   r(   s      r   r)   z#IgnoresTest.test.<locals>.<genexpr>8   s      A dD &?C}}RWW[[?Y_e0egkl,,lplyly  mB  mB0=3E3Et2LtUVi1XZ^ZgZgh  HL
 
 As   BBz9Ignoring '%s' is unnecessary due to skip entry on line %dr   r   )messages)r   loadextendparse_errorsfile_not_found_errorsignoresitemsskipsgetvaluesappendr	   r#   r$   r%   r   r   r   namer   )r   r'   targetsr0   	test_namer5   ignore_pathignore_entryskip_line_noignore_line_nor(   s    `        @r   testzIgnoresTest.test'   sq   *//5(* 	 C (5'A'AC 	C 	 A *??A 	A #0"7"7"="="? 	Iw-4]]_ )\,2266y"EII+V#&2&9&9&; NOOM [_jlx^y y*88+ nrn{n{  oD  oD#78J8JN\`\i\i#j  JN% 	   X>>TYY''r   N)returnbool)r'   r   r<   r
   rC   r   )__name__
__module____qualname____doc__propertyr   r   rB   r   r   r   r   r      s0    5   .(r   r   )rH   
__future__r   r.    r   r   r   r   r	   r
   rB   r   r   r   configr   r   r   r   r   <module>rM      s4    - " 	  
;(& ;(r   