3
qd	                 @   sp   d dl Z d dlZd dljZd dlmZ ejdd Zejdd Z	ejdd Z
ejd	d
 Zejdd ZdS )    N)read_csvc             C   s   | ddddS )zPath to the tips datasetiodatacsvztips.csv )datapathr   r   :/tmp/pip-build-7vycvbft/pandas/pandas/tests/io/conftest.py	tips_file
   s    r	   c             C   s   | ddddS )zPath to a JSONL datasetr   parserr   zitems.jsonlr   )r   r   r   r   
jsonl_file   s    r   c             C   s   t | ddddddS )z#DataFrame with the salaries datasetr   r
   r   zsalaries.csv	)sep)r   )r   r   r   r   salaries_table   s    r   c             C   s   | ddddS )Nr   r   Zfeatherzfeather-0_3_1.featherr   )r   r   r   r   feather_file   s    r   c       	      #   s   t jd}t jd}tj  tjjdd tjjdd t jd}d| fd	| fd
| d fd| d fd|fd|fg fdd}z`|j }|j  d}|j	ddd  j
|d ||  j
ddd |d |jj   V  W d|j  X W dQ R X dS )a4  
    Fixture for mocking S3 interaction.

    The primary bucket name is "pandas-test". The following datasets
    are loaded.

    - tips.csv
    - tips.csv.gz
    - tips.csv.bz2
    - items.jsonl

    A private bucket "cant_get_it" is also created. The boto3 s3 resource
    is yielded by the fixture.
    s3fsboto3ZAWS_ACCESS_KEY_IDZ
foobar_keyZAWS_SECRET_ACCESS_KEYZfoobar_secretmotoz
tips#1.csvztips.csvztips.csv.gzz.gzztips.csv.bz2z.bz2zitems.jsonlzsimple_dataset.featherc                s@   x:D ]2\}}t |d} j| j||d W d Q R X qW d S )Nrb)ZKeyZBody)openBucketZ
put_object)Zbucket_nameZs3_key	file_namef)conntest_s3_filesr   r   add_tips_filesE   s    z#s3_resource.<locals>.add_tips_fileszpandas-tests3z	us-east-1)Zregion_name)r   Zcant_get_itZprivate)r   ZACLN)pytestZimportorskiptmZ!ensure_safe_environment_variablesosenviron
setdefaultZmock_s3startresourceZcreate_bucketZS3FileSystemZclear_instance_cachestop)	r	   r   r   r   r   r   r   r   Zbucketr   )r   r   r   s3_resource!   s2    








r$   )r   r   Zpandas._testingZ_testingr   Zpandas.io.parsersr   Zfixturer	   r   r   r   r$   r   r   r   r   <module>   s   
