o
    5‘ðiÌ	  ã                   @   s:   d dl Z d dlZd dlmZ ddlmZ G dd„ dƒZdS )é    N)Úpaths_on_pythonpathé   )Ú
namespacesc                   @   s   e Zd Zdd„ Zdd„ ZdS )ÚTestNamespacesc           	      C   sÐ   t  |d¡}t  |d¡}|d }|d }||f}tjdddt|ƒdt|ƒg}t |¡ t  |¡ tjdddt|ƒdt|ƒg}t |¡ tjd	d
g}tt	t|ƒƒ� t |¡ W d  ƒ dS 1 saw   Y  dS )zø
        Installing two packages sharing the same namespace, one installed
        to a site dir and the other installed just to a path on PYTHONPATH
        should leave the namespace in tact and both packages reachable by
        import.
        ú	myns.pkgAz	myns.pkgBzsite-packageszpath-packagesú-múpip.__main__Úinstallú-tú-cz"import myns.pkgA; import myns.pkgBN)
r   Úbuild_namespace_packageÚsysÚ
executableÚstrÚ
subprocessÚ
check_callÚmake_site_dirr   Úmap)	ÚselfÚtmpdirÚpkg_AÚpkg_BÚsite_packagesÚpath_packagesÚtargetsÚinstall_cmdÚ
try_import© r   ú_/root/parts/websockify/install/lib/python3.10/site-packages/setuptools/tests/test_namespaces.pyÚtest_mixed_site_and_non_site
   s>   ù
	
ù
	ý"ÿz+TestNamespaces.test_mixed_site_and_non_sitec                 C   s–   t  |d¡}|d }tjdddt|ƒdt|ƒg}t |¡ t  |¡ tjddg}tt|ƒgƒ� tj|t|ƒd	� W d
  ƒ d
S 1 sDw   Y  d
S )z—
        Installing a namespace packages but also having it in the current
        working directory, only one version should take precedence.
        r   Úpackagesr   r   r	   r
   r   zimport myns.pkgA)ÚcwdN)	r   r   r   r   r   r   r   r   r   )r   r   r   Útargetr   Úpkg_resources_impr   r   r   Ú(test_namespace_package_installed_and_cwd4   s&   ù
	
ý"ÿz7TestNamespaces.test_namespace_package_installed_and_cwdN)Ú__name__Ú
__module__Ú__qualname__r   r$   r   r   r   r   r   	   s    *r   )r   r   Úsetuptools._pathr   Ú r   r   r   r   r   r   Ú<module>   s
    