
    .Ph                        d Z ddlZddlZddlZddlZddlZddlZddlZddl	Z	e	j
        Z
e	j        Zej        j        Ze	j        j        Ze	j        Ze	j        j        Ze	j        j        Ze	j        j        Ze	j        Zd ZddZdS )z
Helper for testing.
    Nc                  D    t           j        dfd	} | t           _        dS )z Redirect all warnings to stdout.Nr   c                 t     | |t           j                            |          |t          j                   d S )N)ospathbasenamesysstdout)msgcatfnamelnofilelineshowwarning_origs         N/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/joblib/testing.pyshowwarningz'warnings_to_stdout.<locals>.showwarning   s4    c27#3#3E#:#:D#*MMMMM    )Nr   )warningsr   )r   r   s    @r   warnings_to_stdoutr      s@    +N N N N N N 'Hr      c                     t          j         t           j        t           j                   fd} fd}	 |Ut          j        ||          }|                                 t          j        d|z  |          }|                                                                 \  }}	|                                |	                                }	}j        dk    r+d	                    j        ||	          }
t          |
          |8t          j        ||          s#t          d	                    ||                    |8t          j        ||	          s#t          d		                    ||	                    |*|                                 |                                 dS dS # |)|                                 |                                 w w xY w)
a  Runs a command in a subprocess with timeout in seconds.

    A SIGTERM is sent after `timeout` and if it does not terminate, a
    SIGKILL is sent after `2 * timeout`.

    Also checks returncode is zero, stdout if stdout_regex is set, and
    stderr if stderr_regex is set.
    )r	   stderrc                  ^    t          j        d                                              dS )z
        Attempt to terminate a leftover process spawned during test execution:
        ideally this should not be needed but can help avoid clogging the CI
        workers in case of deadlocks.
        Timeout running N)r   warn	terminatecmdprocs   r   terminate_processz0check_subprocess_call.<locals>.terminate_process0   s4     	...///r   c                  ^    t          j        d                                              dS )z
        Kill a leftover process spawned during test execution: ideally this
        should not be needed but can help avoid clogging the CI workers in
        case of deadlocks.
        r   N)r   r   killr   s   r   kill_processz+check_subprocess_call.<locals>.kill_process9   s/     	...///		r   N   r   z/Non-zero return code: {}.
Stdout:
{}
Stderr:
{}z,Unexpected stdout: {!r} does not match:
{!r}z,Unexpected stderr: {!r} does not match:
{!r})
subprocessPopenPIPE	threadingTimerstartcommunicatedecode
returncodeformat
ValueErrorresearchcancel)r   timeoutstdout_regexstderr_regexr    r#   terminate_timer
kill_timerr	   r   messager   s   `          @r   check_subprocess_callr9   %   s    C

PPPD           'og7HIIO!!###"WlCCJ))++&--//?aLTT G W%%%#BIlF,K,K#?FF &   
 #BIlF,K,K#?FF &    ""$$$ 7""$$$ s   E F) )-G)r   NN)__doc__os.pathr   r0   r%   r   r(   r   _pytestpytestraiseswarnsrunnerSkippedSkipTestmarkskipiffixtureparametrizer3   xfailparamr   r9    r   r   <module>rJ      s      				     



       	>!		
.k%
+
' ' ';  ;  ;  ;  ;  ; r   