o
    LK&h                      @   s~   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mZ ddlm	Z	m
Z
 dZdZejdd	 Zejd
d ZG dd dZdS )zdevelop tests    N)paths_on_pythonpath   )contexts
namespaceszHfrom setuptools import setup

setup(name='foo',
    packages=['foo'],
)
zprint "foo"
c              	   c   s    t  4}t  }| d| | d| d V  W d    n1 s$w   Y  W d    d S W d    d S 1 s<w   Y  d S )Nzsite.USER_BASEzsite.USER_SITE)r   tempdirsetattr)monkeypatch	user_base	user_site r   P/var/www/html/venv/lib/python3.10/site-packages/setuptools/tests/test_develop.py	temp_user   s   

"r   c                 c   s    | }| d}|d }| rtt||d}|t W d    n1 s+w   Y  |d }|d}|t W d    n1 sIw   Y  |  |V  W d    d S 1 saw   Y  d S )Nfoosetup.pywz__init__.py)	mkdirisfile
ValueErrordiropenwriteSETUP_PYINIT_PYas_cwd)tmpdirr   targetr   setupfinitr   r   r   test_env#   s    

"r   c                   @   s\   e Zd Zedd Zejjee	j
dddejje dkddejjdd	 Zd
S )TestNamespacesc              	   C   s   t jdddt|g}|  - tt|g t| W d    n1 s&w   Y  W d    d S W d    d S 1 s>w   Y  d S )Nr   developz--install-dir)sys
executablestrr   r   
subprocess
check_call)src_dirr   develop_cmdr   r   r   install_develop4   s   
"zTestNamespaces.install_developAPPVEYORz-https://github.com/pypa/setuptools/issues/851)reasonPyPyz.https://github.com/pypa/setuptools/issues/1202c                 C   s   t |d}t |d}|d }tjdddt|dt|g}t| | || t | tjdd	g}t	t|g t| W d
   n1 sKw   Y  tjddg}t	t|g t| W d
   d
S 1 snw   Y  d
S )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.pkgBpackagesz-mpipinstallz-tz-cz"import myns.pkgA; import myns.pkgBNzimport pkg_resources)
r   build_namespace_packager"   r#   r$   r%   r&   r)   make_site_dirr   )selfr   pkg_Apkg_Br   install_cmd
try_importpkg_resources_impr   r   r   !test_namespace_package_importableA   s8   
	
"z0TestNamespaces.test_namespace_package_importableN)__name__
__module____qualname__staticmethodr)   pytestmarkskipifboolosenvirongetplatformpython_implementationuses_networkr8   r   r   r   r   r    3   s    

r    )__doc__rA   rD   r%   r"   r=   setuptools._pathr    r   r   r   r   fixturer   r   r    r   r   r   r   <module>   s    

