U
    
W[B  ã                   @   s\   d Z ddlmZmZ ddlZddlZddlmZ ddlm	Z	 ddl
mZ G dd„ deƒZdS )	z$
Tests for L{twisted.python.dist3}.
é    )Úabsolute_importÚdivisionN)ÚTestCase)Ú_PY3)ÚnotPortedModulesc                   @   s2   e Zd ZdZdd„ Zdd„ Zer(de_nde_dS )	ÚModulesToInstallTestsz(
    Tests for L{notPortedModules}.
    c                 C   s˜   t j t j tj¡¡}tD ]x}| d¡}|d  d7  < t jj|f|žŽ }| d¡dg }t jj|f|žŽ }|  t j 	|¡p†t j 	|¡d 
|¡¡ qdS )zI
        All modules listed in L{notPortedModules} exist on Py2.
        Ú.éÿÿÿÿú.pyú__init__.pyzModule {0} does not existN)ÚosÚpathÚdirnameÚtwistedÚ__file__r   ÚsplitÚjoinZ
assertTrueÚexistsÚformat©ÚselfÚrootÚmoduleZsegmentsr   ZalternateSegmentsZpackagePath© r   ú@/usr/lib/python3/dist-packages/twisted/python/test/test_dist3.pyÚ
test_exist   s    

þz ModulesToInstallTests.test_existc                 C   s˜   t j t j tj¡¡}tD ]x}| d¡}|d  d7  < t jj|f|žŽ }| d¡dg }t jj|f|žŽ }|  t j 	|¡p†t j 	|¡d 
|¡¡ qdS )zP
        All modules listed in L{notPortedModules} do not exist on Py3.
        r   r	   r
   r   zModule {0} existsN)r   r   r   r   r   r   r   r   ZassertFalser   r   r   r   r   r   Útest_notexist%   s    

þz#ModulesToInstallTests.test_notexistzOnly on Python 2zOnly on Python 3N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   Úskipr   r   r   r   r      s   r   )r    Z
__future__r   r   r   r   Ztwisted.trial.unittestr   Ztwisted.python.compatr   Ztwisted.python._setupr   r   r   r   r   r   Ú<module>   s   