
    f                         d Z ddlZddlZddlZddlmZ ddlmc mZ	  ee
      j                         j                  Z e ej                  d            Zej                   Zd Zd Zd Zd	 Zd
 Zd Zd Zd Zd Zy)z'Tests for IPython.utils.module_paths.py    N)Pathzwith.dot)suffixc                 <    t        | dd      j                          y )Nwzutf-8)encoding)openclose)fnames    `/var/www/cvtools/html/venv/lib/python3.12/site-packages/IPython/utils/tests/test_module_paths.pymake_empty_filer       s    g&,,.    c                  N   t        t        dz        j                  d       t        t        dz        j                  d       t        t        dz         t        t        dz         t        t        dz         t        t        dz         t	        t              gt
        _        y	)
z+Setup testenvironment for the module:

    xmodT)parentsnomodzxmod/__init__.pyzxmod/sub.pypack.pyzpackpyc.pycN)r   TMP_TEST_DIRmkdirr   strsyspath r   r   setup_moduler   $   s~     		%%d%3	 &&t&4L#556L=01L9,-L=01L!"CHr   c                  T    t        j                  t               t        t        _        y)zZTeardown testenvironment for the module:

    - Remove tempdir
    - restore sys.path
    N)shutilrmtreer   old_syspathr   r   r   r   r   teardown_moduler   2   s     MM,CHr   c                  *    dt        t              v sJ y)zS
    Ensure the test are done with a temporary file that have a dot somewhere.
    .N)r   r   r   r   r   test_tempdirr!   >   s     #l####r   c                  b    t         dz  dz  } t        t        j                  d            | k(  sJ y)zo
    Search for a directory's file path.
    Expected output: a path to that directory's __init__.py file.
    r   __init__.pyNr   r   mpfind_modmodpaths    r   test_find_mod_1r)   E   s/    
 V#m3GF#$///r   c                  b    t         dz  dz  } t        t        j                  d            | k(  sJ y)z
    Search for a directory's file path.
    Expected output: a path to that directory's __init__.py file.
    TODO: Confirm why this is a duplicate test.
    r   r#   Nr$   r'   s    r   test_find_mod_2r+   M   s/     V#m3GF#$///r   c                  b    t         dz  dz  } t        t        j                  d            | k(  sJ y)zz
    Search for a directory + a filename without its .py extension
    Expected output: full path with .py extension.
    r   zsub.pyzxmod.subNr$   r'   s    r   test_find_mod_3r-   V   s/    
 V#h.GJ'(G333r   c                  \    t         dz  } t        t        j                  d            | k(  sJ y)zk
    Search for a filename without its .py extension
    Expected output: full path with .py extension
    r   packNr$   r'   s    r   test_find_mod_4r0   ^   s*    
 Y&GF#$///r   c                  8    t        j                  d      dk(  sJ y)zu
    Search for a filename with a .pyc extension
    Expected output: TODO: do we exclude or include .pyc files?
    packpycN)r%   r&   r   r   r   test_find_mod_5r3   f   s    
 ;;y!T)))r   )__doc__r   r   tempfilepathlibr   IPython.utils.module_pathsutilsmodule_pathsr%   __file__resolveparentTEST_FILE_PATHmkdtempr   r   r   r   r   r   r!   r)   r+   r-   r0   r3   r   r   r   <module>r?      s    -  
   ' 'h'')00$H$$J78
 hh/#
$0040*r   