
/Xe6                 @   s  d  d l  Z d  d l j j Z d  d l Z d  d l Z d  d l m	 Z
 d  d l m Z d  d l m Z d  d l m Z d  d l Z d Z d Z d d	   Z d
 d   Z d d   Z d d d  Z d d   Z d d   Z d d   Z d d   Z d d   Z d d   Z d d   Z d d   Z d  d!   Z d" d#   Z d$ d%   Z d& d'   Z  d( d)   Z! d* d+   Z" d, d-   Z# d. d/   Z$ d0 d1   Z% d2 d3   Z& d4 d5   Z' d6 d7   Z( d8 d9   Z) d: d;   Z* d< d=   Z+ d> d?   Z, d@ dA   Z- dB dC   Z. dD dE   Z/ dF dG   Z0 dH dI   Z1 dJ dK   Z2 dL dM   Z3 dN dO   Z4 dP dQ   Z5 dR dS   Z6 dT dU   Z7 dV dW   Z8 dX dY   Z9 dZ d[   Z: d\ d]   Z; d S)^    N)
exceptions)fstree)	get_rules)startupztests/data/no_such_config.iniztests/data/bad_config.inic             C   s   t  j   } | j t j d d d d   |  j   \ } } d } | | k } | s t j d | f d | | f  i t j |  d 6d	 t	 j
   k s t j |  r t j |  n d	 d
 6} d i | d 6} t t j |    n  d } } d S)z&Does the error manager send to stdout?z
samp errorz
samp descrzsamp detailz	samp hint !=%(py0)s != %(py3)spy3errpy0assert %(py5)spy5N)r   )r   r   )r   ErrorManagerexpressexError
readouterr
@pytest_ar_call_reprcompare	_saferepr@py_builtinslocals_should_repr_global_nameAssertionError_format_explanation)capsysemoutr
   @py_assert2@py_assert1@py_format4@py_format6 r"   R/home/kop/biz/barnett/enforcer_project/BRIEF-Script/Enforcer/tests/test_startup.py test_errormanager_express_stderr&   s       l   r$   c              C   sF   t  j   }  |  j t j d   t j t   |  j   Wd QXd S)z+Does the error manager exit early on error?zsample errorN)	r   r   r   r   r   pytestraises
SystemExitexit_if_errored)r   r"   r"   r#   &test_errormanager_exit_if_errored_exit/   s    r)   c              C   st   t  j   }  |  j t j d   |  j   d } | sj d i t j |  d 6} t t j	 |    n  d } d S)z+Does the error manager continue on warning?zsample warningTr   assert %(py1)spy1Nr*   )
r   r   r   r   Warningr(   r   r   r   r   )r   @py_assert0@py_format2r"   r"   r#   (test_errormanager_exit_if_errored_noexit7   s    
    r/   c             C   s   t  j |  | | |  d  S)N)r    check_missing_config_declaration)cfgunused_keyscfilekeyhintr"   r"   r#   mock_require_configE   s    r6   c             C   s#   t  j   } |  j t  d |  d  S)Nr   )r   r   setattr)monkeypatchr   r"   r"   r#   monkeypatch_errormanagerI   s    r9   c               C   s:   t  j t j  " t j i d d 6d d d  Wd QXd S)z5Missing required config directives raise an exceptionvaluefooz
sample.inimissingN)r%   r&   r   MissingConfigDeclarationErrorr   r0   r"   r"   r"   r#   %test_check_missing_config_declarationU   s    r>   c               C   sG   t  j i d d 6d g d d  t j t   t  j j   Wd QXd S)z*Missing config directives result in errorsr:   r;   r<   z
sample.iniN)r   require_configr%   r&   r'   r   r(   r"   r"   r"   r#   test_require_config_fail^   s    r@   c              C   su   t  j i d d 6d g d d  t  j j   d }  |  sk d	 i t j |   d 6} t t j |    n  d }  d S)
z)Existing config directives raise no errorr:   r;   z
sample.iniTr   assert %(py1)sr+   NrA   )r   r?   r   r(   r   r   r   r   )r-   r.   r"   r"   r#   test_require_config_successf   s         rB   c            
   C   s-   t  j t j   t j d d  Wd QXd S)z7Non-integral max_depth config values raise an exceptionr;   z
sample.iniN)r%   r&   r   BadMaxDepthErrorr   check_bad_max_depthr"   r"   r"   r#   test_check_bad_max_depth_no_into   s    rE   c            
   C   s-   t  j t j   t j d d  Wd QXd S)z2max_depth config values below 1 raise an exception0z
