a
    3j	                     @   s   d dl Z d dlZd dlmZ d dlmZmZmZmZm	Z	m
Z
 d dlmZ d dlmZ e G dd dejZe G dd	 d	eZdS )
    N)	ExitStack)distributionentry_pointsfilesPackageNotFoundErrorversiondistributions)	resources)requires_zlibc                   @   sX   e Zd ZdZdd Zdd Zdd Zdd	 Zd
d Zdd Z	dd Z
dd Zdd ZdS )TestZipztest.test_importlib.datac                 C   sL   t | j|}| j t |}tjdt	| | j 
tjjd d S )Nr   )r	   r   rootjoinpathenter_contextZas_filesyspathinsertstrcallbackpop)selffilenameZpkg_filefile r   X/www/server/python_manager/versions/3.9.10/lib/python3.9/test/test_importlib/test_zip.py_fixture_on_path   s    zTestZip._fixture_on_pathc                 C   s$   t  | _| | jj | d d S )Nzexample-21.12-py3-none-any.whlr   r	   Z
addCleanupcloser   r   r   r   r   setUp   s    zTestZip.setUpc                 C   s   |  tdd d S )Nexample21.12assertEqualr   r   r   r   r   test_zip_version    s    zTestZip.test_zip_versionc                 C   s6   |  t td W d    n1 s(0    Y  d S )Nzdefinitely-not-installed)ZassertRaisesr   r   r   r   r   r   test_zip_version_does_not_match#   s    z'TestZip.test_zip_version_does_not_matchc                 C   s>   t t d }|d }| |jd |d }| |jd d S )NZconsole_scriptsr   zexample:mainExample)dictr   r"   value)r   ZscriptsZentry_pointr   r   r   test_zip_entry_points'   s
    zTestZip.test_zip_entry_pointsc                 C   s   |  tdd d S )Nr   zdoes not exist)ZassertIsNoner   	read_textr   r   r   r   test_missing_metadata.   s    zTestZip.test_missing_metadatac                 C   s   |  tdd d S )Nr%   r    r!   r   r   r   r   test_case_insensitive1   s    zTestZip.test_case_insensitivec                 C   s"   t dD ]}t|j|}qd S Nr   r   r   distZlocate_filer   r   r   r   r   r   
test_files4   s    zTestZip.test_filesc                 C   s   t ttjd d d}d S )N   )r   )listr   r   r   )r   Zdistsr   r   r   test_one_distribution9   s    zTestZip.test_one_distributionN)__name__
__module____qualname__r   r   r   r#   r$   r(   r*   r+   r0   r3   r   r   r   r   r      s   r   c                   @   s   e Zd Zdd Zdd ZdS )TestEggc                 C   s$   t  | _| | jj | d d S )Nzexample-21.12-py3.6.eggr   r   r   r   r   r   @   s    zTestEgg.setUpc                 C   s"   t dD ]}t|j|}qd S r,   r-   r/   r   r   r   r0   G   s    zTestEgg.test_filesN)r4   r5   r6   r   r0   r   r   r   r   r7   >   s   r7   )r   Zunittest
contextlibr   importlib.metadatar   r   r   r   r   r   	importlibr	   Ztest.supportr
   ZTestCaser   r7   r   r   r   r   <module>   s    /