U
    5d                     @   sh   d Z ddlZddlZddlmZ ddlZddlmZmZ ddlm	Z
 ddlmZmZ ejjd	d
 ZdS )z;
Test the entire process of creating a Pooch and using it.
    N)Path   )createos_cache)__version__   )check_tiny_datacapture_logc               
   C   s   t d} |  rtt|  t| dtddd}|j r>t|	t
tjtdd dD ]}t (}||}|  d	 d
kstW 5 Q R X t| t|d}|d W 5 Q R X t (}||}|  d	 dkstW 5 Q R X t| q\dS )z(Fetch a data file from the local storagezpooch-testingz5https://github.com/fatiando/pooch/raw/{version}/data/mainZPOOCH_DATA_DIR)pathbase_urlversionZversion_devenvdatazregistry.txt)ztiny-data.txtzsubdir/tiny-data.txtr   ZDownloadingwzThe data is now differentZUpdatingN)r   existsshutilrmtreestrr   full_versionabspathAssertionErrorZload_registryr   osr   dirname__file__r	   fetchgetvaluesplitr   openwrite)r   ZpuptargetZlog_filefnameZfin r"   @/tmp/pip-unpacked-wheel-nxrj6sbx/pooch/tests/test_integration.pytest_create_and_fetch   s.    
"
"r$   )__doc__r   r   pathlibr   Zpytest r   r   r   r   utilsr   r	   marknetworkr$   r"   r"   r"   r#   <module>   s   