o
    Ni                     @   sj   d dl Z d dlZd dlZd dlmZ d dlmZ G dd dejZG dd dejZ	G dd	 d	ejZ
dS )
    N)matchers)basec                   @      e Zd Zdd ZdS )TestExtraFilesc                 C   sr   |  dd\}}}zttjddd }W n ty"   J dw t|}dd	 | D }| 	d
| dS )z.Test that the extra files are correctly added.sdist--formats=gztardist*.tar.gzr   Fzsource dist not foundc                 S   $   g | ]}d  |d dd qS /   Njoinsplit.0p r   Y/home/ubuntu/.local/lib/python3.10/site-packages/pbr/tests/functional/test_extra_files.py
<listcomp>@      $ z9TestExtraFiles.test_sdist_extra_files.<locals>.<listcomp>zextra-file.txtN)
	run_setupglobospathr   
IndexErrortarfileopengetnamesassertInselfstdout_return_codetf_pathtfnamesr   r   r   test_sdist_extra_files4   s   
z%TestExtraFiles.test_sdist_extra_filesN)__name__
__module____qualname__r)   r   r   r   r   r   2       r   c                   @   r   )TestDataFilesc                 C   sF   | j dd| jd dd\}}}| |td | |td d S )Ninstallz--root	installedF)
allow_failzcopying data_files/a.txtzcopying data_files/b.txt)r   temp_dir
expectThatr   Contains)r"   r#   r$   r   r   r   test_install_globG   s
   zTestDataFiles.test_install_globN)r*   r+   r,   r5   r   r   r   r   r.   E   r-   r.   c                       s$   e Zd Z fddZdd Z  ZS )TestExtraFilesWithGitc                    sV   t t|   | dd\}}}|r| d | dd\}}}| dd\}}}d S )Ngit)initzgit not installed)add.)commitz-mzTurn this into a git repo)superr6   setUp_run_cmdskipTest)r"   r#   r$   r%   	__class__r   r   r=   Q   s   
zTestExtraFilesWithGit.setUpc                 C   sV   |  dd\}}}ttjddd }t|}dd | D }| d| d	S )
z7Test that extra files found in git are correctly added.r   r   r   r	   r   c                 S   r
   r   r   r   r   r   r   r   d   r   zDTestExtraFilesWithGit.test_sdist_git_extra_files.<locals>.<listcomp>zgit-extra-file.txtN)	r   r   r   r   r   r   r   r   r    r!   r   r   r   test_sdist_git_extra_files]   s
   
z0TestExtraFilesWithGit.test_sdist_git_extra_files)r*   r+   r,   r=   rB   __classcell__r   r   r@   r   r6   O   s    r6   )r   r   r   	testtoolsr   pbr.tests.functionalr   BaseTestCaser   r.   r6   r   r   r   r   <module>   s   (