sample.iniN)r%   r&   r   rC   r   rD   r"   r"   r"   r#   !test_check_bad_max_depth_toosmallu   s    rG   c              C   s/  t  j }  d } d } |  | |  } d } | | k } | st j d | f d | | f  i t j |  d 6d t j   k s t j t   r t j t   n d d 6t j |  d	 6t j |  d
 6t j |  d 6t j |   d 6} d i | d 6} t t j	 |    n  d }  } } } } } d S)z8String max_depth values that are integers convert to int3z
sample.ini   ==c%(py8)s
{%(py8)s = %(py2)s
{%(py2)s = %(py0)s.check_bad_max_depth
}(%(py4)s, %(py6)s)
} == %(py11)spy6r   r   py4py11py8py2r   assert %(py13)spy13N)rJ   )rK   rQ   )
r   rD   r   r   r   r   r   r   r   r   )r   @py_assert3@py_assert5@py_assert7@py_assert10@py_assert9@py_format12@py_format14r"   r"   r#   test_check_bad_max_depth{   s    	          rZ   c               C   s7   t  j d d  t j t   t  j j   Wd QXd S)z.Bad max_depth config values result in an errorr;   z
sample.iniN)r   convert_max_depthr%   r&   r'   r   r(   r"   r"   r"   r#   test_convert_max_depth_fail   s    r\   c              C   s<  t  j j   t  j }  d } d } |  | |  } d } | | k } | st j d | f d | | f  i t j |  d 6d t j   k s t j	 t   r t j t   n d d 6t j |  d	 6t j |  d
 6t j |  d 6t j |   d 6} d i | d 6} t
 t j |    n  d }  } } } } } d S)z8String max_depth values that are integers convert to intrH   z
