
    nf+                     |   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
 ddlmZ ej                  j                  dd      Zd Zej"                  d	        Zd
 Zd Zej                  j*                  d        Zd Zej                  j*                  ej                  j1                  d      d               Zd Zy)z<Run some integration tests.

Try to install a few packages.
    N)easy_install)DistributionzMplatform.python_implementation() == "PyPy" and platform.system() == "Windows"zpypa/setuptools#2496)reasonc           	      R   d}|D ]=  }	 t        |       d}t        j                   |j                  di t	                      ? 	 t        j                  j                  d       y # t
        $ r Y lw xY w# t        $ r(}t        j                  t        |             Y d }~y d }~ww xY w)N)	stevedorevirtualenvwrapperpbr
novaclientz4Integration tests cannot run when {pkg} is installedzhttps://pypi.python.org/pypi )
__import__pytestskipformatlocalsImportErrorurllibrequesturlopen	Exceptionstr)modulepackagespkgtmplexcs        y/var/dept/share/cheung/public_html/OutSchool/python/env/lib/python3.12/site-packages/setuptools/tests/test_integration.pysetup_moduler      s    DH 	sOIDKK/fh/0	=>	  		
  CHs)   :A&A5 &	A21A25	B&>B!!B&c                   	 |j                  d      |j                  d      |j                  d      	|j                  d      	fd}| j                  |       j                         j                  t        d	j
                         j                  dj
                         j                  d	j
                         j                  d	t        j                  j
                  gz          j                  d
t        t        j                  j                  j                  t        j                                     t               }t        |      }j
                  |_        |S )z3Fixture to set up temporary installation directory.cwd	user_base	user_siteinstall_dirc                      j                          j                          j                          j                           j                          y )N)undoremove)r"   monkeypatchnew_cwdr    r!   s   r   finzinstall_context.<locals>.fin1   s?     	    __file__zsite.USER_BASEzsite.USER_SITEzsys.path
PYTHONPATH)mkdiraddfinalizerchdirsetattreasy_install_pkgstrpathsyspathsetenvr   ospathsepjoinr   r   r"   )
r   tmpdirr&   r(   distcmdr"   r'   r    r!   s
     `   @@@@r   install_contextr;   (   s!    ll5!G[)I[)I,,}-K   g(*i6G6GH()*;*;<()*;*;<
CHH0C0C/D$DE|S)=)=chh)G%HI >D
t
C!))COJr)   c                 f   | g|_         |j                          |j                          |j                  }t	        j                  t
        j                  j                  ||dz               }|sJ t
        j                  j                  t
        j                  j                  |d   ||            sJ y )Nz*.eggr   )	argsensure_finalizedrunr"   globr5   r3   r7   exists)requirementr:   pkgname
modulenametarget	dest_paths         r   _install_onerG   L   s~    }CHGGI__F		"'',,vw/@ABI977>>"'',,y|WjIJJJr)   c                      t        d| dd       y )Nr   zextension.pyrG   r;   s    r   test_stevedorerK   V   s    o{NKr)   c                      t        d| dd       y )Nr   zhook_loader.pyrI   rJ   s    r   test_virtualenvwrapperrM   Z   s    _.ACSr)   c                      t        d| dd       y )Nr	   zcore.pyrI   rJ   s    r   test_pbrrO   a   s    	:r)   z(ignore:'encoding' argument not specifiedc                      t        d| dd       y )Nzpython-novaclientr
   zbase.pyrI   rJ   s    r   test_python_novaclientrQ   e   s     $o|YOr)   c                     t        d| dd       | j                  d   }t        j                  j	                  t        j                  j                  |j                  dd            sJ y)z
    Install the pyuri package (version 0.3.1 at the time of writing).

    This is also a regression test for issue #1016.
    pyurizuri.pyz	uri.regexN)rG   installed_projectsr5   r3   rA   r7   location)r;   rS   s     r   
test_pyurirV   o   sO     /7H=..w7E 77>>"'',,u~~wLMMMr)   )__doc__r@   r5   r2   urllib.requestr   r   setuptools.command.easy_installr   setuptools.commandr0   setuptools.distr   markskipif
pytestmarkr   fixturer;   rG   rK   xfailrM   rO   filterwarningsrQ   rV   r   r)   r   <module>rb      s   
  	 
   8 ? ( [[S!   
     FKL  ; FG
P H PNr)   