
    9
g                         d Z ddlZddlZddlZddl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mZ dZd	Zej$                  d
        Zej$                  d        Z G d d      Z G d d      Z G d d      Zy)zdevelop tests    N)paths_on_pythonpath)develop)Distribution   )contexts
namespaceszHfrom setuptools import setup

setup(name='foo',
    packages=['foo'],
)
zprint "foo"
c              #      K   t        j                         5 }t        j                         5 }| j                  d|       | j                  d|       d  d d d        d d d        y # 1 sw Y   xY w# 1 sw Y   y xY ww)Nzsite.USER_BASEzsite.USER_SITE)r   tempdirsetattr)monkeypatch	user_base	user_sites      ]/var/www/api/v1/venv_getwork_v1/lib/python3.12/site-packages/setuptools/tests/test_develop.py	temp_userr      sc     				y9 0)< 0)<   
	 
	s3   A>A2)A&A2	A>&A/	+A22A;7A>c              #     K   | }|j                  d      }|dz  }|j                         rt        t        |            |j	                  d      5 }|j                  t               d d d        |dz  }|j	                  d      5 }|j                  t               d d d        |j                         5  | d d d        y # 1 sw Y   [xY w# 1 sw Y   3xY w# 1 sw Y   y xY ww)Nfoosetup.pywz__init__.py)	mkdirisfile
ValueErrordiropenwriteSETUP_PYINIT_PYas_cwd)tmpdirr   targetr   setupfinits          r   test_envr#   &   s     F
,,u
CZE||~V%%	CA	 
D	31	 
	 
 
 
	sN   AC$C &C$CC$2C7	C$ C	C$CC$C!C$c                       e Zd Z eed      Z eed      xr ej                  ej                  k7  Zd Z	e
j                  j                  d      d        Zy)TestDevelopreal_prefixbase_prefixc                     t        j                  d       t        ddgdddgi      }t        |      }d|_        t        |      }|j                          ||_        |j                          y)	z
        Test that console scripts are installed and that they reference
        only the project by name and not the current version.
        zTTODO: needs a fixture to cause 'develop' to be invoked without mutating environment.r   z0.0console_scriptszfoocmd = foo:foo)namepackagesversionentry_pointsr   N)	pytestskipdictr   script_namer   ensure_finalizedinstall_dirrun)selfr   settingsdistcmds        r   test_console_scriptsz TestDevelop.test_console_scripts:   su    
 	:	
 W!&$		
 H%%dm 	    z0legacy behavior retained for compatibility #4167reasonc                     t        d      }t        |      }t        |      }|j                          t	        j
                  |j                        }|j                  dk(  sJ |j                  dk(  sJ y )NzFoo $$$ Bar_baz-bing)r*   z	.egg-linkFoo_Bar_baz_bing)	r0   r   r   r2   pathlibPathegg_linksuffixstem)r5   r6   r7   r8   links        r   test_egg_link_filenamez"TestDevelop.test_egg_link_filenameU   sg    '
 H%dm||CLL){{k)))yy....r:   N)__name__
__module____qualname__hasattrsysin_virtualenvr'   prefixin_venvr9   r.   markxfailrE    r:   r   r%   r%   6   sY    C/Mc=)Kcoo.KG6 [[PQ	/ R	/r:   r%   c                   "    e Zd ZdZd Zd Zd Zy)TestResolverz
    TODO: These tests were written with a minimal understanding
    of what _resolve_setup_path is intending to do. Come up with
    more meaningful cases that look like real-world scenarios.
    c                 <    t        j                  ddd      dk(  sJ y )N.r   _resolve_setup_pathr5   s    r   test_resolve_setup_path_cwdz(TestResolver.test_resolve_setup_path_cwdi   s    **3S9S@@@r:   c                 <    t        j                  ddd      dk(  sJ y )NpkgsrT   ../rU   rW   s    r   test_resolve_setup_path_one_dirz,TestResolver.test_resolve_setup_path_one_dirl   s    **63?5HHHr:   c                 <    t        j                  ddd      dk(  sJ y )Nzpkgs/rT   rZ   r[   rU   rW   s    r   .test_resolve_setup_path_one_dir_trailing_slashz;TestResolver.test_resolve_setup_path_one_dir_trailing_slasho   s    **7C@EIIIr:   N)rF   rG   rH   __doc__rX   r\   r^   rP   r:   r   rR   rR   b   s    AIJr:   rR   c                      e Zd Zed        Zej                  j                   ee	j                  j                  d            d      ej                  j                   ej                         dk(  d      d               Zy)	TestNamespacesc                    t         j                  dddt        |      g}| j                         5  t	        t        |      g      5  t        j                  |       d d d        d d d        y # 1 sw Y   xY w# 1 sw Y   y xY w)Nr   r   z--install-dir)rJ   
executablestrr   r   
subprocess
check_call)src_dirr   develop_cmds      r   install_developzTestNamespaces.install_developt   sg     NNK
 ^^$c&k]3%%k2 4 33 s#   A8A,A8,A5	1A88BAPPVEYORz-https://github.com/pypa/setuptools/issues/851r;   PyPyz.https://github.com/pypa/setuptools/issues/1202c           	      x   t        j                  |d      }t        j                  |d      }|dz  }t        j                  dddt	        |      dt	        |      g}t        j                  |       | j                  ||       t        j                  |       t        j                  dd	g}t        t	        |      g      5  t        j                  |       d
d
d
       t        j                  ddg}t        t	        |      g      5  t        j                  |       d
d
d
       y
# 1 sw Y   PxY w# 1 sw Y   y
xY w)a  
        Installing two packages sharing the same namespace, one installed
        naturally using pip or `--single-version-externally-managed`
        and the other installed using `develop` should leave the namespace
        in tact and both packages reachable by import.
        z	myns.pkgAz	myns.pkgBr+   z-mpipinstallz-tz-cz"import myns.pkgA; import myns.pkgBNzimport pkg_resources)
r   build_namespace_packagerJ   rc   rd   re   rf   ri   make_site_dirr   )r5   r   pkg_Apkg_Br   install_cmd
try_importpkg_resources_imps           r   !test_namespace_package_importablez0TestNamespaces.test_namespace_package_importable   s    226;G226;G*$ NNJK
 	k*UF+  (NN0


 !#f+/!!*- 0
 NN"

 !#f+/!!"34 0/ 0/ 0/s   ?D$D0$D-0D9N)rF   rG   rH   staticmethodri   r.   rN   skipifboolosenvirongetplatformpython_implementationrv   rP   r:   r   ra   ra   s   s    
3 
3 [[RZZ^^J'(>   [[&&&(F2?  &5		&5r:   ra   )r_   rz   r?   r}   re   rJ   r.   setuptools._pathr   setuptools.command.developr   setuptools.distr    r   r   r   r   fixturer   r#   r%   rR   ra   rP   r:   r   <module>r      s     	    
  0 . ( "    )/ )/XJ J"<5 <5r:   