sample.inirI   rJ   a%(py8)s
{%(py8)s = %(py2)s
{%(py2)s = %(py0)s.convert_max_depth
}(%(py4)s, %(py6)s)
} == %(py11)srL   r   r   rM   rN   rO   rP   r   assert %(py13)srR   N)rJ   )r]   r^   )r   r   r(   r[   r   r   r   r   r   r   r   r   )r   rS   rT   rU   rV   rW   rX   rY   r"   r"   r#   test_convert_max_depth_succeed   s    	          r_   c              C   sX   t  j g  d  d }  |  sN d i t j |   d 6} t t j |    n  d }  d S)z(When the declaration is used, no warningsomecfgTr   assert %(py1)sr+   Nra   )r   warn_extra_declarationr   r   r   r   )r-   r.   r"   r"   r#   #test_warn_extra_declaration_no_warn   s        rc   c            
   C   s0   t  j t j   t j d g d  Wd QXd S)z2When the declaration is unused a warning is raisedr`   N)r%   r&   r   UnusedDeclarationWarningr   rb   r"   r"   r"   r#    test_warn_extra_declaration_warn   s    re   c             C   s  t  j g  d  |  j   \ } } d } | | k } | s t j d | f d | | f  i t j |  d 6d t j   k s t j |  r t j |  n d d 6} d i | d	 6} t	 t j
 |    n  d
 } } d } | | k } | st j d | f d | | f  i t j |  d 6d t j   k sCt j |  rRt j |  n d d 6} d i | d	 6} t	 t j
 |    n  d
 } } d
 S)z)When there's no warning there's no outputr`   r   rJ   %(py0)s == %(py3)sr	   r   r   assert %(py5)sr   Nr
   )rJ   )rf   rg   )rJ   )rf   rg   )r   report_extra_declarationr   r   r   r   r   r   r   r   r   )r   r   r
   r   r   r    r!   r"   r"   r#   %test_report_extra_declaration_no_warn   s        l   
   l   ri   c             C   s?  t  j d g d  |  j   \ } } d } | | k } | s t j d | f d | | f  i t j |  d 6d t j   k s t j |  r t j |  n d d 6} d i | d	 6} t	 t j
 |    n  d
 } } | s;d i d t j   k s	t j |  rt j |  n d d 6} t	 t j
 |    n  d
 S)z/When there's a warning there's output on stderrr`   r   rJ   %(py0)s == %(py3)sr	   r   r   assert %(py5)sr   Nassert %(py0)sr
   )rJ   )rj   rk   rl   )r   rh   r   r   r   r   r   r   r   r   r   )r   r   r
   r   r   r    r!   @py_format1r"   r"   r#   "test_report_extra_declaration_warn   s       l   
 A rn   c            	   C   s*   t  j t j   t j d  Wd QXd S)zRaises an errorZunk_declN)r%   r&   r   UnknownDeclarationErrorr   raise_unknown_declarationr"   r"   r"   r#   test_raise_unknown_declaration   s    rq   c       	      C   sC  t  |  t j d  |  j   \ } } d } | | k } | s t j d | f d | | f  i t j |  d 6d t j   k s t j	 |  r t j |  n d d 6} d i | d	 6} t
 t j |    n  d
 } } | s?d i d t j   k st j	 |  rt j |  n d d 6} t
 t j |    n  d
 S)z$When there's an error there's outputr`   r   rJ   %(py0)s == %(py3)sr	   r   r   assert %(py5)sr   Nassert %(py0)sr
   )rJ   )rr   rs   rt   )r9   r   report_unknown_declarationr   r   r   r   r   r   r   r   r   )	r   r8   r   r
   r   r   r    r!   rm   r"   r"   r#   test_report_unknown_declaration   s    
   l   
 A rv   c             C   s  t  j g  t j  |  j   \ } } d } | | k } | s t j d | f d | | f  i t j |  d 6d t j	   k s t j
 |  r t j |  n d d 6} d i | d 6} t t j |    n  d	 } } d } | | k } | st j d | f d | | f  i t j |  d 6d
 t j	   k sFt j
 |  rUt j |  n d
 d 6} d i | d 6} t t j |    n  d	 } } d	 S)z:When there are no extra declarations nothing gets reportedr   rJ   %(py0)s == %(py3)sr	   r   r   assert %(py5)sr   Nr
   )rJ   )rw   rx   )rJ   )rw   rx   )r   report_extra_declarationsr   FILE_SOURCEr   r   r   r   r   r   r   r   r   )r   r   r
   r   r   r    r!   r"   r"   r#   (test_report_extra_declarations_no_extras   s        l   
   l   r{   c       	      C   sL  t  |  t j d g t j  |  j   \ } } d } | | k } | s t j d | f d | | f  i t j |  d 6d t	 j
   k s t j |  r t j |  n d d 6} d i | d	 6} t t j |    n  d
 } } | sHd i d t	 j
   k st j |  r%t j |  n d d 6} t t j |    n  d
 S)zEgoogle_credentials declaration reports error when rules are in a filegoogle_credentialsr   rJ   %(py0)s == %(py3)sr	   r   r   assert %(py5)sr   Nassert %(py0)sr
   )rJ   )r}   r~   r   )r9   r   ry   r   rz   r   r   r   r   r   r   r   r   r   )	r   r8   r   r
   r   r   r    r!   rm   r"   r"   r#   )test_report_extra_declarations_file_creds   s    
   l   
 A r   c       	      C   sL  t  |  t j d g t j  |  j   \ } } d } | | k } | s t j d | f d | | f  i t j |  d 6d t	 j
   k s t j |  r t j |  n d d 6} d i | d	 6} t t j |    n  d
 } } | sHd i d t	 j
   k st j |  r%t j |  n d d 6} t t j |    n  d
 S)zCspreadsheet_name declaration reports error when rules are in a filespreadsheet_namer   rJ   %(py0)s == %(py3)sr	   r   r   assert %(py5)sr   Nassert %(py0)sr
   )rJ   )r   r   r   )r9   r   ry   r   rz   r   r   r   r   r   r   r   r   r   )	r   r8   r   r
   r   r   r    r!   rm   r"   r"   r#   (test_report_extra_declarations_file_name   s    
   l   
 A r   c       	      C   sL  t  |  t j d g t j  |  j   \ } } d } | | k } | s t j d | f d | | f  i t j |  d 6d t	 j
   k s t j |  r t j |  n d d 6} d i | d	 6} t t j |    n  d
 } } | sHd i d t	 j
   k st j |  r%t j |  n d d 6} t t j |    n  d
 S)z@File related declarations report errors when rules are at google
