
|W                 @   s   d  d l  Z d  d l j j 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   Z Gd d   d e  Z Gd d	   d	  Z d
 d   Z d S)    N)InfoSvnCommand)CommonSvnTestsc             C   s(   |  j  d  \ } } } t j j |  S)NZrepowc1)getfuncargvaluepypathsvnurl)requestreporepourlwc r   >/home/ronny/Projects/pytest-dev/py/testing/path/test_svnurl.pypytest_funcarg__path1   s    r   c                   s   e  Z d  Z e j j j   f d d    Z   f d d   Z   f d d   Z	 d d   Z
 d	 d
   Z d d   Z d d   Z d d   Z d d   Z d d   Z e j j j d  d d    Z d d   Z   S)TestSvnURLCommandPathc                s   t  t |   j |  d  S)N)superr   	test_load)selfpath1)	__class__r   r   r      s    zTestSvnURLCommandPath.test_loadc                s   t  t |   j |  d  S)N)r   r   test_listdir)r   r   )r   r   r   r      s    z"TestSvnURLCommandPath.test_listdirc                s   t  t |   j |  d  S)N)r   r   test_visit_ignore)r   r   )r   r   r   r      s    z'TestSvnURLCommandPath.test_visit_ignorec             C   s   t  j j t d  d  S)Nzpy.path.svnurl())r   testraises	TypeError)r   r   r   r   r   test_svnurl_needs_arg   s    z+TestSvnURLCommandPath.test_svnurl_needs_argc             C   s   t  j j t d  d  S)Nzpy.path.svnurl(None))r   r   r   	Exception)r   r   r   r   r   'test_svnurl_does_not_accept_None_either   s    z=TestSvnURLCommandPath.test_svnurl_does_not_accept_None_eitherc             C   s   t  j j d  d  S)Nzsvn+ssh://hello/world)r   r   r   )r   r   r   r   r   test_svnurl_characters_simple   s    z3TestSvnURLCommandPath.test_svnurl_characters_simplec             C   s   t  j j d  d  S)Nzhttp://user@host.com/some/dir)r   r   r   )r   r   r   r   r   test_svnurl_characters_at_user   s    z4TestSvnURLCommandPath.test_svnurl_characters_at_userc             C   s   t  j j t d  d  S)Nz)py.path.svnurl("http://host.com/foo@bar"))r   r   r   
ValueError)r   r   r   r   r   test_svnurl_characters_at_path"   s    z4TestSvnURLCommandPath.test_svnurl_characters_at_pathc             C   s   t  j j d  d  S)Nzhttp://host.com:8080/some/dir)r   r   r   )r   r   r   r   r   !test_svnurl_characters_colon_port%   s    z7TestSvnURLCommandPath.test_svnurl_characters_colon_portc             C   s   t  j j d  d  S)Nzhttp://host.com/some/file~)r   r   r   )r   r   r   r   r    test_svnurl_characters_tilde_end(   s    z6TestSvnURLCommandPath.test_svnurl_characters_tilde_endzsys.platform == 'win32'c             C   s   t  j j t d  d  S)Nz)py.path.svnurl("http://host.com/foo:bar"))r   r   r   r   )r   r   r   r   r   !test_svnurl_characters_colon_path+   s    z7TestSvnURLCommandPath.test_svnurl_characters_colon_pathc             C   s  | j  d  } | j |  } | | k } | s t j d | f d | | f  d d t j   k sr t j |  r t j |  n d d d t j   k s t j |  r t j |  n d i } d d
 | i } t t j	 |    d  } d d   | j
   D } d d   | j
   D } | j   | j   | | k } | st j d | f d  | | f  d d t j   k st j |  rt j |  n d d d t j   k st j |  rt j |  n d i } d! d
 | i } t t j	 |    d  } | j  } d }	 | |	  }
 |
 j } |   } | } | sd d d t j |
  d d t j   k stt j |  rt j |  n d d t j |  d
 t j |	  d t j |  d t j |  i } t t j	 |    d  } }	 }
 } } } | j d  } | j   | j } |   }	 |	 }
 |
 sd d d d t j   k s[t j |  rjt j |  n d d t j |  d
 t j |	  i } t t j	 |    d  } }	 }
 | j d d  j |  x | j
   D] } | j } | | k }	 |	 st j d" |	 f d# | | f  d d t j   k s>t j |  rMt j |  n d d t j |  d
 d t j   k st j |  rt j |  n d i } d$ d | i } t t j	 |    d  } }	 qWd  S)%Nempty==%(py0)s == %(py2)spy0ppy2tmpdir assert %(py4)spy4c             S   s   g  |  ] } | j   q Sr   )basename).0xr   r   r   
