U
    jPŒ^¿  ã                   @   sZ   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mZ G dd„ dej	ƒZ
dS )	é    N)Úmatchers)Ú
skipUnless)Útestr_command)Úbase)Úutilc                       s8   e Zd Z‡ fdd„Zdd„ Zeejdƒdd„ ƒZ‡  Z	S )Ú	TestHooksc              	      sB   t t| ƒ ¡  t tj | jd¡¡}| 	ddd¡ W 5 Q R X d S )Nz	setup.cfgÚglobalzsetup-hookszQpbr_testpackage._setup_hooks.test_hook_1
pbr_testpackage._setup_hooks.test_hook_2)
Úsuperr   ÚsetUpr   Zopen_configÚosÚpathÚjoinZpackage_dirÚset)ÚselfZcfg©Ú	__class__© ú6/usr/lib/python3/dist-packages/pbr/tests/test_hooks.pyr
   4   s    ÿÿzTestHooks.setUpc                 C   s,   |   d¡\}}}d|kst‚|dks(t‚dS )z„Test setup_hooks.

        Test that setup_hooks listed in the [global] section of setup.cfg are
        executed in order.
        Zegg_infoztest_hook_1
test_hook_2r   N)Ú	run_setupÚAssertionError©r   ÚstdoutÚ_Zreturn_coder   r   r   Útest_global_setup_hooks<   s    z!TestHooks.test_global_setup_hooksztestrepository not availablec                 C   s0   |   d¡\}}}|  |¡ |  |t d¡¡ d S )Nz--help-commandsz testr )r   ZassertFalseZ
assertThatr   ZContainsr   r   r   r   Útest_custom_commands_knownG   s    
z$TestHooks.test_custom_commands_known)
Ú__name__Ú
__module__Ú__qualname__r
   r   r   r   Z
have_testrr   Ú__classcell__r   r   r   r   r   3   s   
r   )r   Z	testtoolsr   r   Zpbrr   Z	pbr.testsr   r   ZBaseTestCaser   r   r   r   r   Ú<module>)   s   