ó
ŠwÛjc           @   sS  d  d l  Z  d  d l Z d  d l Z d  d l Z d  d l Z d  d l j Z d  d l Z	 d  d l
 Z
 d  d l Z
 d e  j f d „  ƒ  YZ d d d „  ƒ  YZ d e e  j f d „  ƒ  YZ e j e
 j d „ ƒ Z d	 e e  j f d
 „  ƒ  YZ d e
 j Z d e e  j f d „  ƒ  YZ d e e  j f d „  ƒ  YZ e d k rOe	 j j e ƒ n  d S(   iÿÿÿÿNt   TestEnsurePipVersionc           B   s   e  Z d  „  Z RS(   c         C   s   |  j  t j t j ƒ  ƒ d  S(   N(   t   assertEqualt	   ensurepipt   _PIP_VERSIONt   version(   t   self(    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_ensurepip.pyt   test_returns_version   s    (   t   __name__t
   __module__R   (    (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_ensurepip.pyR       s   t   EnsurepipMixinc           B   s   e  Z d  „  Z RS(   c         C   s    t  j d ƒ } | j ƒ  |  _ d |  j _ |  j | j ƒ t j } t  j d ƒ } | j ƒ  } |  j | j ƒ | | _ t j	 | _	 t j
 j ƒ  |  _ | _
 d  S(   Ns   ensurepip._run_pipi    s   ensurepip.os(   t   mockt   patcht   startt   run_pipt   return_valuet
   addCleanupt   stopt   ost   devnullt   patht   environt   copyt
   os_environ(   R   t   run_pip_patcht   real_devnullt   os_patcht
   patched_os(    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_ensurepip.pyt   setUp   s    		(   R   R   R   (    (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_ensurepip.pyR	      s   t   TestBootstrapc           B   s}   e  Z d  „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z	 d „  Z
 d	 „  Z d
 „  Z d „  Z d „  Z RS(   c         C   sc   t  j ƒ  |  j j d d d t j d d g t j ƒ |  j j d d } |  j t | ƒ d ƒ d  S(	   Nt   installs
   --no-indexs   --find-linkst
   setuptoolst   pipi    i   i   (	   R   t	   bootstrapR   t   assert_called_once_withR
   t   ANYt	   call_argsR   t   len(   R   t   additional_paths(    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_ensurepip.pyt   test_basic_bootstrapping'   s    
		
c      	   C   sE   t  j d d ƒ |  j j d d d t j d d d d g t j ƒ d  S(	   Nt   roots	   /foo/bar/R   s
   --no-indexs   --find-linkss   --rootR   R   (   R   R    R   R!   R
   R"   (   R   (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_ensurepip.pyt   test_bootstrapping_with_root5   s    			c         C   sB   t  j d t ƒ |  j j d d d t j d d d g t j ƒ d  S(   Nt   userR   s
   --no-indexs   --find-linkss   --userR   R   (   R   R    t   TrueR   R!   R
   R"   (   R   (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_ensurepip.pyt   test_bootstrapping_with_userA   s
    		c         C   sB   t  j d t ƒ |  j j d d d t j d d d g t j ƒ d  S(   Nt   upgradeR   s
   --no-indexs   --find-linkss	   --upgradeR   R   (   R   R    R*   R   R!   R
   R"   (   R   (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_ensurepip.pyt   test_bootstrapping_with_upgradeL   s
    		c         C   sB   t  j d d ƒ |  j j d d d t j d d d g t j ƒ d  S(	   Nt	   verbosityi   R   s
   --no-indexs   --find-linkss   -vR   R   (   R   R    R   R!   R
   R"   (   R   (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_ensurepip.pyt#   test_bootstrapping_with_verbosity_1W   s
    		c         C   sB   t  j d d ƒ |  j j d d d t j d d d g t j ƒ d  S(	   NR.   i   R   s
   --no-indexs   --find-linkss   -vvR   R   (   R   R    R   R!   R
   R"   (   R   (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_ensurepip.pyt#   test_bootstrapping_with_verbosity_2b   s
    		c         C   sB   t  j d d ƒ |  j j d d d t j d d d g t j ƒ d  S(	   NR.   i   R   s
   --no-indexs   --find-linkss   -vvvR   R   (   R   R    R   R!   R
   R"   (   R   (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_ensurepip.pyt#   test_bootstrapping_with_verbosity_3m   s
    		c         C   s%   t  j ƒ  |  j |  j d d ƒ d  S(   Nt   ENSUREPIP_OPTIONSR   (   R   R    R   R   (   R   (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_ensurepip.pyt'   test_bootstrapping_with_regular_installx   s    
c         C   s+   t  j d t ƒ |  j |  j d d ƒ d  S(   Nt
   altinstallR2   (   R   R    R*   R   R   (   R   (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_ensurepip.pyt#   test_bootstrapping_with_alt_install|   s    c         C   s'   t  j d t ƒ |  j d |  j ƒ d  S(   Nt   default_pipR2   (   R   R    R*   t   assertNotInR   (   R   (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_ensurepip.pyt#   test_bootstrapping_with_default_pip€   s    c      	   C   sC   |  j  t ƒ � t j d t d t ƒ Wd  QX|  j |  j j ƒ d  S(   NR4   R6   (   t   assertRaisest
   ValueErrorR   R    R*   t   assertFalseR   t   called(   R   (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_ensurepip.pyt$   test_altinstall_default_pip_conflict„   s    c         C   s.   d |  j  d <t j ƒ  |  j d |  j  ƒ d  S(   Ns   test foddert   PIP_THIS_SHOULD_GO_AWAY(   R   R   R    R7   (   R   (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_ensurepip.pyt&   test_pip_environment_variables_removed‰   s    
c         C   s(   t  j ƒ  |  j |  j d t j ƒ d  S(   Nt   PIP_CONFIG_FILE(   R   R    R   R   R   R   (   R   (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_ensurepip.pyt   test_pip_config_file_disabled�   s    
(   R   R   R&   R(   R+   R-   R/   R0   R1   R3   R5   R8   R=   R?   RA   (    (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_ensurepip.pyR   %   s   												c         #   s™   ˆ  d  k r d  } n" d d ‡  f d †  ƒ  Y} | ƒ  } t ƒ  } t j j d | ƒ } | t j d <z	 | VWd  | | k r‡ t j d =n | t j d <Xd  S(   Nt   FakePipc              s   e  Z ˆ  Z RS(    (   R   R   t   __version__(    (   R   (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_ensurepip.pyRB   œ   s   R   (    (   t   Nonet   objectt   syst   modulest   get(   R   R   RB   t   sentinelt   orig_pip(    (   R   s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_ensurepip.pyt   fake_pip—   s    				t   TestUninstallc           B   sP   e  Z d  „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z	 RS(   c         C   s4   t  d  ƒ � t j ƒ  Wd  QX|  j |  j j ƒ d  S(   N(   RK   RD   R   t   _uninstall_helperR;   R   R<   (   R   (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_ensurepip.pyt)   test_uninstall_skipped_when_not_installed­   s    c      	   C   sn   t  d ƒ �' t j j ƒ  � } t j ƒ  Wd  QXWd  QX| j ƒ  j ƒ  } |  j d | ƒ |  j	 |  j
 j ƒ d  S(   Ns   not a valid versions!   only uninstall a matching version(   RK   t   testt   test_supportt   captured_stderrR   RM   t   getvaluet   stript   assertInR;   R   R<   (   R   t   stderrt   warning(    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_ensurepip.pyt5   test_uninstall_skipped_with_warning_for_wrong_version²   s    c         C   s=   t  ƒ  � t j ƒ  Wd  QX|  j j d d d d d g ƒ d  S(   Nt	   uninstalls   -ys   --disable-pip-version-checkR   R   (   RK   R   RM   R   R!   (   R   (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_ensurepip.pyt   test_uninstallº   s
    
	c         C   sF   t  ƒ  � t j d d ƒ Wd  QX|  j j d d d d d d g ƒ d  S(	   NR.   i   RX   s   -ys   --disable-pip-version-checks   -vR   R   (   RK   R   RM   R   R!   (   R   (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_ensurepip.pyt   test_uninstall_with_verbosity_1Å   s
    
	c         C   sF   t  ƒ  � t j d d ƒ Wd  QX|  j j d d d d d d g ƒ d  S(	   NR.   i   RX   s   -ys   --disable-pip-version-checks   -vvR   R   (   RK   R   RM   R   R!   (   R   (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_ensurepip.pyt   test_uninstall_with_verbosity_2Ð   s
    
	c         C   sF   t  ƒ  � t j d d ƒ Wd  QX|  j j d d d d d d g ƒ d  S(	   NR.   i   RX   s   -ys   --disable-pip-version-checks   -vvvR   R   (   RK   R   RM   R   R!   (   R   (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_ensurepip.pyt   test_uninstall_with_verbosity_3Û   s
    
	c         C   s>   d |  j  d <t ƒ  � t j ƒ  Wd  QX|  j d |  j  ƒ d  S(   Ns   test fodderR>   (   R   RK   R   RM   R7   (   R   (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_ensurepip.pyR?   æ   s    
c         C   s8   t  ƒ  � t j ƒ  Wd  QX|  j |  j d t j ƒ d  S(   NR@   (   RK   R   RM   R   R   R   R   (   R   (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_ensurepip.pyRA   î   s    
(
   R   R   RN   RW   RY   RZ   R[   R\   R?   RA   (    (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_ensurepip.pyRL   «   s   							s   pip t   TestBootstrappingMainFunctionc           B   s#   e  Z d  „  Z d „  Z d „  Z RS(   c      
   C   sw   t  j j ƒ  �- } |  j t ƒ � t j d g ƒ Wd  QXWd  QX| j ƒ  j ƒ  } |  j	 | t
 ƒ |  j |  j j ƒ d  S(   Ns	   --version(   RO   RP   RQ   R9   t
   SystemExitR   t   _mainRR   RS   R   t   EXPECTED_VERSION_OUTPUTR;   R   R<   (   R   RU   t   result(    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_ensurepip.pyt   test_bootstrap_versioný   s    c         C   sx   t  j g  ƒ } |  j j d d d t j d d g t j ƒ |  j j d d } |  j t | ƒ d ƒ |  j | d ƒ d  S(	   NR   s
   --no-indexs   --find-linksR   R   i    i   i   (	   R   R_   R   R!   R
   R"   R#   R   R$   (   R   t	   exit_codeR%   (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_ensurepip.pyR&     s    		
c         C   s/   d |  j  _ t j g  ƒ } |  j | d ƒ d  S(   Ni   (   R   R   R   R_   R   (   R   Rc   (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_ensurepip.pyt   test_bootstrapping_error_code  s    (   R   R   Rb   R&   Rd   (    (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_ensurepip.pyR]   û   s   		t   TestUninstallationMainFunctionc           B   s#   e  Z d  „  Z d „  Z d „  Z RS(   c      
   C   sz   t  j j ƒ  �0 } |  j t ƒ � t j j d g ƒ Wd  QXWd  QX| j ƒ  j	 ƒ  } |  j
 | t ƒ |  j |  j j ƒ d  S(   Ns	   --version(   RO   RP   RQ   R9   R^   R   t
   _uninstallR_   RR   RS   R   R`   R;   R   R<   (   R   RU   Ra   (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_ensurepip.pyt   test_uninstall_version  s    c         C   sU   t  ƒ  � t j j g  ƒ } Wd  QX|  j j d d d d d g ƒ |  j | d ƒ d  S(   NRX   s   -ys   --disable-pip-version-checkR   R   i    (   RK   R   Rf   R_   R   R!   R   (   R   Rc   (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_ensurepip.pyt   test_basic_uninstall%  s    
	
c         C   sB   t  ƒ  �# d |  j _ t j j g  ƒ } Wd  QX|  j | d ƒ d  S(   Ni   (   RK   R   R   R   Rf   R_   R   (   R   Rc   (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_ensurepip.pyt   test_uninstall_error_code2  s    
(   R   R   Rg   Rh   Ri   (    (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_ensurepip.pyRe     s   		t   __main__(    (   t   unittestR   t   os.patht
   contextlibRF   t   test._mock_backportt   _mock_backportR
   t   test.test_supportRO   R   t   ensurepip._uninstallt   TestCaseR    R	   R   t   contextmanagerR   RK   RL   R`   R]   Re   R   RP   t   run_unittest(    (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_ensurepip.pyt   <module>   s&   rM 