<listcomp>6   s   	 z5TestSvnURLCommandPath.test_export.<locals>.<listcomp>c             S   s   g  |  ] } | j   q Sr   )r.   )r/   r0   r   r   r   r1   7   s   	 n1n2z.svnz~assert not %(py10)s
{%(py10)s = %(py8)s
{%(py8)s = %(py6)s
{%(py6)s = %(py2)s
{%(py2)s = %(py0)s.join
}(%(py4)s)
}.check
}()
}py6py10py8newdirzDassert not %(py4)s
{%(py4)s = %(py2)s
{%(py2)s = %(py0)s.check
}()
}rev   in0%(py2)s
{%(py2)s = %(py0)s.basename
} in %(py4)sassert %(py6)s)r%   )r&   r,   )r%   )r&   r,   )r:   )r;   r<   )joinexport
@pytest_ar_call_reprcompare@py_builtinslocals_should_repr_global_name	_safereprAssertionError_format_explanationlistdirsortcheckmkdirremovenewr.   )r   r   r*   r(   @py_assert1@py_format3@py_format5r2   r3   @py_assert3@py_assert5@py_assert7@py_assert9@py_assert11@py_format12r8   @py_format6@py_format7r   r   r   test_export2   s\         

     	   	 	     
	 	   b  	      z!TestSvnURLCommandPath.test_export)__name__
