U
    uid	                     @   s\   d Z ddlZddlZddlmZmZ ddlmZ ddlm	Z	 G dd dZ
G d	d
 d
ZdS )z(Tests for automatic discovery of modules    N)FlatLayoutModuleFinderModuleFinder   )	os_helper)ensure_filesc                   @   s   e Zd Zdd Zddgi ddgfddgddgidgfdd	dgdgd
gddgfddgi g fdZejde dd Z	ejj
e  dddd ZdS )TestModuleFinderc                 O   s   t tjt|f||S N)setr   findstrselfpathargskwargs r   I/tmp/pip-unpacked-wheel-9osl9suo/setuptools/tests/test_find_py_modules.pyr
      s    zTestModuleFinder.findzfile.pyzother.pyfileotherexcludezf*zfole.pyzfo*)includer   z
my-file.pyzother.file.py)Zsimple_folderr   r   zinvalid-nameexamplec                 C   s8   | j | \}}}t|| | j|f|t|ks4td S r   EXAMPLESr   r
   r	   AssertionError)r   tmp_pathr   filesr   expected_modulesr   r   r   test_finder%   s    
zTestModuleFinder.test_finderzSymlink support required)reasonc                 C   s<   d}t ||g t|| |d  | |dhks8td S )Nz_myfiles/file.pyzlink.pylink)r   ossymlinkr
   r   )r   r   srcr   r   r   $test_symlinked_packages_are_included+   s    z5TestModuleFinder.test_symlinked_packages_are_includedN)__name__
__module____qualname__r
   r   pytestmarkparametrizekeysr   Zskipifr   Zcan_symlinkr$   r   r   r   r   r      s&   
r   c                	   @   sl   e Zd Zdd Zdgg fdgg fddddd	d
gdgfdddddd
gdgfdZejde dd Z	dS )TestFlatLayoutModuleFinderc                 O   s   t tt|S r   )r	   r   r
   r   r   r   r   r   r
   4   s    zTestFlatLayoutModuleFinder.findz
.module.pyz
_module.pyzsetup.pyzconftest.pyztest.pyztests.pyz
example.pyzmod.pymodztasks.pyz
fabfile.pyz
noxfile.pyzdodo.pyz	manage.py)zhidden-fileszprivate-moduleszcommon-namesztool-specificr   c                 C   s2   | j | \}}t|| | |t|ks.td S r   r   )r   r   r   r   r   r   r   r    test_unwanted_files_not_includedE   s    
z;TestFlatLayoutModuleFinder.test_unwanted_files_not_includedN)
r%   r&   r'   r
   r   r(   r)   r*   r+   r.   r   r   r   r   r,   3   s   r,   )__doc__r!   r(   Zsetuptools.discoveryr   r   Zcompat.py39r   Ztest_find_packagesr   r   r,   r   r   r   r   <module>   s   &