rules_pathr   rJ   %(py0)s == %(py3)sr	   r   r   assert %(py5)sr   Nassert %(py0)sr
   )rJ   )r   r   r   )r9   r   ry   r   GOOGLE_SOURCEr   r   r   r   r   r   r   r   r   )	r   r8   r   r
   r   r   r    r!   rm   r"   r"   r#   %test_report_extra_declarations_google   s    
   l   
 A r   c       	      C   sO  t  |  t j d d g t j  |  j   \ } } d } | | k } | s t j d | f d | | f  i t j |  d 6d t	 j
   k s t j |  r t j |  n d d 6} d i | d
 6} t t j |    n  d } } | sKd i d t	 j
   k st j |  r(t j |  n d d 6} t t j |    n  d S)z2There are errors when there are extra declarationsunknown1unknown2r   rJ   %(py0)s == %(py3)sr	   r   r   assert %(py5)sr   Nassert %(py0)sr
   )rJ   )r   r   r   )r9   r   ry   r   rz   r   r   r   r   r   r   r   r   r   )	r   r8   r   r
   r   r   r    r!   rm   r"   r"   r#   &test_report_extra_declarations_unknown   s    
   l   
 A r   c                s;  Gd d   d  } |     d   _    f d d   } |  j t d |  t j d d g t j    j  } d	 } | | k } | s)t j d | f d | | f  i d t j	   k s t j
    r t j    n d d 6t j |  d 6t j |  d 6} d i | d 6} t t j |    n  d } } } d S)zKMultiple errors are reported when there are multiple extra
    declarationsc               @   s   e  Z d  Z d S)z7test_report_extra_declarations_multi.<locals>.NamespaceN)__name__
__module____qualname__r"   r"   r"   r#   	Namespace   s   r   r   c                s     j  d 7_  d  S)N   )count)r4   )nsr"   r#   mock_raise_unknown_declaration  s    zLtest_report_extra_declarations_multi.<locals>.mock_raise_unknown_declarationrp   r   r      rJ   -%(py2)s
{%(py2)s = %(py0)s.count
} == %(py5)sr   r   r   rP   r   assert %(py7)spy7N)rJ   )r   r   )r   r7   r   ry   r   rz   r   r   r   r   r   r   r   r   )r8   r   r   r   @py_assert4rS   r!   @py_format8r"   )r   r#   $test_report_extra_declarations_multi   s     			    |   r   c              C   s+  d g }  t  j |  d  t |   } d } | | k } | st j d | f d | | f  i t j |  d 6t j |  d 6d t j   k s t j t  r t j t  n d d 6d	 t j   k s t j |   r t j |   n d	 d
 6} d i | d 6} t	 t j
 |    n  d } } } d S)z%Unused keys are removed from key listkey1r   rJ   0%(py3)s
{%(py3)s = %(py0)s(%(py1)s)
} == %(py6)sr	   rL   lenr   keysr+   r   assert %(py8)srO   N)rJ   )r   r   )r   optional_keyr   r   r   r   r   r   r   r   r   )r   r   rT   r   @py_format7@py_format9r"   r"   r#   test_optional_key  s    	       r   c            	   C   s*   t  j t j   t j d  Wd QXd S)z,Non-existant config files raise an exceptionzno_such.iniN)r%   r&   r   NoConfigFileErrorr   read_configr"   r"   r"   r#   test_read_config_existance  s    r   c              C   s   t  j d  }  |  d } d } | | k } | s t j d | f d | | f  i t j |  d 6t j |  d 6} d i | d
 6} t t j |    n  d } } } d S)zConfig declartions can be readzsample_config.inir   z../enforcer/my_conventions.csvrJ   %(py1)s == %(py4)sr+   rM   r   assert %(py6)srL   N)rJ   )r   r   )r   r   r   r   r   r   r   )configr-   rS   r   @py_format5r   r"   r"   r#   test_read_config_succeed  s    
    E   r   c            	   C   s*   t  j t j   t j t  Wd QXd S)zXWe get an exception when the configparser library has a problem
    with the config fileN)r%   r&   r   ConfigParserErrorr   r   INVALID_RULES_CONFIG_PATHr"   r"   r"   r#   test_read_config_bad_file#  s    r   c            	   C   s-   t  j t j   t j t j  Wd QXd S)z.Config file must contain an [enforcer] sectionN)r%   r&   r   NoEnforcerSectionErrorr   r   osdevnullr"   r"   r"   r#   $test_read_config_no_enforcer_section*  s    r   c              C   s"  i  }  t  j |  i d d 6d  |  d } d d d g } t |  } | | k } | st j d | f d | | f  i d t j   k s t j t  r t j t  n d d	 6t j |  d
 6t j |  d 6t j |  d 6} d i | d 6} t	 t j
 |    n  d } } } } d S)z:The expected value is the config value when the key existszabc