__module____qualname__r   r   markxfailr   r   r   r   r   r   r   r    r!   r"   r#   rX   r   r   )r   r   r      s   !!r   c               @   s4   e  Z d  Z d d   Z d d   Z d d   Z d S)TestSvnInfoCommandc             C   s0  d } t  |  } t j j   } | j } d } | | k } | s t j d# | f d$ | | f  d d t j   k s t j |  r t j	 |  n d d t j	 |  d t j	 |  i } d% d | i } t
 t j |    d  } } } | j } d } | | k } | st j d& | f d' | | f  d d t j   k sQt j |  r`t j	 |  n d d t j	 |  d t j	 |  i } d( d | i } t
 t j |    d  } } } | j } d } | | k } | szt j d) | f d* | | f  d d t j   k st j |  r-t j	 |  n d d t j	 |  d t j	 |  i } d+ d | i } t
 t j |    d  } } } t j | j  d d  }	 d, } |	 | k }
 |
 s$t j d- |
 f d. |	 | f  d t j	 |	  d t j	 |  i } d/ d | i } t
 t j |    d  }	 }
 } | j } d } | | k } | st j d0 | f d1 | | f  d d t j   k st j |  rt j	 |  n d d t j	 |  d t j	 |  i } d2 d | i } t
 t j |    d  } } } | j } | j } d } | | } | | k } | st j d3 | f d4 | | f  d  t j	 |  d t j	 |  d d t j   k st j |  rt j	 |  n d d t j	 |  d d t j   k st j |  rt j	 |  n d i } d5 d" | i } t
 t j |    d  } } } } } d  S)6Nz4   2256      hpk        165 Nov 24 17:55 __init__.pyhpkr%   3%(py2)s
{%(py2)s = %(py0)s.last_author
} == %(py5)sr'   infopy5r)   r+   assert %(py7)spy7i  3%(py2)s
{%(py2)s = %(py0)s.created_rev
} == %(py5)sfile,%(py2)s
{%(py2)s = %(py0)s.kind
} == %(py5)sr9               7   r   %(py1)s == %(py4)spy1r-   assert %(py6)sr4      ,%(py2)s
{%(py2)s = %(py0)s.size
} == %(py5)si@B S%(py2)s
{%(py2)s = %(py0)s.time
} == (%(py6)s
{%(py6)s = %(py4)s.mtime
} * %(py8)s)r6   assert %(py11)spy11)r%   )r`   rc   )r%   )re   rc   )r%   )rg   rc   )ri   rj   rk   rl   r   )r%   )rm   ro   )r%   )rq   rc   )r%   )rr   rs   )r   datetimenowlast_authorr?   r@   rA   rB   rC   rD   rE   rF   created_revkindtimegmtimemtimesize)r   linera   rv   rM   @py_assert4rP   rV   @py_format8@py_assert0@py_assert2rO   rW   rQ   rR   rS   @py_format10rU   r   r   r   test_svn_1_2E   sj    	    y   	    y   	    y       C   	    y   	 	  
      zTestSvnInfoCommand.test_svn_1_2c             C   s  d } t  |  } | j } d } | | k } | s t j d | f d | | f  d d t j   k su t j |  r t j |  n d d t j |  d t j |  i } d d | i } t t j	 |    d  } } } | j
 } d } | | k } | st j d | f d | | f  d d t j   k sBt j |  rQt j |  n d d t j |  d t j |  i } d d | i } t t j	 |    d  } } } d  S)Nz7    4784 hpk                 2 Jun 01  2004 __init__.pyr_   r%   3%(py2)s
{%(py2)s = %(py0)s.last_author
} == %(py5)sr'   ra   rb   r)   r+   assert %(py7)srd   rf   ,%(py2)s
{%(py2)s = %(py0)s.kind
} == %(py5)s)r%   )r   r   )r%   )r   r   )r   rw   r?   r@   rA   rB   rC   rD   rE   rF   ry   )r   r~   ra   rM   r   rP   rV   r   r   r   r   test_svn_1_3R   s$    	    y   	    y   zTestSvnInfoCommand.test_svn_1_3c             C   s  d } t  |  } | j } d } | | k } | s t j d | f d | | f  d d t j   k su t j |  r t j |  n d d t j |  d t j |  i } d d | i } t t j	 |    d  } } } | j
 } d } | | k } | st j d | f d | | f  d d t j   k sBt j |  rQt j |  n d d t j |  d t j |  i } d d | i } t t j	 |    d  } } } d  S)Nz>     74 autoadmi              Oct 06 23:59 plonesolutions.com/Zautoadmir%   3%(py2)s
{%(py2)s = %(py0)s.last_author
} == %(py5)sr'   ra   rb   r)   r+   assert %(py7)srd   dir,%(py2)s
{%(py2)s = %(py0)s.kind
} == %(py5)s)r%   )r   r   )r%   )r   r   )r   rw   r?   r@   rA   rB   rC   rD   rE   rF   ry   )r   r~   ra   rM   r   rP   rV   r   r   r   r   test_svn_1_3_bX   s$    	    y   	    y   z!TestSvnInfoCommand.test_svn_1_3_bN)rY   rZ   r[   r   r   r   r   r   r   r   r^   C   s   r^   c               C   s   t  j j t d  d  S)Nz&py.path.svnurl('http://host/tmp/@@@:'))r   r   r   r   r   r   r   r   test_badchars^   s    r   )builtinsrA   _pytest.assertion.rewrite	assertionrewriter?   r   Zpy._path.svnurlr   ru   rz   svntestbaser   r   r   r^   r   r   r   r   r   <module>   s     8