o
    NZh                      @   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)Zmonkeypatch	user_base	user_site r
   L/var/www/auris/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   Zdevelop_cmdr
   r
   r   install_develop4   s   
"zTestNamespaces.install_developZ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   Zbuild_namespace_packager!   r"   r#   r$   r%   r'   Zmake_site_dirr   )selfr   Zpkg_AZpkg_Br   Zinstall_cmdZ
try_importZpkg_resources_impr
   r
   r   !test_namespace_package_importableA   s8   
	
"z0TestNamespaces.test_namespace_package_importableN)__name__
__module____qualname__staticmethodr'   pytestmarkZskipifboolosenvirongetplatformpython_implementationZuses_networkr.   r
   r
   r
   r   r   3   s    

r   )__doc__r6   r9   r$   r!   r3   Zsetuptools._pathr    r   r   r   r   Zfixturer   r   r   r
   r
   r
   r   <module>   s    