def
ghir4   abcdefghirJ   0%(py1)s == %(py7)s
{%(py7)s = %(py3)s(%(py5)s)
}setr	   r   r   r+   r   assert %(py9)spy9N)rJ   )r   r   )r   optional_config_setr   r   r   r   r   r   r   r   r   )r   r-   r   @py_assert6r   r   @py_format10r"   r"   r#   test_optional_config_set_key2  s    
        r   c              C   s  i  }  t  j |  i  d  |  d } t |  } d } | | k } | s t j d | f d | | f  i t j |  d 6d t j   k s t j t  r t j t  n d d 6t j |  d 6t j |  d	 6} d i | d 6} t	 t j
 |    n  d } } } } d S)z<An empty set is the config value when the key does not existr4   r   rJ   0%(py4)s
{%(py4)s = %(py0)s(%(py2)s)
} == %(py7)sr   r   r   rP   rM   r   assert %(py9)sr   N)rJ   )r   r   )r   r   r   r   r   r   r   r   r   r   r   )r   r   rS   r   rT   r   r   r"   r"   r#   test_optional_config_set_no_key9  s    
        r   c             C   s\  y t  j d i   Wn t k
 r|  j   \ } } t j } | |  } | sd d i d t j   k s| t j	 |  r t j
 |  n d d 6d t j   k s t j	 t  r t j
 t  n d d 6t j
 |  d 6t j
 |  d	 6} t t j |    n  d
 } } YnE Xd } | sRd i t j
 |  d 6} t t j |    n  d
 } d
 S)z)A bad config file returns multiple errorszbad_config.inir   zQassert %(py5)s
{%(py5)s = %(py2)s
{%(py2)s = %(py0)s.multiple_errors
}(%(py3)s)
}r
   r	   libtestr   r   rP   NFassert %(py1)sr+   r   )r   parse_configr'   r   r   multiple_errorsr   r   r   r   r   r   r   )r   r   r
   r   r   r!   r-   r.   r"   r"   r#   test_parse_config_errorsB  s    	         r   c             C   s_   |  j  t d t  t j t j  4 t j d i t j	 d 6d d 6d d 6d d 6 Wd	 QXd	 S)
zEA config that gets the sheet from google but has no credentials failsr?   zbad_config.inirules_sourceanythingr   begin_markerrH   	max_depthN)
r7   r   r6   r%   r&   r   r=   r   r   r   )r8   r"   r"   r#   'test_parse_config_no_google_credentialsM  s    	r   c             C   s_   |  j  t d t  t j t j  4 t j d i t j	 d 6d d 6d d 6d d	 6 Wd
 QXd
 S)z>A config that gets the sheet from google but has no name failsr?   zbad_config.inir   Zsomefiler|   r   r   rH   r   N)
r7   r   r6   r%   r&   r   r=   r   r   r   )r8   r"   r"   r#   %test_parse_config_no_spreadsheet_nameX  s    	r   c             C   sX   |  j  t d t  t j t j  - t j d i t j	 d 6d d 6d d 6 Wd QXd S)	z>A config that gets the sheet from the fs but has no path failsr?   zbad_config.inir   r   r   rH   r   N)
r7   r   r6   r%   r&   r   r=   r   r   rz   )r8   r"   r"   r#   test_parse_config_no_rules_pathc  s    	r   c               C   sB   t  j t j  * t j d i d d 6d d 6d d 6 Wd QXd S)	z,A config with a bad rules_source value failszbad_config.inizrandom valuer   r   r   rH   r   N)r%   r&   r   BadRulesSourceErrorr   r   r"   r"   r"   r#   "test_parse_config_bad_rules_sourcem  s
    	
