ó
X¾÷Xc           @   s­  d  d l  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	 e j
 e j j d d ƒ ƒ Z e j j d d ƒ Z e j j d d	 ƒ Z e j j d
 d ƒ Z e j j d d ƒ Z d d g e d d e g Z e j
 e j j d d ƒ ƒ Z e j j e j j e d d d ƒ ƒ Z d „  Z d e j f d „  ƒ  YZ d e j f d „  ƒ  YZ d e j f d „  ƒ  YZ d e j f d „  ƒ  YZ d S(   iÿÿÿÿN(   t   base(   t   test_packagingt   PIPFLAGSt    t
   PIPVERSIONt   pipt
   PBRVERSIONt   pbrt   REPODIRt
   WHEELHOUSEs   -mt   installs   -ft   PROJECTSs   ..c          c   sÙ   t  s
 d  St d d g ƒ }  x¶ t D]® } | j ƒ  } | j d ƒ d } yF t t j j t  | d ƒ d ƒ  } d | j	 ƒ  k r‡ w# n  Wd  QXWn t
 k
 r¤ q# n X| |  k r· q# n  | t d | d	 | ƒ f Vq# Wd  S(
   Nt   tempestt   requirementst   /iÿÿÿÿs   setup.pyt   rtR   t   namet
   short_name(   R   t   setR   t   stript   splitt   opent   ost   patht   joint   readt   IOErrort   dict(   t   excludesR   R   t   f(    (    s7   /tmp/pip-build-h1VYrz/pbr/pbr/tests/test_integration.pyt   all_projects#   s     t   TestIntegrationc           B   sP   e  Z e e ƒ  ƒ Z d  „  Z e j e j	 j
 d d ƒ d k d ƒ d „  ƒ Z RS(   c         C   sO   t  j d t j j d d ƒ ƒ } |  t t |  ƒ j ƒ  Wd  QXt j	 ƒ  d  S(   Nt   OS_TEST_TIMEOUTt   600(
   t   fixturest   EnvironmentVariableR   t   environt   gett   superR   t   setUpR    t   _config_git(   t   selft   env(    (    s7   /tmp/pip-build-h1VYrz/pbr/pbr/tests/test_integration.pyR'   ;   s
    t   PBR_INTEGRATIONt   1s   integration tests not enabledc   	      C   s  |  j  t j d d d t j j t |  j ƒ g d t j j t d ƒ ƒƒ |  j  t j d d d t j j t |  j ƒ d t ƒƒ t j j |  j  t	 j
 ƒ  ƒ j d	 ƒ } |  j  t j d
 d d
 t j j t |  j ƒ | g ƒ ƒ |  j  t j d d d d t g d t ƒƒ } | j } |  j  t j d | d d g d | ƒƒ |  j  t j d d d d t g d t ƒƒ } | j } t j j | d t j t j j | d ƒ ƒ d ƒ } |  j  t j d | g t | g ƒ ƒ |  j  t j d d d d t g d t ƒƒ } | j } | j } |  j  t j d | g t d | g ƒ ƒ |  j d k r”t } x5 t j | ƒ D]$ \ } } } d | k r\t } q\q\W|  j | ƒ n  |  j  t j d d d d t g d t ƒƒ } | j } | j } |  j  t j d | g t d | g ƒ ƒ d  S(   Ns   sync-reqt   pythons	   update.pyt   cwdR   s   commit-requirementss.   git diff --quiet || git commit -amrequirementst   shellt   projectt   clonet   gitt   sdistt   modulesR   t   wheelt   pip_cmds   setup.pyt   tarballt   disti    s   install-gits   git+file://t   novas   migrate.cfgs	   install-es   -e(   t
   useFixtureR    t   CapturedSubprocessR   R   R   R   R   t   TrueR"   t   TempDirR   t   VenvR   t   PIP_CMDR-   t   listdirt   Falset   walkt
   assertTrue(	   R)   R   t   venvR-   t   filenamet   roott   foundt   _t	   filenames(    (    s7   /tmp/pip-build-h1VYrz/pbr/pbr/tests/test_integration.pyt   test_integrationD   sf    !"	(			+				N(   t   __name__t
   __module__t   listR   t	   scenariosR'   t	   testtoolst
   skipUnlessR   R$   R%   t   NoneRJ   (    (    (    s7   /tmp/pip-build-h1VYrz/pbr/pbr/tests/test_integration.pyR   7   s
   		t   TestInstallWithoutPbrc           B   s8   e  Z e j e j j d  d ƒ d k d ƒ d „  ƒ Z RS(   R+   R,   s   integration tests not enabledc   	      C   s“  |  j  t j ƒ  ƒ j } t j j | d ƒ } t j | ƒ |  j t j	 d d d | f d t
 d t ƒt j j | d ƒ } t j | ƒ i i t j d ƒ d 6t j d	 | ƒ d
 6d 6i t j d ƒ d 6t j d ƒ d 6d 6} |  j  t j | ƒ ƒ j } | d } | d } |  j t j	 d d d | f d t
 d | ƒ|  j  t j d d d g ƒ ƒ } | j } |  j  t j d | g d d g d | ƒƒ d  S(   Nt   distdirs   setup.pyR3   s   -dt
   allow_failR.   t   testpkgs&                      #!/usr/bin/env python
                    import setuptools
                    setuptools.setup(
                        name = 'pkgTest',
                        tests_require = ['pkgReq'],
                        test_suite='pkgReq'
                    )
                sW                       [easy_install]
                    find_links = %s
                s	   setup.cfgt   pkgTests(                       pbr
                s   requirements.txtsE                       print("FakeTest loaded and ran")
                s   pkgReq/__init__.pyt   pkgReqt   nopbrR   R5   t   test(   R:   R"   R=   R   R   R   t   mkdirt   _run_cmdt   syst
   executableRA   t   PBR_ROOTt   textwrapt   dedentR   t   CreatePackagest   package_dirsR>   R-   R    R;   (	   R)   t   tempdirt   dist_dirt   test_pkg_dirt   pkgst   pkg_dirst   req_pkg_dirRD   R-   (    (    s7   /tmp/pip-build-h1VYrz/pbr/pbr/tests/test_integration.pyt   test_install_without_pbr‡   s8    



!	N(	   RK   RL   RO   RP   R   R$   R%   RQ   Ri   (    (    (    s7   /tmp/pip-build-h1VYrz/pbr/pbr/tests/test_integration.pyRR   …   s   t   TestMarkersPipc        	   B   s¹   e  Z d  i d g d 6f d i d g d 6f d i d g d 6f d i d d	 g d 6f d
 i d d g d 6f d i d d g d 6f g Z e j e j j d d ƒ d k d ƒ d „  ƒ Z	 RS(   s   pip-1.5s   pip>=1.5,<1.6R4   s   pip-6.0s   pip>=6.0,<6.1s
   pip-latestR   s   setuptools-EL7s
   pip==1.4.1s   setuptools==0.9.8s   setuptools-Trustys   pip==1.5s   setuptools==2.2s   setuptools-minimums   setuptools==0.7.2R+   R,   s   integration tests not enabledc   	   	   C   s  i i t  j d ƒ d 6d 6i  d 6i  d 6} |  j t j | ƒ ƒ j } |  j t j ƒ  ƒ j } t	 j j
 | d ƒ } |  j t j d ƒ ƒ } | j } t	 j | ƒ x? |  j D]4 } |  j | d d	 d
 d | g d | j d t ƒq« Wx: | D]2 } |  j | d d d | g d | | d t ƒqê W|  j | d d	 d
 d d | d g d | j d t ƒ|  j d |  j | d d	 d g d | j d t ƒd ƒ d  S(   Nsr                       pkg_a; python_version=='1.2'
                    pkg_b; python_version!='1.2'
                s   requirements.txtt   test_markerst   pkg_at   pkg_bt   repot   markerss   -mR   R
   s	   --upgradeR.   RT   s   setup.pyR3   s   -ds
   --no-indexs   -fs   pkg-bt   freezei    (   R_   R`   R:   R   Ra   Rb   R"   R=   R   R   R   R>   R-   RZ   R4   R[   RA   t   assertIn(	   R)   Rf   Rg   t   temp_dirt   repo_dirRD   t
   bin_pythont   modulet   pkg(    (    s7   /tmp/pip-build-h1VYrz/pbr/pbr/tests/test_integration.pyt   test_pip_versionsÇ   s:    	
		N(
   RK   RL   RN   RO   RP   R   R$   R%   RQ   Rw   (    (    (    s7   /tmp/pip-build-h1VYrz/pbr/pbr/tests/test_integration.pyRj   ¼   s   t   TestLTSSupportc           B   s²   e  Z d  i d d g d 6e d 6f d i d d g d 6e d 6f d i d	 d
 g d 6e d 6f d i d d g d 6e d 6f g Z e j e j j	 d d ƒ d k d ƒ d „  ƒ Z RS(   t   EL7s
   pip==1.4.1s   setuptools==0.9.8R4   t
   py3supportt   Trustys   pip==1.5s   setuptools==2.2t   Jessies
   pip==1.5.6s   setuptools==5.5.1t   WheezyPrecises   setuptools==0.6c11R+   R,   s   integration tests not enabledc         C   s   t  j d d k r- |  j r- |  j d ƒ n  |  j t j d d |  j ƒƒ } | j } d t	 } |  j
 | d d d	 | g d
 | j d t ƒd  S(   Ni    i   s9   This combination will not install with py3, skipping testt
   setuptoolsR4   s   file://%s#egg=pbrs   -mR   R
   R.   RT   (   R\   t   version_infoRz   t   skipTestR:   R   R>   R4   R-   R^   R[   R   RA   (   R)   RD   Rt   R   (    (    s7   /tmp/pip-build-h1VYrz/pbr/pbr/tests/test_integration.pyt   test_lts_venv_default_versionsÿ   s    	
N(   RK   RL   R<   RA   RN   RO   RP   R   R$   R%   RQ   R   (    (    (    s7   /tmp/pip-build-h1VYrz/pbr/pbr/tests/test_integration.pyRx   î   s   


(   t   os.pathR   t   shlexR\   R"   RO   R_   t	   pbr.testsR    R   R   R$   R%   R   R   R   R   R	   R?   R   R   t   abspathR   t   __file__R^   R   t   BaseTestCaseR   RR   Rj   Rx   (    (    (    s7   /tmp/pip-build-h1VYrz/pbr/pbr/tests/test_integration.pyt   <module>   s(   '	N72