
    7Th                        S r SSKrSSKrSSKrSSKrSSKrSSKrSSKrSSK	r	\	R                  r
\	R                  r\R                  R                  r\	R                  R                   r\	R"                  r\	R                  R$                  r\	R                  R&                  r\	R                  R(                  r\	R*                  rS rSS jrg)z
Helper for testing.
    Nc                  L   ^ [         R                  mSU4S jjn U [         l        g)z Redirect all warnings to stdout.Nc                 r   > T" X[         R                  R                  U5      U[        R                  5        g )N)ospathbasenamesysstdout)msgcatfnamelnofilelineshowwarning_origs         F/var/www/auris/envauris/lib/python3.13/site-packages/joblib/testing.pyshowwarning'warnings_to_stdout.<locals>.showwarning   s$    277#3#3E#:D#**M    )Nr   )warningsr   )r   r   s    @r   warnings_to_stdoutr      s    ++N 'Hr   c                 z  ^ ^ [         R                  " T [         R                  [         R                  S9mU U4S jnU U4S jn UbP  [        R                  " X5      nUR                  5         [        R                  " SU-  U5      nUR                  5         TR                  5       u  pUR                  5       U	R                  5       pTR                  S:w  a'  SR                  TR                  X5      n
[        U
5      eUb5  [        R                  " X(5      (       d  [        SR                  X(5      5      eUb5  [        R                  " X95      (       d  [        S	R                  X95      5      eUb!  WR                  5         WR                  5         gg! Ub!  WR                  5         WR                  5         f f = f)
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                  X   > [         R                  " ST  35        TR                  5         g)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_process0check_subprocess_call.<locals>.terminate_process0   s#     	(./r   c                  X   > [         R                  " ST  35        TR                  5         g)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_process+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_callr;   %   st    C

PD 'oogIO!!#"WlCJ))+&--/??aLTTG W%%#BIIl,K,K?FF  
 #BIIl,K,K?FF   ""$ 7""$ s   D+F &F:)   NN)__doc__os.pathr   r2   r'   r   r*   r   _pytestpytestraiseswarnsrunnerSkippedSkipTestmarkskipiffixtureparametrizer5   xfailparamr   r;    r   r   <module>rM      s     	  
    	>>!!			
..kk%%
++

'; r   