
    nf                     @    d dl Z d dlZddlmZ d dlmZ  G d d      Zy)    N   )
namespaces)testc                   $    e Zd Zd Zd Zd Zd Zy)TestNamespacesc           	      n   t        j                  |d      }t        j                  |d      }|dz  }|dz  }||f}t        j                  dddt	        |      dt	        |      g}t        j                  |       t        j                  |       t        j                  dddt	        |      dt	        |      g}t        j                  |       t        j                  d	d
g}t        j                  j                  t        t        |            5  t        j                  |       ddd       y# 1 sw Y   yxY w)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.pkgA	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   paths_on_pythonpathmap)	selftmpdirpkg_Apkg_Bsite_packagespath_packagestargetsinstall_cmd
try_imports	            x/var/dept/share/cheung/public_html/OutSchool/python/env/lib/python3.12/site-packages/setuptools/tests/test_namespaces.pytest_mixed_site_and_non_sitez+TestNamespaces.test_mixed_site_and_non_site	   s    226;G226;G00. NNJ
 	k*  /NNJ
 	k*NN0


 YY**3sG+<= 	.!!*-	. 	. 	.s   D++D4c           	      H   t        j                  |d      }|dz  }|j                          t        j                  ddddt        |      t        |      g}t        j                  j                  t        |      g      5  t        j                  |       ddd       t        j                  |       t        j                  dd	g}t        j                  j                  t        |      g      5  t        j                  |       ddd       y# 1 sw Y   yxY w# 1 sw Y   yxY w)
zc
        Ensure that a namespace package doesn't break on import
        of pkg_resources.
        r	   packagesr   pipr   r   Nr   zimport pkg_resources)r   r   mkdirr   r   r   r   r   r   r   r   )r   r   pkgtargetr    r!   s         r"   test_pkg_resources_importz(TestNamespaces.test_pkg_resources_import3   s    
 00E*$NNKH
 YY**CK=9 	/!!+.	/  (NN"


 YY**CK=9 	.!!*-	. 	.	/ 	/	. 	.s   >D-DDD!c           	         t        j                  |d      }|dz  }t        j                  dddt	        |      dt	        |      g}t        j                  |       t        j                  |       t        j                  ddg}t        j                  j                  t	        |      g      5  t        j                  |t	        |      	       d
d
d
       y
# 1 sw Y   y
xY w)z
        Installing a namespace packages but also having it in the current
        working directory, only one version should take precedence.
        r	   r%   r   r   r   r   r   z&import pkg_resources; import myns.pkgAcwdN
r   r   r   r   r   r   r   r   r   r   )r   r   r   r)   r    pkg_resources_imps         r"   (test_namespace_package_installed_and_cwdz7TestNamespaces.test_namespace_package_installed_and_cwdO   s    
 226;G*$ NNJK
 	k*  ( NN4

 YY**CK=9 	E!!"3UD	E 	E 	Es   +!CCc           	         t        j                  |d      }t        j                  |d      }|dz  }t        j                  dddt	        |      dt	        |      g}t        j                  |       t        j                  |       t        j                  dd	g}t        j                  j                  t	        |      g      5  t        j                  |t	        |      
       ddd       y# 1 sw Y   yxY w)z
        Installing one namespace package and also have another in the same
        namespace in the current working directory, both of them must be
        importable.
        r	   r
   r%   r   r   r   r   r   z8import pkg_resources; import myns.pkgA; import myns.pkgBr,   Nr.   )r   r   r   r   r)   r    r/   s          r"   5test_packages_in_the_same_namespace_installed_and_cwdzDTestNamespaces.test_packages_in_the_same_namespace_installed_and_cwdl   s     226;G226;G*$ NNJK
 	k*  ( NNF

 YY**CK=9 	E!!"3UD	E 	E 	Es   !C++C4N)__name__
__module____qualname__r#   r*   r0   r2        r"   r   r      s    (.T.8E:Er7   r   )r   r    r   setuptools.commandr   r   r6   r7   r"   <module>r:      s    
   #AE AEr7   