§
|<ˆj±‡ ã ó
— d Z ddlZddlZddlZddlZddlZddlZddlmZ ddlm Z ddl
mZ ddlm
Z
ddlmZ ddlmZ dd lmZ dd
lmZ ddlmZ ddlmZ dd
lmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlm Z ddl!m"Z" ddl#m$Z$ ddl%m&Z& ddl%m'Z' ddl(m)Z) ddl(m*Z* ddl(m+Z+ erddl,m-Z- dd l,m.Z. e.d! Z/d"e"d#dfd$„Z0d\d%„Z1d&ed#dfd'„Z2 e d(¬)¦ « d*efd+„¦ « Z3 G d,„ d-ej4 ¦ « Z5 G d.„ d/ej4 ¦ « Z6 G d0„ d1e6¦ « Z7 G d2„ d3e¦ « Z8 G d4„ d5ej9 ee ¦ « Z:d6d7d8d9œZ; G d:„ d;e:e< ¦ « Z= G d<„ d=e:e ¦ « Z> G d>„ d?e>e? ¦ « Z@ G d@„ dAe>e< ¦ « ZA G dB„ dCe:e ¦ « ZB G dD„ dEeBe? ¦ « ZC G dF„ dGeBe< ¦ « ZDejE dHk sere G dI„ dJeee ¦ « ¦ « ZFn& G dK„ dJ ejG dJdLdMg¦ « ee ¦ « ZF G dN„ dOee ¦ « ZHdPdQd#eHe< fdR„ZI G dS„ dT¦ « ZJ G dU„ dVee ¦ « ZKe&dWe'd#eeKe< ddf fdX„¦ « ZLe&dWe'd#eeKe? ddf fdY„¦ « ZMe&dWe'd#eeKe< ddf fdZ„¦ « ZNe&dWe'd#eeKe? ddf fd[„¦ « ZOdS )]z+Per-test stdout/stderr capturing mechanism.é N©ÚUnsupportedOperation)Ú
TemporaryFile)Ú
TracebackType)ÚAny)ÚAnyStr)ÚBinaryIO)Ú Generator)ÚGeneric)ÚIterable)ÚIterator)ÚList)Ú
NamedTuple)ÚOptional)ÚTextIO)ÚTuple)ÚType)Ú
TYPE_CHECKING)ÚUnion)Úfinal)ÚConfig)Úhookimpl)ÚParser)Úcheck_ispytest)Úfixture)Ú
SubRequest)Ú Collector)ÚFile)ÚItem)ÚFinal)ÚLiteral©ÚfdÚsysÚnoútee-sysÚparserÚreturnc óž — | d¦ « }| ddddg d¢d¬¦ « | d d
ddd
¬¦ « d S )NÚgeneralz --captureÚstorer# Úmethodr" z3Per-test capturing method: one of fd|sys|no|tee-sys)ÚactionÚdefaultÚmetavarÚchoicesÚhelpz-sÚstore_constr% ÚcapturezShortcut for --capture=no)r- ÚconstÚdestr1 )ÚgetgroupÚ
_addoption)r' Úgroups úa/builddir/build/BUILD/cloudlinux-venv-1.0.12/venv/lib/python3.11/site-packages/_pytest/capture.pyÚpytest_addoptionr: - s€ € Ø�OŠO˜IÑ&Ô&€EØ ×ÒØØØØØ.Ð.Ð.Ø
Bð
ñ ô ð ð
×ÒØØØØ
Ø
(ð ñ ô ð ð ð ó c ót — t j d¦ « r ddl} dS # t $ r Y dS w xY wdS )a Ensure colorama is imported so that it attaches to the correct stdio
handles on Windows.
colorama uses the terminal on import time. So if something does the
first import of colorama while I/O capture is active, colorama will
fail in various ways.
Úwin32r N)r$ ÚplatformÚ
startswithÚcoloramaÚImportError)r@ s r9 Ú_colorama_workaroundrB @ sZ € õ „|×Ò˜wÑ'Ô'ð ð ØˆOˆOˆOˆOˆOøÝð ð ð ØˆDˆDð øøøðð s ¡' §
5´5Ústreamc óî ‡— t j d¦ « rt t d¦ « rdS t | d¦ « sdS t | j d¦ « Љr| j j n| j }t
|t j ¦ « sdS ˆfd„} |t j d¦ « t _ |t j
d¦ « t _
|t j d¦ « t _ dS ) aù Workaround for Windows Unicode console handling.
Python 3.6 implemented Unicode console handling for Windows. This works
by reading/writing to the raw console handle using
``{Read,Write}ConsoleW``.
The problem is that we are going to ``dup2`` over the stdio file
descriptors when doing ``FDCapture`` and this will ``CloseHandle`` the
handles used by Python to write to the console. Though there is still some
weirdness and the console handle seems to only be closed randomly and not
on the first call to ``CloseHandle``, or maybe it gets reopened with the
same handle value when we suspend capturing.
The workaround in this case will reopen stdio with a different fd which
also means a different handle by replicating the logic in
"Py_lifecycle.c:initstdio/create_stdio".
:param stream:
In practice ``sys.stdout`` or ``sys.stderr``, but given
here as parameter for unittesting purposes.
See https://github.com/pytest-dev/py/issues/103.
r= Úpypy_version_infoNÚbufferÚrawc óè •— ‰s|d dk rd}nd}t j t t j | ¦ « ¦ « ||¦ « | j | j | j | j ¦ « S )Nr Úwéÿÿÿÿ)
ÚioÚ
TextIOWrapperÚopenÚosÚdupÚfilenoÚencodingÚerrorsÚnewlinesÚline_buffering)ÚfÚmodeÚ bufferingÚbuffereds €r9 Ú
_reopen_stdioz3_windowsconsoleio_workaround.