r   c              C   s  d }  d } t  j d i t j d 6|  d 6| d 6d d 6d	 d
 6 } | d } | |  k } | s t j d | f d | |  f  i d t j   k s t j |   r t j	 |   n d d 6t j	 |  d 6} d i | d 6} t
 t j |    n  d } } | d } | | k } | st j d | f d | | f  i d t j   k s]t j |  rlt j	 |  n d d 6t j	 |  d 6} d i | d 6} t
 t j |    n  d } } d S)z,The google related config values are correctzsome secretz	some namezsimple_config.inir   r|   r   r   r   rH   r   rJ   %(py1)s == %(py3)ssecretsr	   r+   r   assert %(py5)sr   Nname)rJ   )r   r   )rJ   )r   r   )r   r   r   r   r   r   r   r   r   r   r   r   )r   r   r1   r-   r   r    r!   r"   r"   r#   test_parse_config_googlev  s,    	
   l   

   l   r   c              C   s   d }  t  j d i t j d 6|  d 6d d 6d d 6 } | d } | |  k } | s t j d | f d | |  f  i d t j   k s t j |   r t j	 |   n d d 6t j	 |  d 6} d i | d 6} t
 t j |    n  d } } d S)z&The rules_path config value is correctz	some filezsimple_config.inir   r   r   r   rH   r   rJ   %(py1)s == %(py3)sfilenamer	   r+   r   assert %(py5)sr   N)rJ   )r   r   )r   r   r   rz   r   r   r   r   r   r   r   r   )r   r1   r-   r   r    r!   r"   r"   r#   test_parse_config_file  s    	
   l   r   c              C   s@  d }  t  j d i t j d 6|  d 6d d 6d d 6d	 d
 6 } | d
 } d d d g } t |  } | | k } | s*t j d | f d | | f  i d t j   k s t j	 t  r t j
 t  n d d 6t j
 |  d 6t j
 |  d 6t j
 |  d 6} d i | d 6} t t j |    n  d } } } } d S)z)The ignored_names config value is correctz	some filezsimple_config.inir   r   r   r   rH   r   zabc
def
ghiignored_namesr   r   r   rJ   0%(py1)s == %(py7)s
{%(py7)s = %(py3)s(%(py5)s)
}r   r	   r   r   r+   r   assert %(py9)sr   N)rJ   )r   r   )r   r   r   rz   r   r   r   r   r   r   r   r   r   )r   r1   r-   r   r   r   r   r   r"   r"   r#   test_parse_config_ignored_names  s     	
        r   c              C   s@  d }  t  j d i t j d 6|  d 6d d 6d d 6d	 d
 6 } | d
 } d d d g } t |  } | | k } | s*t j d | f d | | f  i d t j   k s t j	 t  r t j
 t  n d d 6t j
 |  d 6t j
 |  d 6t j
 |  d 6} d i | d 6} t t j |    n  d } } } } d S)z(The stock_parens config value is correctz	some filezsimple_config.inir   r   r   r   rH   r   zabc
def
ghistock_parensr   r   r   rJ   0%(py1)s == %(py7)s
{%(py7)s = %(py3)s(%(py5)s)
}r   r	   r   r   r+   r   assert %(py9)sr   N)rJ   )r   r   )r   r   r   rz   r   r   r   r   r   r   r   r   r   )r   r1   r-   r   r   r   r   r   r"   r"   r#   test_parse_config_stock_parens  s     	
        r   c              C   s%  t  j t j  \ }  } t j } t | |  } | s!d d i t j |  d 6d t	 j
   k sq t j t  r t j t  n d d 6d t	 j
   k s t j |  r t j |  n d d 6t j |  d 6d	 t	 j
   k s t j t  r t j t  n d	 d
 6} t t j |    n  d } } t |  t  } | sd d i d t	 j
   k skt j t  rzt j t  n d d 6d t	 j
   k st j |   rt j |   n d d 6t j |  d 6d t	 j
   k st j t  rt j t  n d d
 6} t t j |    n  d } d S)z1Does make_analyzer() return something reasonable?r   zPassert %(py6)s
{%(py6)s = %(py0)s(%(py1)s, %(py4)s
{%(py4)s = %(py2)s.FSDir
})
}rL   
isinstancer   analyzerr+   rM   r   rP   Nz5assert %(py4)s
{%(py4)s = %(py0)s(%(py1)s, %(py2)s)
}r   dict)r   make_analyzerr   TEST_CONFIG_PATHr   FSDirr   r   r   r   r   r   r   r   r   )r   r   rS   rT   r   r   r"   r"   r#   test_make_analyzer_retval  s    	     
    r   c            	   C   s'   t  j t   t j t  Wd QXd S)z9Does an error (non-existant config) result in SystemExit?N)r%   r&   r'   r   r   BAD_RULES_CONFIG_PATHr"   r"   r"   r#   test_make_analyzer_on_error  s    r   )<builtinsr   _pytest.assertion.rewrite	assertionrewriter   r   r%   enforcerr   r   r   r   r   r   r   r   r$   r)   r/   r6   r9   r>   r@   rB   rE   rG   rZ   r\   r_   rc   re   ri   rn   rq   rv   r{   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r"   r"   r"   r#   <module>   sj     			

		
	