Your IP : 216.73.216.213


Current Path : /opt/alt/python35/lib/python3.5/site-packages/joblib/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib/python3.5/site-packages/joblib/__pycache__/testing.cpython-35.pyc



-|�W��@s�dZddlZddlZddlZddlZddlZddlZddlm	Z	dd�Z
yddlmZWnJe
k
r�yddlmZWn!e
k
r�ddd	�ZYnXYnXd
dddd�ZdS)
z
Helper for testing.
�N)�PY3_OR_LATERcs.tj�dd�fdd�}|t_dS)z& Redirect all warnings to stdout.
    Nrcs)�||tjj|�|tj�dS)N)�os�path�basename�sys�stdout)�msg�cat�fname�lno�file�line)�showwarning_orig��?/opt/alt/python35/lib/python3.5/site-packages/joblib/testing.py�showwarningsz'warnings_to_stdout.<locals>.showwarning)�warningsr)rr)rr�warnings_to_stdouts	r)�assert_raises_regex)�assert_raises_regexpcOs�d}y|||�d}Wn_tk
r~}z?t|�}tj|�j|�sltd||f��WYdd}~XnX|r�td||���dS)z;Helper function to check for message patterns in exceptionsFTz3Error message should match pattern %r. %r does not.NzShould have raised %r)�	Exception�str�re�compile�search�AssertionError)�expected_exception�expected_regexp�callable_obj�args�kwargsZ
not_raised�e�
error_messagerrrr#s

#r�c	
s7tj|dtjdtj���fdd�}tj||�}z�|j��j�\}}tr�|j�|j�}}�j	dkr�dj
�j	||�}t|��|dk	r�tj
||�r�tdj
||���|dk	r$tj
||�r$td	j
||���Wd|j�XdS)
z�Runs a command in a subprocess with timeout in seconds.

    Also checks returncode is zero, stdout if stdout_regex is set, and
    stderr if stderr_regex is set.
    r�stderrcs�j�dS)N)�killr)�procrr�kill_process@sz+check_subprocess_call.<locals>.kill_processrz2Non-zero return code: {0}.
Stdout:
{1}
Stderr:
{2}Nz.Unexpected stdout: {0!r} does not match:
{1!r}z.Unexpected stderr: {0!r} does not match:
{1!r})�
subprocess�Popen�PIPE�	threading�Timer�start�communicater�decode�
returncode�format�
ValueErrorrr�cancel)	�cmd�timeoutZstdout_regexZstderr_regexr'Ztimerrr$�messager)r&r�check_subprocess_call6s0
r7)�__doc__rr�os.pathrrr(r+Zjoblib._compatrr�
nose.toolsr�ImportErrorrr7rrrr�<module>s"