ó
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 Z 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 Z d  d l Z d  d l m Z d  d l m Z d  d l m Z e j j e j j e d d 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 e j  f d „  ƒ  YZ! 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 e j  f d „  ƒ  YZ' 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# „  Z, d S($   iÿÿÿÿN(   t   matchers(   t   git(   t	   packaging(   t   bases   ..t   TestRepoc           B   s>   e  Z d  Z d „  Z d „  Z d d „ Z d „  Z d „  Z RS(   sä   A git repo for testing with.

    Use of TempHomeDir with this fixture is strongly recommended as due to the
    lack of config --local in older gits, it will write to the users global
    configuration without TempHomeDir.
    c         C   s    t  t |  ƒ j ƒ  | |  _ d  S(   N(   t   superR   t   __init__t   _basedir(   t   selft   basedir(    (    s5   /tmp/pip-build-h1VYrz/pbr/pbr/tests/test_packaging.pyR   K   s    c         C   sY   t  t |  ƒ j ƒ  t j d d d g |  j ƒ t j ƒ  t j d d d g |  j ƒ d  S(   NR   t   initt   .t   add(   R   R   t   setUpR   t   _run_cmdR   t   _config_git(   R   (    (    s5   /tmp/pip-build-h1VYrz/pbr/pbr/tests/test_packaging.pyR   O   s    
s   test commitc         C   s{   t  t j |  j ƒ ƒ } |  j d | } t | d ƒ j ƒ  t j d d | g |  j ƒ t j d d d | g |  j ƒ d  S(   Ns   /%dt   wtR   R   t   commits   -m(   t   lent   ost   listdirR   t   opent   closeR   R   (   R   t   message_contentt   filest   path(    (    s5   /tmp/pip-build-h1VYrz/pbr/pbr/tests/test_packaging.pyR   U   s
    c         C   s#   t  j d d d d g |  j ƒ d  S(   NR   t   resets   --hards   HEAD^(   R   R   R   (   R   (    (    s5   /tmp/pip-build-h1VYrz/pbr/pbr/tests/test_packaging.pyt   uncommit\   s    c         C   s&   t  j d d d d | g |  j ƒ d  S(   NR   t   tags   -sms   test tag(   R   R   R   (   R   t   version(    (    s5   /tmp/pip-build-h1VYrz/pbr/pbr/tests/test_packaging.pyR   _   s    (   t   __name__t
   __module__t   __doc__R   R   R   R   R   (    (    (    s5   /tmp/pip-build-h1VYrz/pbr/pbr/tests/test_packaging.pyR   C   s   			t   GPGKeyFixturec           B   s   e  Z d  Z d „  Z RS(   sx   Creates a GPG key for testing.

    It's recommended that this be used in concert with a unique home
    directory.
    c         C   s£  t  t |  ƒ j ƒ  |  j t j ƒ  ƒ } t j d ƒ } t j	 d d g | j
 ƒ } x… | d j d ƒ D][ } | j | ƒ } | rf t | j d ƒ ƒ t | j d ƒ ƒ t | j d ƒ ƒ f } Pqf qf W| d  k rÚ d } n  | j
 d	 } t | d
 ƒ } zA | d d k r)| d d k r)| j d ƒ n  | j d ƒ Wd  | j ƒ  X| d d k r^d } n | d d k rwd } n d } t j	 d d d | | g | j
 ƒ d  S(   Ns#   ^gpg\s.*\s([\d+])\.([\d+])\.([\d+])t   gpgs	   --versioni    s   
i   i   i   s   /key-configR   sO   
                %no-protection
                %transient-key
                s  
            %no-ask-passphrase
            Key-Type: RSA
            Name-Real: Example Key
            Name-Comment: N/A
            Name-Email: example@example.com
            Expire-Date: 2d
            Preferences: (setpref)
            %commit
            s   --quick-randoms   --debug-quick-randomt    s	   --gen-keys   --batch(   i    i    i    (   R   R!   R   t
   useFixturet   fixturest   TempDirt   ret   compileR   R   R   t   splitt   matcht   intt   groupt   NoneR   t   writeR   (   R   t   tempdirt   gnupg_version_ret   gnupg_versiont   linet   config_filet   ft   gnupg_random(    (    s5   /tmp/pip-build-h1VYrz/pbr/pbr/tests/test_packaging.pyR   k   s<    	 
			(   R   R   R    R   (    (    (    s5   /tmp/pip-build-h1VYrz/pbr/pbr/tests/test_packaging.pyR!   d   s   t   Venvc           B   s&   e  Z d  Z d d d „ Z d „  Z RS(   sª   Create a virtual environment for testing with.

    :attr path: The path to the environment root.
    :attr python: The path to the python binary in the environment.
    c         C   sh   | |  _  | d k r1 d t } d d | g } n  | |  _ | d k r[ d d d g |  _ n	 | |  _ d S(   sž  Create a Venv fixture.

        :param reason: A human readable string to bake into the venv
            file path to aid diagnostics in the case of failures.
        :param modules: A list of modules to install, defaults to latest
            pip, wheel, and the working copy of PBR.
        :attr pip_cmd: A list to override the default pip_cmd passed to
            python for installing base packages.
        s   file://%s#egg=pbrt   pipt   wheels   -mt   installN(    (   t   _reasont   PBR_ROOTt   modulesR-   t   pip_cmd(   R   t   reasonR<   R=   t   pbr(    (    s5   /tmp/pip-build-h1VYrz/pbr/pbr/tests/test_packaging.pyR   £   s    
	
	c         C   sí   |  j  t j ƒ  ƒ j } t j | d t ƒt j j | d d ƒ } | g |  j	 d g } |  j
 r« t |  j
 ƒ d k r« | j |  j
 ƒ |  j  t j d |  j | ƒ ƒ n  |  j t |  d ƒ |  j t |  d ƒ | |  _ | |  _ | | f S(   Nt   cleart   bint   pythons   -Ui    s   mkvenv-R   (   R$   R%   R&   R   t
   virtualenvt   create_environmentt   TrueR   t   joinR=   R<   R   t   extendR   t   CapturedSubprocessR:   t
   addCleanupt   delattrRB   (   R   R   RB   t   command(    (    s5   /tmp/pip-build-h1VYrz/pbr/pbr/tests/test_packaging.pyt   _setUp·   s    		(    N(   R   R   R    R-   R   RL   (    (    (    s5   /tmp/pip-build-h1VYrz/pbr/pbr/tests/test_packaging.pyR6   œ   s   t   CreatePackagesc           B   sa   e  Z d  Z i e j e j d ƒ ƒ d 6e j e j d ƒ ƒ d 6Z d „  Z d „  Z	 d „  Z
 RS(   sÆ   Creates packages from dict with defaults

        :param package_dirs: A dict of package name to directory strings
        {'pkg_a': '/tmp/path/to/tmp/pkg_a', 'pkg_b': '/tmp/path/to/tmp/pkg_b'}
    s¶               #!/usr/bin/env python
            import setuptools
            setuptools.setup(
                setup_requires=['pbr'],
                pbr=True,
            )
        s   setup.pys=               [metadata]
            name = {pkg_name}
        s	   setup.cfgc         C   s   | |  _  d S(   sX  Creates packages from dict with defaults

            :param packages: a dict where the keys are the package name and a
            value that is a second dict that may be empty, containing keys of
            filenames and a string value of the contents.
            {'package-a': {'requirements.txt': 'string', 'setup.cfg': 'string'}
        N(   t   packages(   R   RN   (    (    s5   /tmp/pip-build-h1VYrz/pbr/pbr/tests/test_packaging.pyR   Ý   s    c         C   s–   t  j j t  j j | | ƒ ƒ } t  j j | ƒ } t  j j | ƒ sm | j | ƒ rd t  j | ƒ qm t ‚ n  t	 | d ƒ  } | j
 | ƒ Wd  QXd  S(   NR   (   R   R   t   abspathRF   t   dirnamet   existst
   startswitht   makedirst
   ValueErrorR   R.   (   R   t	   directoryt	   file_namet   contentsR   t   path_dirR4   (    (    s5   /tmp/pip-build-h1VYrz/pbr/pbr/tests/test_packaging.pyt
   _writeFileç   s    !	c         C   s<  |  j  t j ƒ  ƒ j } i  } xû |  j D]ð } t j j | | ƒ } | | | <t j | ƒ xl d d g D]^ } | |  j | k r™ |  j | j | ƒ } n |  j	 | j
 d | ƒ } |  j | | | ƒ qg Wx3 |  j | D]$ } |  j | | |  j | | ƒ q× W|  j  t | ƒ ƒ j ƒ  q( W|  j t |  d ƒ | |  _ | S(   Ns   setup.pys	   setup.cfgt   pkg_namet   package_dirs(   R$   R%   R&   R   RN   R   RF   t   mkdirt   popt   defaultst   formatRY   R   R   RI   RJ   R[   (   R   t   tmpdirR[   RZ   t   pkg_patht   cfRW   (    (    s5   /tmp/pip-build-h1VYrz/pbr/pbr/tests/test_packaging.pyRL   ò   s"    
"	(   R   R   R    t   textwrapt   dedentt   sixt   uR^   R   RY   RL   (    (    (    s5   /tmp/pip-build-h1VYrz/pbr/pbr/tests/test_packaging.pyRM   Ç   s   	
	t    TestPackagingInGitRepoWithCommitc           B   s_   e  Z d  e d  e ƒ f d e d  e ƒ f g Z d „  Z d „  Z d „  Z d „  Z	 d „  Z
 RS(   t   preversionedt   postversionedc         C   s9   t  t |  ƒ j ƒ  |  j t |  j ƒ ƒ } | j ƒ  d  S(   N(   R   Rg   R   R$   R   t   package_dirR   (   R   t   repo(    (    s5   /tmp/pip-build-h1VYrz/pbr/pbr/tests/test_packaging.pyR     s    c         C   s]   |  j  d d t ƒt t j j |  j d ƒ d ƒ  } | j ƒ  } Wd  QX|  j | d ƒ d  S(   Nt   sdistt
   allow_failt   AUTHORSt   rR#   (	   t	   run_setupt   FalseR   R   R   RF   Rj   t   readt   assertNotEqual(   R   R4   t   body(    (    s5   /tmp/pip-build-h1VYrz/pbr/pbr/tests/test_packaging.pyt   test_authors  s    $c         C   s]   |  j  d d t ƒt t j j |  j d ƒ d ƒ  } | j ƒ  } Wd  QX|  j | d ƒ d  S(   NRl   Rm   t	   ChangeLogRo   R#   (	   Rp   Rq   R   R   R   RF   Rj   Rr   Rs   (   R   R4   Rt   (    (    s5   /tmp/pip-build-h1VYrz/pbr/pbr/tests/test_packaging.pyt   test_changelog  s    $c         C   sˆ   |  j  d d t ƒt t j j |  j d ƒ d ƒ  } | j ƒ  } Wd  QX|  j | t	 j
 t	 j d ƒ ƒ ƒ |  j | t	 j d ƒ ƒ d  S(   NRl   Rm   s$   pbr_testpackage.egg-info/SOURCES.txtRo   s   pbr_testpackage/extra.pys   pbr_testpackage/__init__.py(   Rp   Rq   R   R   R   RF   Rj   Rr   t
   assertThatR    t   Nott   Contains(   R   R4   Rt   (    (    s5   /tmp/pip-build-h1VYrz/pbr/pbr/tests/test_packaging.pyt   test_manifest_exclude_honoured"  s    c         C   sH   |  j  d d |  j d d t ƒ\ } } } |  j | t j d ƒ ƒ d  S(   NR9   s   --roott	   installedRm   s   Generating ChangeLog(   Rp   t   temp_dirRq   t
   expectThatR    Rz   (   R   t   stdoutt   _(    (    s5   /tmp/pip-build-h1VYrz/pbr/pbr/tests/test_packaging.pyt   test_install_writes_changelog,  s    (   R   R   t   dictRE   Rq   t	   scenariosR   Ru   Rw   R{   R   (    (    (    s5   /tmp/pip-build-h1VYrz/pbr/pbr/tests/test_packaging.pyRg     s   				
t   TestExtrafileInstallationc           B   s   e  Z d  „  Z RS(   c         C   sa   |  j  d d |  j d d t ƒ\ } } } |  j | t j d ƒ ƒ |  j | t j d ƒ ƒ d  S(   NR9   s   --rootR|   Rm   s   copying data_files/a.txts   copying data_files/b.txt(   Rp   R}   Rq   R~   R    Rz   (   R   R   R€   (    (    s5   /tmp/pip-build-h1VYrz/pbr/pbr/tests/test_packaging.pyt   test_install_glob4  s    (   R   R   R…   (    (    (    s5   /tmp/pip-build-h1VYrz/pbr/pbr/tests/test_packaging.pyR„   3  s   t#   TestPackagingInGitRepoWithoutCommitc           B   s#   e  Z d  „  Z d „  Z d „  Z RS(   c         C   s@   t  t |  ƒ j ƒ  |  j t |  j ƒ ƒ |  j d d t ƒd  S(   NRl   Rm   (   R   R†   R   R$   R   Rj   Rp   Rq   (   R   (    (    s5   /tmp/pip-build-h1VYrz/pbr/pbr/tests/test_packaging.pyR   @  s    c         C   sJ   t  t j j |  j d ƒ d ƒ  } | j ƒ  } Wd  QX|  j d | ƒ d  S(   NRn   Ro   s   
(   R   R   R   RF   Rj   Rr   t   assertEqual(   R   R4   Rt   (    (    s5   /tmp/pip-build-h1VYrz/pbr/pbr/tests/test_packaging.pyRu   E  s    $c         C   sJ   t  t j j |  j d ƒ d ƒ  } | j ƒ  } Wd  QX|  j d | ƒ d  S(   NRv   Ro   s   CHANGES
=======

(   R   R   R   RF   Rj   Rr   R‡   (   R   R4   Rt   (    (    s5   /tmp/pip-build-h1VYrz/pbr/pbr/tests/test_packaging.pyRw   K  s    $(   R   R   R   Ru   Rw   (    (    (    s5   /tmp/pip-build-h1VYrz/pbr/pbr/tests/test_packaging.pyR†   >  s   		t   TestPackagingWheelsc           B   s#   e  Z d  „  Z d „  Z d „  Z RS(   c         C   sÜ   t  t |  ƒ j ƒ  |  j t |  j ƒ ƒ |  j d d t ƒt j	 j
 |  j d ƒ } t j | ƒ d } t j	 j
 | | ƒ } t j j | ƒ } | j j d ƒ } t j	 j
 | | ƒ |  _ | j j |  j ƒ | j j ƒ  d  S(   Nt   bdist_wheelRm   t   disti    t   namever(   R   Rˆ   R   R$   R   Rj   Rp   Rq   R   R   RF   R   R8   R9   t	   WheelFilet   parsed_filenameR,   t   extracted_wheel_dirt   zipfilet
   extractallR   (   R   t   dist_dirt   relative_wheel_filenamet   absolute_wheel_filenamet
   wheel_filet
   wheel_name(    (    s5   /tmp/pip-build-h1VYrz/pbr/pbr/tests/test_packaging.pyR   T  s    	c         C   s„   t  j j |  j d ƒ } |  j t  j j | ƒ ƒ t  j | ƒ } |  j d | ƒ |  j d | ƒ |  j d | ƒ |  j d | ƒ d  S(   Ns    pbr_testpackage-0.0.data/scriptst   pbr_test_wsgit   pbr_test_wsgi_with_classt   pbr_test_cmdt   pbr_test_cmd_with_class(	   R   R   RF   RŽ   t
   assertTrueRQ   R   t   assertInt   assertNotIn(   R   t   scripts_dirt   scripts(    (    s5   /tmp/pip-build-h1VYrz/pbr/pbr/tests/test_packaging.pyt$   test_data_directory_has_wsgi_scriptsf  s    	c         C   sŠ   t  j j |  j d ƒ } d } t ƒ  } | r? d j | ƒ } n  t  j j | | ƒ } |  j t  j j | ƒ ƒ |  j t  j j | ƒ ƒ d  S(   Nt   pbr_testpackages
   testext.sos   testext.{0}.so(   R   R   RF   RŽ   t	   get_soabiR_   Rš   RQ   (   R   t   built_package_dirt   static_object_filenamet   soabit   static_object_path(    (    s5   /tmp/pip-build-h1VYrz/pbr/pbr/tests/test_packaging.pyt   test_generates_c_extensionsr  s    			(   R   R   R   RŸ   R¦   (    (    (    s5   /tmp/pip-build-h1VYrz/pbr/pbr/tests/test_packaging.pyRˆ   R  s   		t   TestPackagingHelpersc           B   s   e  Z d  „  Z d „  Z RS(   c         C   sb   d } t  j d d d d d d ƒ } d } d	 } t j | | | | ƒ } d
 } |  j | | ƒ d  S(   Nt   console_scriptst   names   test-ept   module_names   pbr.packagingt   attrst   LocalInstallScriptss   #!/usr/bin/env fake-header
s=   %(group)s %(module_name)s %(import_target)s %(invoke_target)ss`   #!/usr/bin/env fake-header
console_scripts pbr.packaging LocalInstallScripts LocalInstallScripts(   R¬   (   t   pkg_resourcest
   EntryPointR   t   generate_scriptR‡   (   R   R,   t   entry_pointt   headert   templatet   generated_scriptt   expected_script(    (    s5   /tmp/pip-build-h1VYrz/pbr/pbr/tests/test_packaging.pyt   test_generate_script‚  s    		c      	   C   sŠ   d } t  j d d d d ƒ } d } d } |  j t t j | | | | ƒ t  j d d d d d d ƒ } |  j t t j | | | | ƒ d  S(   NR¨   R©   s   test-epRª   s   pbr.packagings   #!/usr/bin/env fake-header
s=   %(group)s %(module_name)s %(import_target)s %(invoke_target)sR«   t   attr1t   attr2t   attr3(   R¶   R·   R¸   (   R­   R®   t   assertRaisesRT   R   R¯   (   R   R,   R°   R±   R²   (    (    s5   /tmp/pip-build-h1VYrz/pbr/pbr/tests/test_packaging.pyt+   test_generate_script_validates_expectations•  s     				(   R   R   Rµ   Rº   (    (    (    s5   /tmp/pip-build-h1VYrz/pbr/pbr/tests/test_packaging.pyR§   €  s   	t   TestPackagingInPlainDirectoryc           B   s,   e  Z d  „  Z d „  Z d „  Z d „  Z RS(   c         C   s   t  t |  ƒ j ƒ  d  S(   N(   R   R»   R   (   R   (    (    s5   /tmp/pip-build-h1VYrz/pbr/pbr/tests/test_packaging.pyR   ¬  s    c         C   sH   |  j  d d t ƒt j j |  j d ƒ } |  j t j j | ƒ ƒ d  S(   NRl   Rm   Rn   (   Rp   Rq   R   R   RF   Rj   t   assertFalseRQ   (   R   t   filename(    (    s5   /tmp/pip-build-h1VYrz/pbr/pbr/tests/test_packaging.pyRu   ¯  s    c         C   sH   |  j  d d t ƒt j j |  j d ƒ } |  j t j j | ƒ ƒ d  S(   NRl   Rm   Rv   (   Rp   Rq   R   R   RF   Rj   R¼   RQ   (   R   R½   (    (    s5   /tmp/pip-build-h1VYrz/pbr/pbr/tests/test_packaging.pyRw   µ  s    c         C   sQ   |  j  d d |  j d d t ƒ\ } } } |  j | t j t j d ƒ ƒ ƒ d  S(   NR9   s   --rootR|   Rm   s   Generating ChangeLog(   Rp   R}   Rq   R~   R    Ry   Rz   (   R   R   R€   (    (    s5   /tmp/pip-build-h1VYrz/pbr/pbr/tests/test_packaging.pyt   test_install_no_ChangeLog»  s
    (   R   R   R   Ru   Rw   R¾   (    (    (    s5   /tmp/pip-build-h1VYrz/pbr/pbr/tests/test_packaging.pyR»   ª  s   			t   TestPresenceOfGitc           B   s   e  Z d  „  Z d „  Z RS(   c         C   sA   t  j j t d ƒ & } d | _ |  j t t j ƒ  ƒ Wd  QXd  S(   Nt   _run_shell_commands   git version 1.8.4.1(   t   mockt   patcht   objectR   t   return_valueR‡   RE   t   _git_is_installed(   R   t   _command(    (    s5   /tmp/pip-build-h1VYrz/pbr/pbr/tests/test_packaging.pyt   testGitIsInstalledÅ  s    	c         C   sA   t  j j t d ƒ & } t | _ |  j t t j ƒ  ƒ Wd  QXd  S(   NRÀ   (	   RÁ   RÂ   RÃ   R   t   OSErrort   side_effectR‡   Rq   RÅ   (   R   RÆ   (    (    s5   /tmp/pip-build-h1VYrz/pbr/pbr/tests/test_packaging.pyt   testGitIsNotInstalledË  s    	(   R   R   RÇ   RÊ   (    (    (    s5   /tmp/pip-build-h1VYrz/pbr/pbr/tests/test_packaging.pyR¿   Ã  s   	t   TestNestedRequirementsc           B   s   e  Z d  „  Z RS(   c         C   s­   t  j ƒ  } t j j | d ƒ } t j j | d ƒ } t | d ƒ  } | j d | ƒ Wd  QXt | d ƒ  } | j d ƒ Wd  QXt j | g ƒ } |  j	 d g | ƒ d  S(   Ns   requirements.txts
   nested.txtt   ws   -r R?   (
   t   tempfilet   mkdtempR   R   RF   R   R.   R   t   parse_requirementsR‡   (   R   R/   t   requirementst   nestedR4   t   result(    (    s5   /tmp/pip-build-h1VYrz/pbr/pbr/tests/test_packaging.pyt   test_nested_requirementÔ  s    (   R   R   RÓ   (    (    (    s5   /tmp/pip-build-h1VYrz/pbr/pbr/tests/test_packaging.pyRË   Ò  s   t   TestVersionsc           B   sæ   e  Z d  e d  e ƒ f d e d  e ƒ f g 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 d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z RS(   Rh   Ri   c         C   s[   t  t |  ƒ j ƒ  |  j t |  j ƒ ƒ |  _ |  j t ƒ  ƒ |  j t j	 |  j ƒ ƒ d  S(   N(
   R   RÔ   R   R$   R   Rj   Rk   R!   R   t   DiveDir(   R   (    (    s5   /tmp/pip-build-h1VYrz/pbr/pbr/tests/test_packaging.pyR   ç  s    c         C   s   t  j ƒ  } t  j d | ƒ N t  j d ƒ 8 } t j j d ƒ i d d 6g | _ t j d ƒ } Wd  QXWd  QX|  j	 | j
 ƒ |  j | ƒ d  S(   Ns   pbr.packaging.opens   email.message_from_filet   TestR    t   Name(   RÁ   t	   mock_openRÂ   t   emailt   errorst   MessageErrorRÉ   R   t   _get_version_from_pkg_metadataRš   t   calledt   assertIsNone(   R   t   mocked_opent   message_from_fileR   (    (    s5   /tmp/pip-build-h1VYrz/pbr/pbr/tests/test_packaging.pyt%   test_email_parsing_errors_are_handledí  s    c         C   sV   |  j  j ƒ  |  j  j d ƒ |  j  j d ƒ t j ƒ  } |  j | t j d ƒ ƒ d  S(   Ns   1.2.3s   Sem-Ver: api-breaks
   2.0.0.dev1(   Rk   R   R   R   t   _get_version_from_gitRx   R    t
   StartsWith(   R   R   (    (    s5   /tmp/pip-build-h1VYrz/pbr/pbr/tests/test_packaging.pyt   test_capitalized_headersú  s
    c         C   sV   |  j  j ƒ  |  j  j d ƒ |  j  j d ƒ t j ƒ  } |  j | t j d ƒ ƒ d  S(   Ns   1.2.3s   Sem-ver: api-breaks
   2.0.0.dev1(   Rk   R   R   R   Râ   Rx   R    Rã   (   R   R   (    (    s5   /tmp/pip-build-h1VYrz/pbr/pbr/tests/test_packaging.pyt    test_capitalized_headers_partial  s
    c         C   s@   |  j  j ƒ  |  j  j d ƒ t j d ƒ } |  j d | ƒ d  S(   Ns   1.2.3(   Rk   R   R   R   Râ   R‡   (   R   R   (    (    s5   /tmp/pip-build-h1VYrz/pbr/pbr/tests/test_packaging.pyt#   test_tagged_version_has_tag_version  s    c         C   sV   |  j  j ƒ  |  j  j d ƒ |  j  j d ƒ t j ƒ  } |  j | t j d ƒ ƒ d  S(   Ns   1.4s   Sem-Ver: api-breaks
   2.0.0.dev1(   Rk   R   R   R   Râ   Rx   R    Rã   (   R   R   (    (    s5   /tmp/pip-build-h1VYrz/pbr/pbr/tests/test_packaging.pyt&   test_non_canonical_tagged_version_bump  s
    c         C   sS   |  j  j ƒ  |  j  j d ƒ |  j  j ƒ  t j ƒ  } |  j | t j d ƒ ƒ d  S(   Ns   1.2.3s
   1.2.4.dev1(   Rk   R   R   R   Râ   Rx   R    Rã   (   R   R   (    (    s5   /tmp/pip-build-h1VYrz/pbr/pbr/tests/test_packaging.pyt1   test_untagged_version_has_dev_version_postversion  s
    c         C   sS   |  j  j ƒ  |  j  j d ƒ |  j  j ƒ  t j ƒ  } |  j | t j d ƒ ƒ d  S(   Ns	   1.2.3.0a1s   1.2.3.0a2.dev1(   Rk   R   R   R   Râ   Rx   R    Rã   (   R   R   (    (    s5   /tmp/pip-build-h1VYrz/pbr/pbr/tests/test_packaging.pyt9   test_untagged_pre_release_has_pre_dev_version_postversion  s
    c         C   sV   |  j  j ƒ  |  j  j d ƒ |  j  j d ƒ t j ƒ  } |  j | t j d ƒ ƒ d  S(   Ns   1.2.3s   sem-ver: deprecations
   1.3.0.dev1(   Rk   R   R   R   Râ   Rx   R    Rã   (   R   R   (    (    s5   /tmp/pip-build-h1VYrz/pbr/pbr/tests/test_packaging.pyt    test_untagged_version_minor_bump#  s
    c         C   sV   |  j  j ƒ  |  j  j d ƒ |  j  j d ƒ t j ƒ  } |  j | t j d ƒ ƒ d  S(   Ns   1.2.3s   sem-ver: api-breaks
   2.0.0.dev1(   Rk   R   R   R   Râ   Rx   R    Rã   (   R   R   (    (    s5   /tmp/pip-build-h1VYrz/pbr/pbr/tests/test_packaging.pyt    test_untagged_version_major_bump*  s
    c         C   sV   |  j  j ƒ  |  j  j d ƒ |  j  j ƒ  t j d ƒ } |  j | t j d ƒ ƒ d  S(   Ns   1.2.3s   1.2.5s
   1.2.5.dev1(   Rk   R   R   R   Râ   Rx   R    Rã   (   R   R   (    (    s5   /tmp/pip-build-h1VYrz/pbr/pbr/tests/test_packaging.pyt0   test_untagged_version_has_dev_version_preversion1  s
    c         C   sV   |  j  j ƒ  |  j  j d ƒ |  j  j ƒ  t j d ƒ } |  j | t j d ƒ ƒ d  S(   Ns	   1.2.3.0a1s   1.2.5s
   1.2.5.dev1(   Rk   R   R   R   Râ   Rx   R    Rã   (   R   R   (    (    s5   /tmp/pip-build-h1VYrz/pbr/pbr/tests/test_packaging.pyt:   test_untagged_version_after_pre_has_dev_version_preversion8  s
    c         C   sV   |  j  j ƒ  |  j  j d ƒ |  j  j ƒ  t j d ƒ } |  j | t j d ƒ ƒ d  S(   Ns	   1.2.3.0a1s   1.2.3s   1.2.3.0a2.dev1(   Rk   R   R   R   Râ   Rx   R    Rã   (   R   R   (    (    s5   /tmp/pip-build-h1VYrz/pbr/pbr/tests/test_packaging.pyt9   test_untagged_version_after_rc_has_dev_version_preversion?  s
    c         C   sf   |  j  j ƒ  |  j  j d ƒ |  j  j ƒ  |  j t t j d ƒ } |  j | j d t	 j
 d ƒ ƒ d  S(   Ns   1.2.3i    s   git history(   Rk   R   R   R¹   RT   R   Râ   Rx   t   argsR    Rã   (   R   t   err(    (    s5   /tmp/pip-build-h1VYrz/pbr/pbr/tests/test_packaging.pyt   test_preversion_too_low_simpleF  s    c         C   si   |  j  j ƒ  |  j  j d ƒ |  j  j d ƒ |  j t t j d ƒ } |  j | j d t	 j
 d ƒ ƒ d  S(   Ns   1.2.3s   sem-ver: features   1.2.4i    s   git history(   Rk   R   R   R¹   RT   R   Râ   Rx   Rï   R    Rã   (   R   Rð   (    (    s5   /tmp/pip-build-h1VYrz/pbr/pbr/tests/test_packaging.pyt&   test_preversion_too_low_semver_headersR  s    c            sY   ˆ j  j d ‰ ‡ f d †  ‰  ‡  ‡ f d †  } | d ƒ ˆ j  j d ƒ | d ƒ d  S(   Ns   /.gitc            s   t  j ˆ  |  ƒ S(   N(   R   t   _get_increment_kwargs(   R   (   t   git_dir(    s5   /tmp/pip-build-h1VYrz/pbr/pbr/tests/test_packaging.pyt   <lambda>a  s    c            s/  ˆ j  j ƒ  ˆ j t ƒ  ˆ  |  ƒ ƒ ˆ j  j d ƒ ˆ j t ƒ  ˆ  |  ƒ ƒ ˆ j  j d ƒ ˆ j t d t ƒ ˆ  |  ƒ ƒ ˆ j  j ƒ  ˆ j  j d ƒ ˆ j t d t ƒ ˆ  |  ƒ ƒ ˆ j  j ƒ  ˆ j  j d ƒ ˆ j t d t ƒ ˆ  |  ƒ ƒ ˆ j  j d ƒ ˆ j t d t d t ƒ ˆ  |  ƒ ƒ d  S(   Ns   sem-ver: bugfixs   sem-ver: featuret   minors   sem-ver: deprecations   sem-ver: api-breakt   major(   Rk   R   R‡   R‚   RE   R   (   R   (   t
   get_kwargsR   (    s5   /tmp/pip-build-h1VYrz/pbr/pbr/tests/test_packaging.pyt   _check_combinationsc  s    R#   s   1.2.3(   Rk   R   R   (   R   Rù   (    (   Rø   Rô   R   s5   /tmp/pip-build-h1VYrz/pbr/pbr/tests/test_packaging.pyt   test_get_kwargs_corner_cases^  s    
c         C   s  |  j  j ƒ  |  j  j d ƒ |  j  j ƒ  |  j  j d ƒ t j ƒ  } |  j | t j d ƒ ƒ |  j  j ƒ  t j ƒ  } |  j | t j d ƒ ƒ |  j  j ƒ  |  j  j d ƒ |  j  j ƒ  |  j  j d ƒ t j ƒ  } |  j | t j d ƒ ƒ |  j  j ƒ  |  j  j d ƒ |  j  j ƒ  |  j  j d	 ƒ t j ƒ  } |  j | t j d
 ƒ ƒ |  j  j ƒ  |  j  j d ƒ |  j  j ƒ  |  j  j d ƒ t j ƒ  } |  j | t j d ƒ ƒ |  j  j ƒ  |  j  j d ƒ |  j  j ƒ  |  j  j d ƒ t j ƒ  } |  j | t j d ƒ ƒ d  S(   Nt   1t   badvers
   1.0.1.dev1s
   1.0.1.dev2s   1.2t   badver2s
   1.2.1.dev1s   1.2.3t   badver3s
   1.2.4.dev1s	   1.2.4.0a1t   badver4s   1.2.4.0a2.dev1t   2s   non-release-tag/2014.12.16-1s
   2.0.1.dev1(   Rk   R   R   R   Râ   Rx   R    Rã   (   R   R   (    (    s5   /tmp/pip-build-h1VYrz/pbr/pbr/tests/test_packaging.pyt   test_invalid_tag_ignoredv  sB    c         C   s=   |  j  j ƒ  |  j  j d ƒ t j ƒ  } |  j d | ƒ d  S(   Ns	   1.3.0.0a1(   Rk   R   R   R   Râ   R‡   (   R   R   (    (    s5   /tmp/pip-build-h1VYrz/pbr/pbr/tests/test_packaging.pyt   test_valid_tag_honoured¡  s    c         C   sM   |  j  j ƒ  |  j  j d ƒ d t j d <t j d ƒ } |  j d | ƒ d  S(   Ns   1.2.3Rû   t   SKIP_WRITE_GIT_CHANGELOG(   Rk   R   R   R   t   environR   Râ   R‡   (   R   R   (    (    s5   /tmp/pip-build-h1VYrz/pbr/pbr/tests/test_packaging.pyt   test_skip_write_git_changelogª  s
    c         C   s*   t  t |  ƒ j ƒ  t j j d d  ƒ d  S(   NR  (   R   RÔ   t   tearDownR   R  R]   R-   (   R   (    (    s5   /tmp/pip-build-h1VYrz/pbr/pbr/tests/test_packaging.pyR  ²  s    (   R   R   R‚   RE   Rq   Rƒ   R   Rá   Rä   Rå   Ræ   Rç   Rè   Ré   Rê   Rë   Rì   Rí   Rî   Rñ   Rò   Rú   R  R  R  R  (    (    (    s5   /tmp/pip-build-h1VYrz/pbr/pbr/tests/test_packaging.pyRÔ   à  s,   																	+			t   TestRequirementParsingc           B   s   e  Z d  „  Z RS(   c         C   s5  i i t  j d ƒ d 6t  j d ƒ d 6d 6} |  j t | ƒ ƒ j } | d } i d d g d  6d g d	 6d
 d g d 6d g d 6d d g d 6} |  j t d ƒ ƒ } | j } |  j | d d t	 d | ƒt
 j j | d ƒ } t
 j j | d ƒ } t | d ƒ  }	 t t j |	 ƒ ƒ }
 Wd  QX|  j | |
 ƒ d  S(   NsD                          bar
                        quux<1.0; python_version=='2.6'
                        requests-aws>=0.1.4    # BSD License (3 clause)
                        Routes>=1.12.3,!=2.0,!=2.1;python_version=='2.7'
                        requests-kerberos>=0.6;python_version=='2.7' # MIT
                    s   requirements.txtsP                          [metadata]
                        name = test_reqparse

                        [extras]
                        test =
                            foo
                            baz>3.2 :python_version=='2.7' # MIT
                            bar>3.3 :python_version=='2.7' # MIT # Apache
                    s	   setup.cfgt   test_reqparset   bars   requests-aws>=0.1.4s   quux<1.0s   :(python_version=='2.6')s   Routes>=1.12.3,!=2.0,!=2.1s   requests-kerberos>=0.6s   :(python_version=='2.7')t   foot   tests   baz>3.2s   bar>3.3s   test:(python_version=='2.7')t   reqParses   setup.pyR‰   Rm   t   cwds   test_reqparse.egg-infos   requires.txtt   rt(   s   setup.pys   bdist_wheel(   Rc   Rd   R$   RM   R[   R-   R6   RB   R   Rq   R   R   RF   R   R‚   R­   t   split_sectionsR‡   (   R   t   pkgst   pkg_dirst   pkg_dirt   expected_requirementst   venvt
   bin_pythont   egg_infot   requires_txtt   requirest   generated_requirements(    (    s5   /tmp/pip-build-h1VYrz/pbr/pbr/tests/test_packaging.pyt   test_requirement_parsing¹  s2    
	



	(   R   R   R  (    (    (    s5   /tmp/pip-build-h1VYrz/pbr/pbr/tests/test_packaging.pyR  ·  s   c          C   sç   d  }  y" t j d ƒ }  t j d ƒ } Wn t k
 r; n X|  rm | rm d t j ƒ  k rm d |  | f }  n  |  d  k rã d t j ƒ  k rã xU t j ƒ  D]D \ } } } | j d ƒ r˜ | j d ƒ r˜ | j	 d ƒ d }  Pq˜ q˜ Wn  |  S(	   Nt   SOABIt	   MULTIARCHt   pypys   %s-%ss   .pypys   .soR   i   (
   R-   t	   sysconfigt   get_config_vart   IOErrort   get_scheme_namest   impt   get_suffixesRR   t   endswithR)   (   R¤   t   archt   suffixR€   (    (    s5   /tmp/pip-build-h1VYrz/pbr/pbr/tests/test_packaging.pyR¡   ì  s    (-   RÙ   t   email.errorsR"  R   R'   R  RÍ   Rc   R%   RÁ   R­   Re   t	   testtoolsR    RC   t   wheel.installR8   R?   R   R   t	   pbr.testsR   R   RO   RF   t   __file__R;   t   FixtureR   R!   R6   RM   t   BaseTestCaseRg   R„   R†   Rˆ   t   TestCaseR§   R»   R¿   RË   RÔ   R  R¡   (    (    (    s5   /tmp/pip-build-h1VYrz/pbr/pbr/tests/test_packaging.pyt   <module>)   sD   '!8+A+.*×5