관리-도구
편집 파일: test.cpython-38.pyc
U ���e� � @ s� d dl Z d dlZd dlZd dlZd dlZd dlZd dlmZmZ d dl m Z d dlmZ d dlm Z mZmZmZmZmZmZmZ d dlmZ d dlmZ G dd � d e�ZG d d� d�ZG dd � d e�ZdS )� N)�DistutilsError�DistutilsOptionError)�log)� TestLoader)�resource_listdir�resource_exists�normalize_path�working_set�evaluate_marker�add_activation_listener�require� EntryPoint)�Command)�unique_everseenc @ s e Zd Zdd� Zddd�ZdS )�ScanningLoaderc C s t �| � t� | _d S �N)r �__init__�set�_visited��self� r �E/opt/hc_python/lib/python3.8/site-packages/setuptools/command/test.pyr s zScanningLoader.__init__Nc C s� || j krdS | j �|� g }|�t�| |�� t|d�rH|�|�� � t|d�r�t|jd�D ]`}|� d�r�|dkr�|jd |dd� }n"t |j|d �r^|jd | }nq^|�| �|�� q^t|�d kr�| � |�S |d S dS )a Return a suite of all tests cases contained in the given module If the module is a package, load tests from all the modules in it. If the module has an ``additional_tests`` function, call it and add the return value to the tests. N�additional_tests�__path__� z.pyz__init__.py�.���z/__init__.py� r )r �add�appendr �loadTestsFromModule�hasattrr r �__name__�endswithr ZloadTestsFromName�lenZ suiteClass)r �module�pattern�tests�file� submoduler r r r! s$ z"ScanningLoader.loadTestsFromModule)N)r# � __module__�__qualname__r r! r r r r r s r c @ s e Zd Zdd� Zddd�ZdS )�NonDataPropertyc C s || _ d S r ��fget)r r/ r r r r B s zNonDataProperty.__init__Nc C s |d kr| S | � |�S r r. )r �obj�objtyper r r �__get__E s zNonDataProperty.__get__)N)r# r+ r, r r2 r r r r r- A s r- c @ s� e Zd ZdZdZdddgZdd� Zdd � Zed d� �Z dd � Z dd� Zej g fdd��Zeej dd� ��Zedd� �Zdd� Zdd� Zedd� �Zedd� �ZdS )�testz.Command to run unit tests after in-place buildz0run unit tests after in-place build (deprecated))ztest-module=�mz$Run 'test_suite' in specified module)ztest-suite=�sz9Run single test, case or suite (e.g. 'module.test_suite'))ztest-runner=�rzTest runner to usec C s d | _ d | _d | _d | _d S r )� test_suite�test_module�test_loader�test_runnerr r r r �initialize_optionsZ s ztest.initialize_optionsc C s� | j r| jrd}t|��| j d krD| jd kr8| jj | _ n| jd | _ | jd kr^t| jdd �| _| jd krnd| _| jd kr�t| jdd �| _d S )Nz1You may specify a module or a suite, but not bothz.test_suiter9 z&setuptools.command.test:ScanningLoaderr: )r7 r8 r �distributionr9 �getattrr: )r �msgr r r �finalize_options` s ztest.finalize_optionsc C s t | �� �S r )�list� _test_argsr r r r � test_argss s ztest.test_argsc c s4 | j stjdkrdV | jr"dV | j r0| j V d S )N)� � Zdiscoverz --verbose)r7 �sys�version_info�verboser r r r rA w s ztest._test_argsc C s | � � � |� W 5 Q R X dS )zI Backward compatibility for project_on_sys_path context. N)�project_on_sys_path)r �funcr r r �with_project_on_sys_path s ztest.with_project_on_sys_pathc c s� | � d� | jddd� | � d� | �d�}tjd d � }tj�� }zbt|j�}tj� d|� t � � tdd� � td|j|jf � | �|g�� d V W 5 Q R X W 5 |tjd d �<