L i dZddlZddlZddlZddlZddlZddlZddlZddl Z e jZ e jZ ejjZe jj Ze j"Ze jj$Ze jj&Ze jj(Ze j*ZdZddZy)z Helper for testing. NcHtjdfd }|t_y)z Redirect all warnings to stdout.Nct||tjj||tjy)N)ospathbasenamesysstdout)msgcatfnamelnofilelineshowwarning_origs T/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/joblib/testing.py showwarningz'warnings_to_stdout..showwarnings&c277#3#3E#:D#**M)Nr)warningsr)rrs @rwarnings_to_stdoutrs++N'Hrcb tjtjtj fd} fd} |Otj||}|j tjd|z|}|j  j \}} |j| j} } jdk7r(dj j|| } t| |1tj||stdj|||1tj|| std j|| |!jjyy#|!jjwwxYw) aRuns 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 stderrcVtjdjy)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)rwarn terminatecmdprocsrterminate_processz0check_subprocess_call..terminate_process0s#  (./ rcVtjdjy)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. rN)rrkillrsr kill_processz+check_subprocess_call..kill_process9s"  (./ rNrz/Non-zero return code: {}. Stdout: {} Stderr: {}z,Unexpected stdout: {!r} does not match: {!r}z,Unexpected stderr: {!r} does not match: {!r}) subprocessPopenPIPE threadingTimerstart communicatedecode returncodeformat ValueErrorresearchcancel) rtimeout stdout_regex stderr_regexrr"terminate_timer kill_timerr rmessagers ` @rcheck_subprocess_callr8%s   C   PD  'oog7HIO  ! ! #"WlCJ    ))+&--/ ??a LTTGW% %  #BIIlF,K?FF &   #BIIlF,K?FF &     " " $     7   " " $     s D!F %F.)NN)__doc__os.pathrr/r$rr'r_pytestpytestraiseswarnsrunnerSkippedSkipTestmarkskipiffixture parametrizer2xfailparamrr8rrrJs     >> ! !    ..kk%% ++    '; r