Hacked By AnonymousFox

Current Path : /opt/alt/python37/lib64/python3.7/test/support/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib64/python3.7/test/support/__pycache__/__init__.cpython-37.pyc

B

� f���]@sF
dZedkred��ddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
ZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl!Z!ddl"Z#ddl$Z$ddl%m&Z&yddl'Z(Wnek
�r>dZ(YnXyddl)Z)Wnek
�rfdZ)YnXyddl*Z*Wnek
�r�dZ*YnXyddl+Z+Wnek
�r�dZ+YnXyddl,Z,Wnek
�r�dZ,YnXyddl-Z-Wnek
�rdZ-YnXddd	d
ddd
ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDdEdFdGdHdIdJdKdLdMdNdOdPdQdRdSdTdUdVdWdXdYdZd[d\d]d^d_d`dadbdcg]Z.Gddd�de/�Z0Gded
�d
e0�Z1Gdfd�de0�Z2Gdgd�de!j3�Z4ej5�dfdidj��Z6�dgdldm�dnd�Z7dodp�Z8dqdr�Z9dsd<�Z:dtd=�Z;�dhdud�Z<dvd8�Z=dZ>dZ?da@daAdZBdkZCdaDdwd�ZEdxd�ZFdyd�ZGdzd{�ZHej�Id|��rؐdid}d~�ZJdd��ZKd�d��ZLd�d��ZMd�d��ZNnejOZKejPZLd�d��ZMd�d��ZNd�d�ZOd�d��ZPd�d�ZQd�d��ZRd�d�ZSd�d��ZTd�d#�ZU�djd�d$�ZVd�d��ZWd�d%�ZXd�d&�ZYd�d'�ZZd�Z[d�Z\d�Z]ej^ej_fd�dH�Z`e[fd�dI�Zad�dK�Zbd�d��Zcec�Zdd�d��Zed�Zfd�Zge!�hei�jd���Id��d��Zke!�he)d��Zle!�he*d��Zme!�he+d��Zne!�he,d��Zoej�Id��Zpeqed��Zrejd�k�r"er�rd�nd�ZsndZsejtd�k�r8d�Zund�Zud��veue�w��Zud�ZxdZyxJd�D]BZzye�{e�|ez��ezk�rze}�Wne}k
�r�YnXezZyP�qZWeud�Z~ejd�k�r�ddlZe��d�e~�Z~e���Z�dZ�ejtd�k�r4e���jd�k�rveud�Z�ye���e��Wne�k
�rYnXe�d�e�e�f�dZ�nBejd�k�rvyd���e��Wn&e�k
�rteud���e�d��Z�YnXdZ�xDd�D]<Ztyet��e��Wn&e�k
�r�e�|eu�etZ�PYnX�q�Wey�r�eud�eyZ�ndZ�e���Z�dkZ�ej5�dkd�dÄ�Z�ej5�dld�dń�Z�ej5�dmd�d��Z�eqedȃ�r4ej5d�dL��Z�ej���ej���e���Z�ej���e��Z�ej���e�dʡZ��dnd�d�Z�d�d �Z�d�d\�Z�d�dτZ�dddМd�d(�Z�d�dJ�Z�Gd�dԄd�e��Z��dod�dքZ�ej5d�dS��Z�ej5d�dT��Z�Gd�d�de��Z�Gd�dU�dUej�j��Z�Gd�d܄d�e��Z�Gd�d)�d)e��Z�e�e�ej�dލZ�e�e�ej�dލZ�e�e�ej�dލZ�d�d�Z�ej5d�dld�d�d-��Z�ej5d�d��Z�d�d�Z�d�d�Z�d�d�Z�d�d�Z�ej5d�d��Z�d�d�Z�d�Z�d�Z�eqed��r�d�e�Z�d�Z�e�d�Z�d�d��Z�d�d��Z�d�Z�d�Z�d�d��Z�d�dV�Z�d�d]�Z�d�ZŐde�Z�d�e�Zǐde�Z�ej�ZʐddZ�Z�G�d�d��d�Z̐dp�dd5�Z͐dd6�Z�G�dd.�d.�Zϐd�d	�ZАd
�d�Zѐdd7�ZҐdq�d
�d�ZӐd�d�ZԐddC�ZՐd�d�Z֐d�d�Zאd�d�Zؐd�d�Z�da�da�daܐd�d�Zݐd�d�Zސdr�d�d�Zߐd �d!�Z�d"d/�Z�d#�d$�Z�eՃ�
oXejd�k�
oXe��d%�Z�e�jdk	�
oje�Z�e!�he�d&�Z�ds�d'd0�Z�d(�d)�Z�d*�d+�Z�dka�d,dO�Z�d-dP�Z�d.dQ�Z�ej5�dt�d0�d1��Z�du�d2�d3�Z�d4dM�Z�ej5�dv�d5dR��Z�ej5�d6dX��Z�ej5�d7dW��Z�d8�d9�Z�e!��eqe�d:��d;�Z��d<�d=�Z��d>�d?�Z�G�d@dN�dNej�j��Z�G�dAdY�dYe��Z�da��dBd!�Z��dCd1�Z�d�a�dD�dE��Z�dFd:��Zd�a�dGd@��Z�dHd"��Zdl�dI��dJd>��Z�dw�dKd?��ZG�dLd[�d[��Z�dM�dN��Z	�dO�dP��Z
�dx�dQ�dR��Zgf�dSd_��Zd�a
�dTdE��Zej5�dU�dV���Z�dWd`��ZG�dX�dY��dY��Z�dZ�d[��ZG�d\�d]��d]��ZG�d^�d_��d_��Z�e��Ze
�jG�d`�da��da���Z�e��Ze
�jG�db�dc��dc���Z�e��Zej5�dd�de���ZdS(yz7Supporting definitions for the Python regression tests.ztest.supportz.support must be imported from the test package�N�)�get_test_runner�
PIPE_MAX_SIZE�verbose�
max_memuse�
use_resources�failfast�Error�
TestFailed�
TestDidNotRun�ResourceDenied�
import_module�import_fresh_module�CleanImport�unload�forget�record_original_stdout�get_original_stdout�captured_stdout�captured_stdin�captured_stderr�TESTFN�SAVEDCWD�unlink�rmtree�temp_cwd�findfile�create_empty_file�can_symlink�fs_is_case_insensitive�is_resource_enabled�requires�requires_freebsd_version�requires_linux_version�requires_mac_ver�check_syntax_error�TransientResource�time_out�socket_peer_reset�ioerror_peer_reset�transient_internet�BasicTestRunner�run_unittest�run_doctest�skip_unless_symlink�
requires_gzip�requires_bz2�
requires_lzma�
bigmemtest�bigaddrspacetest�cpython_only�
get_attribute�requires_IEEE_754�skip_unless_xattr�
requires_zlib�anticipate_failure�load_package_tests�detect_api_mismatch�check__all__�skip_unless_bind_unix_socket�	is_jython�
is_android�check_impl_detail�
unix_shell�setswitchinterval�HOST�IPV6_ENABLED�find_unused_port�	bind_port�open_urlresource�bind_unix_socket�
temp_umask�
reap_children�TestHandler�threading_setup�threading_cleanup�reap_threads�
start_threads�check_warnings�check_no_resource_warning�EnvironmentVarGuard�run_with_locale�	swap_item�	swap_attr�Matcher�set_memlimit�SuppressCrashReport�sortdict�run_with_tz�PGO�missing_compiler_executable�fd_count�	ALWAYS_EQ�LARGEST�SMALLESTc@seZdZdZdS)r	z*Base class for regression test exceptions.N)�__name__�
__module__�__qualname__�__doc__�rere�:/opt/alt/python37/lib64/python3.7/test/support/__init__.pyr	ssc@seZdZdZdS)r
zTest failed.N)rarbrcrdrerererfr
vsc@seZdZdZdS)rzTest did not run any subtests.N)rarbrcrdrerererfrysc@seZdZdZdS)rz�Test skipped because it requested a disallowed resource.

    This is raised when a test calls requires() for a resource that
    has not be enabled.  It is used to distinguish between expected
    and unexpected skips.
    N)rarbrcrdrerererfr|sTc	cs8|r.t���t�ddt�dVWdQRXndVdS)z�Context manager to suppress package and module deprecation
    warnings when importing them.

    If ignore is False, this context manager has no effect.
    �ignorez.+ (module|package)N)�warnings�catch_warnings�filterwarnings�DeprecationWarning)rgrererf�_ignore_deprecated_imports�s
rlFre)�required_oncCsft|��Ty
t�|�Stk
rV}z$tj�t|��r8�t�	t
|���Wdd}~XYnXWdQRXdS)acImport and return the module to be tested, raising SkipTest if
    it is not available.

    If deprecated is True, any module or package deprecation messages
    will be suppressed. If a module is required on a platform but optional for
    others, set required_on to an iterable of platform prefixes which will be
    compared against sys.platform.
    N)rl�	importlibr
�ImportError�sys�platform�
startswith�tuple�unittest�SkipTest�str)�name�
deprecatedrm�msgrererfr
�s	

cCs^|tjkrt|�tj|=x>ttj�D]0}||ks@|�|d�r&tj|||<tj|=q&WdS)zyHelper function to save and remove a module from sys.modules

    Raise ImportError if the module can't be imported.
    �.N)rp�modules�
__import__�listrr)rw�orig_modules�modnamerererf�_save_and_remove_module�s
r�cCs>d}ytj|||<Wntk
r.d}YnXdtj|<|S)z�Helper function to save and block a module in sys.modules

    Return True if the module was in sys.modules, False otherwise.
    TFN)rpr{�KeyError)rwr~Zsavedrererf�_save_and_block_module�s

r�cCs|r
tjSdd�S)z�Decorator to mark a test that is known to be broken in some cases

       Any use of this decorator should have a comment identifying the
       associated tracker issue.
    cSs|S)Nre)�frererf�<lambda>��z$anticipate_failure.<locals>.<lambda>)rtZexpectedFailure)Z	conditionrererfr9�scCsF|dkrd}tj�tj�tj�t���}|j|||d�}|�|�|S)z�Generic load_tests implementation for simple test packages.

    Most packages can implement load_tests using this function as follows:

       def load_tests(*args):
           return load_package_tests(os.path.dirname(__file__), *args)
    Nztest*)Z	start_dirZ
top_level_dir�pattern)�os�path�dirname�__file__ZdiscoverZaddTests)Zpkg_dir�loaderZstandard_testsr�Ztop_dirZ
package_testsrererfr:�s
cCs�t|���i}g}t||�zfyHx|D]}t||�q&Wx |D]}t||�s>|�|�q>Wt�|�}Wntk
r~d}YnXWdx|��D]\}	}
|
tj	|	<q�Wx|D]}tj	|=q�WX|SQRXdS)a�Import and return a module, deliberately bypassing sys.modules.

    This function imports and returns a fresh copy of the named Python module
    by removing the named module from sys.modules before doing the import.
    Note that unlike reload, the original module is not affected by
    this operation.

    *fresh* is an iterable of additional module names that are also removed
    from the sys.modules cache before doing the import.

    *blocked* is an iterable of module names that are replaced with None
    in the module cache during the import to ensure that attempts to import
    them raise ImportError.

    The named module and any modules named in the *fresh* and *blocked*
    parameters are saved before starting the import and then reinserted into
    sys.modules when the fresh import is complete.

    Module and package deprecation messages are suppressed during this import
    if *deprecated* is True.

    This function will raise ImportError if the named module cannot be
    imported.
    N)
rlr�r��appendrnr
ro�itemsrpr{)rwZfreshZblockedrxr~Znames_to_removeZ
fresh_nameZblocked_nameZfresh_moduleZ	orig_name�moduleZname_to_removerererfr�s$





cCs>yt||�}Wn&tk
r4t�d||f��YnX|SdS)z?Get an attribute, raising SkipTest if AttributeError is raised.zobject %r has no attribute %rN)�getattr�AttributeErrorrtru)�objrwZ	attributerererfr5s
cCs|adS)N)�_original_stdout)�stdoutrererfr'scCs
tptjS)N)r�rpr�rerererfr+scCs&ytj|=Wntk
r YnXdS)N)rpr{r�)rwrererfr.sc
Gspy||�Stk
rj}zDtdkrHtd|jj|f�td|j|f�t�|tj�||�Sd}~XYnXdS)N�z%s: %szre-run %s%r)	�OSErrorr�print�	__class__rar��chmod�stat�S_IRWXU)r��func�args�errrererf�
_force_run4sr��wincCs�||�|r|}ntj�|�\}}|p(d}d}x>|dkrlt�|�}|rL|sXn||ksXdSt�|�|d9}q0Wtjd|tdd�dS)Nrzg����MbP?g�?r�z)tests may fail, delete still pending for �)�
stacklevel)	r�r��split�listdir�time�sleeprh�warn�RuntimeWarning)r��pathname�waitallr�rw�timeout�Lrererf�_waitfor?s



r�cCsttj|�dS)N)r�r�r)�filenamerererf�_unlink`sr�cCsttj|�dS)N)r�r��rmdir)r�rererf�_rmdircsr�cs,�fdd��t�|dd�tdd�|�dS)Ncs�x�t|tj|�D]�}tj�||�}yt�|�j}Wn<tk
rn}ztd||ft	j
d�d}Wdd}~XYnXt�|�r�t
�|dd�t|tj|�qt|tj|�qWdS)Nz-support.rmtree(): os.lstat(%r) failed with %s)�filerT)r�)r�r�r�r��join�lstat�st_moder�r�rp�
__stderr__r��S_ISDIRr�r�r)r�rw�fullname�mode�exc)�
_rmtree_innerrerfr�gs

z_rmtree.<locals>._rmtree_innerT)r�cSst|tj|�S)N)r�r�r�)�prererfr�vr�z_rmtree.<locals>.<lambda>)r�)r�re)r�rf�_rmtreefsr�cCs^yddl}Wntk
r Yn:X|�t|�d�}|jj�||t|��}|rZ|d|�S|S)Nrr�)�ctypesroZcreate_unicode_buffer�len�windll�kernel32ZGetLongPathNameW)r�r��buffer�lengthrererf�	_longpathxs
r�csFyt�|�dStk
r"YnX�fdd���|�t�|�dS)Nc	s�x~t|tj|�D]l}tj�||�}yt�|�j}Wntk
rJd}YnXt�	|�rn�|�t|tj
|�qt|tj|�qWdS)Nr)r�r�r�r�r�r�r�r�r�r�r�r)r�rwr�r�)r�rerfr��s

z_rmtree.<locals>._rmtree_inner)�shutilrr�r�r�)r�re)r�rfr��s
cCs|S)Nre)r�rererfr��sc	Cs*yt|�Wnttfk
r$YnXdS)N)r��FileNotFoundError�NotADirectoryError)r�rererfr�scCs&yt|�Wntk
r YnXdS)N)r�r�)r�rererfr��sr�cCs&yt|�Wntk
r YnXdS)N)r�r�)r�rererfr�scCsBtj�|�}tj�tj�|��}tj�||d�}t�||�|S)aMove a PEP 3147/488 pyc file to its legacy pyc location.

    :param source: The file system path to the source file.  The source file
        does not need to exist, however the PEP 3147/488 pyc file must exist.
    :return: The file system path to the legacy pyc file.
    �c)	rn�util�cache_from_sourcer�r�r��abspathr��rename)�sourceZpyc_fileZup_oneZ
legacy_pycrererf�make_legacy_pyc�s
r�cCs\t|�xNtjD]D}tj�||d�}t|d�x dD]}ttjj||d��q8WqWdS)z�'Forget' a module was ever imported.

    This removes the module from sys.modules and deletes any PEP 3147/488 or
    legacy .pyc files.
    z.pyr�)�rr�)�optimizationN)	rrpr�r�r�rrnr�r�)rr�r��optrererfr�s
c
s�ttd�rtjSd}tj�d�r�ddl�ddl�d}d}G�fdd�d�j�}�j	j
}|��}|sj����|�}�j
��}|�||��|���|���|��}|s�����t|j|@�s�d}n�tjdk�rVdd	lm}	m�m}
m}dd
lm}|	�|d��}
|
��dk�rd}nFG�fd
d�d|�}|�}|
|�}|
�|�dk�sR|
�|�dk�rVd}|�s�y.ddlm}|�}|��|� �|�!�Wn\t"k
�r�}z<t#|�}t$|�dk�r�|dd�d}d�%t&|�j'|�}Wdd}~XYnX|t_(|t_tjS)N�resultr�rrcs.eZdZd�jjfd�jjfd�jjfgZdS)z*_is_gui_available.<locals>.USEROBJECTFLAGSZfInheritZ	fReserved�dwFlagsN)rarbrc�wintypesZBOOL�DWORD�_fields_re)r�rerf�USEROBJECTFLAGS�s

r�z,gui not available (WSF_VISIBLE flag not set)�darwin)�cdll�c_int�pointer�	Structure)�find_libraryZApplicationServicesz0gui tests cannot run without OS X window managercseZdZd�fd�fgZdS)z._is_gui_available.<locals>.ProcessSerialNumberZ
highLongOfPSNZlowLongOfPSNN)rarbrcr�re)r�rerf�ProcessSerialNumber�sr�z#cannot run without OS X gui process)�Tk�2z [...]zTk unavailable due to {}: {}))�hasattr�_is_gui_availabler�rprqrrr�Zctypes.wintypesr�r�Zuser32ZGetProcessWindowStationZWinErrorr�r�ZGetUserObjectInformationWZbyrefZsizeof�boolr�r�r�r�Zctypes.utilr�ZLoadLibraryZCGMainDisplayIDZGetCurrentProcessZSetFrontProcessZtkinterr�Zwithdraw�updateZdestroy�	Exceptionrvr��format�typera�reason)r�Z	UOI_FLAGSZWSF_VISIBLEr�Zdll�hZuofZneededZresr�r�r�r�Zapp_servicesr�ZpsnZpsn_pr��root�eZ
err_stringre)r�r�rfr��sh

r�cCstdkp|tkS)z�Test whether a resource is enabled.

    Known resources are set by regrtest.py.  If not running under regrtest.py,
    all resources are assumed enabled unless use_resources has been set.
    N)r)�resourcerererfr scCs<t|�s |dkrd|}t|��|dkr8t�s8ttj��dS)z@Raise ResourceDenied if the specified resource is not available.Nz"Use of the %r resource not enabled�gui)r rr�r�)r�ryrererfr!#scCs�ddl}d�tt|��}|���dd�d}|��|krtyttt|�d���}Wnt	k
rhd}YqxX||k}nd}t
�||�d|�d|���S)	z�Decorator raising SkipTest if the OS is `sysname` and the version is less
    than `min_version`.

    For example, @_requires_unix_version('FreeBSD', (7, 2)) raises SkipTest if
    the FreeBSD version is less than 7.2.
    rNrz�-rFz	 version z or higher required, not )rqr��maprv�releaser��systemrs�int�
ValueErrorrt�skipIf)�sysname�min_versionrq�min_version_txt�version_txt�version�skiprererf�_requires_unix_version,s

r�cGs
td|�S)z�Decorator raising SkipTest if the OS is FreeBSD and the FreeBSD version is
    less than `min_version`.

    For example, @requires_freebsd_version(7, 2) raises SkipTest if the FreeBSD
    version is less than 7.2.
    ZFreeBSD)r�)r�rererfr"GscGs
td|�S)z�Decorator raising SkipTest if the OS is Linux and the Linux version is
    less than `min_version`.

    For example, @requires_linux_version(2, 6, 32) raises SkipTest if the Linux
    version is less than 2.6.32.
    ZLinux)r�)r�rererfr#Pscs�fdd�}|S)z�Decorator raising SkipTest if the OS is Mac OS X and the OS X
    version if less than min_version.

    For example, @requires_mac_ver(10, 5) raises SkipTest if the OS X version
    is lesser than 10.5.
    cs"t�����fdd��}�|_|S)Ncsxtjdkrnt��d}yttt|�d���}Wntk
rBYn,X|�krnd�tt	���}t
�d||f���||�S)Nr�rrzz&Mac OS X %s or higher required, not %s)rprqZmac_verrsr�r�r�r�r�rvrtru)r��kwr�r�r�)r�r�rerf�wrapperas
z4requires_mac_ver.<locals>.decorator.<locals>.wrapper)�	functools�wrapsr�)r�r�)r�)r�rf�	decorator`sz#requires_mac_ver.<locals>.decoratorre)r�r�re)r�rfr$YsZ	localhostz	127.0.0.1z::1cCs"t�||�}t|�}|��~|S)a�
Returns an unused port that should be suitable for binding.  This is
    achieved by creating a temporary socket with the same family and type as
    the 'sock' parameter (default is AF_INET, SOCK_STREAM), and binding it to
    the specified host address (defaults to 0.0.0.0) with the port set to 0,
    eliciting an unused ephemeral port from the OS.  The temporary socket is
    then closed and deleted, and the ephemeral port is returned.

    Either this method or bind_port() should be used for any tests where a
    server socket needs to be bound to a particular port for the duration of
    the test.  Which one to use depends on whether the calling code is creating
    a python socket, or if an unused port needs to be provided in a constructor
    or passed to an external program (i.e. the -accept argument to openssl's
    s_server mode).  Always prefer bind_port() over find_unused_port() where
    possible.  Hard coded ports should *NEVER* be used.  As soon as a server
    socket is bound to a hard coded port, the ability to run multiple instances
    of the test simultaneously on the same host is compromised, which makes the
    test a ticking time bomb in a buildbot environment. On Unix buildbots, this
    may simply manifest as a failed test, which can be recovered from without
    intervention in most cases, but on Windows, the entire python process can
    completely and utterly wedge, requiring someone to log in to the buildbot
    and manually kill the affected process.

    (This is easy to reproduce on Windows, unfortunately, and can be traced to
    the SO_REUSEADDR socket option having different semantics on Windows versus
    Unix/Linux.  On Unix, you can't have two AF_INET SOCK_STREAM sockets bind,
    listen and then accept connections on identical host/ports.  An EADDRINUSE
    OSError will be raised at some point (depending on the platform and
    the order bind and listen were called on each socket).

    However, on Windows, if SO_REUSEADDR is set on the sockets, no EADDRINUSE
    will ever be raised when attempting to bind two identical host/ports. When
    accept() is called on each socket, the second caller's process will steal
    the port from the first caller, leaving them both in an awkwardly wedged
    state where they'll no longer respond to any signals or graceful kills, and
    must be forcibly killed via OpenProcess()/TerminateProcess().

    The solution on Windows is to use the SO_EXCLUSIVEADDRUSE socket option
    instead of SO_REUSEADDR, which effectively affords the same semantics as
    SO_REUSEADDR on Unix.  Given the propensity of Unix developers in the Open
    Source world compared to Windows ones, this is a common mistake.  A quick
    look over OpenSSL's 0.9.8g source shows that they use SO_REUSEADDR when
    openssl.exe is called with the 's_server' option, for example. See
    http://bugs.python.org/issue2550 for more info.  The following site also
    has a very thorough description about the implications of both REUSEADDR
    and EXCLUSIVEADDRUSE on Windows:
    http://msdn2.microsoft.com/en-us/library/ms740621(VS.85).aspx)

    XXX: although this approach is a vast improvement on previous attempts to
    elicit unused ports, it rests heavily on the assumption that the ephemeral
    port returned to us by the OS won't immediately be dished back out to some
    other process when we close and delete our temporary socket but before our
    calling code has a chance to bind the returned port.  We can deal with this
    issue if/when we come across it.
    )�socketrF�close)�familyZsocktypeZtempsock�portrererfrEzs
8cCs�|jtjkr�|jtjkr�ttd�r>|�tjtj�dkr>t	d��ttd�r�dt
jkr�y |�tjtj�dkrpt	d��Wnt
k
r�YnXttd�r�|�tjtjd�|�|df�|��d}|S)	a%Bind the socket to a free port and return the port number.  Relies on
    ephemeral ports in order to ensure we are using an unbound port.  This is
    important as many tests may be running simultaneously, especially in a
    buildbot environment.  This method raises an exception if the sock.family
    is AF_INET and sock.type is SOCK_STREAM, *and* the socket has SO_REUSEADDR
    or SO_REUSEPORT set on it.  Tests should *never* set these socket options
    for TCP/IP sockets.  The only case for setting these options is testing
    multicasting via multiple UDP sockets.

    Additionally, if the SO_EXCLUSIVEADDRUSE socket option is available (i.e.
    on Windows), it will be set on the socket.  This will prevent anyone else
    from bind()'ing to our host/port for the duration of the test.
    �SO_REUSEADDRrzHtests should never set the SO_REUSEADDR socket option on TCP/IP sockets!�SO_REUSEPORTZWITHIN_PYTHON_RPM_BUILDzHtests should never set the SO_REUSEPORT socket option on TCP/IP sockets!�SO_EXCLUSIVEADDRUSEr)rr�AF_INETr��SOCK_STREAMr�Z
getsockoptZ
SOL_SOCKETrr
r��environrr�Z
setsockoptr�bindZgetsockname)�sockZhostrrererfrF�s 



cCsJ|jtjkst�y|�|�Wn&tk
rD|��t�d��YnXdS)zBBind a unix socket, raising SkipTest if PermissionError is raised.zcannot bind AF_UNIX socketsN)	rr�AF_UNIX�AssertionErrorr
�PermissionErrorrrtru)rZaddrrererfrH�scCsZtjrVd}z<y"t�tjtj�}|�tdf�dStk
rBYnXWd|rT|��XdS)z+Check whether IPv6 is enabled on this host.NrTF)rZhas_ipv6ZAF_INET6rr
�HOSTv6r�r)rrererf�_is_ipv6_enabled�s

rcst����fdd��}|S)z5Skip the test on TLS certificate validation failures.c
sNy�||�Wn:tk
rH}zdt|�kr6t�d���Wdd}~XYnXdS)NZCERTIFICATE_VERIFY_FAILEDz.system does not contain necessary certificates)r�rvrtru)r��kwargsr�)r�rerf�dec�s
z&system_must_validate_cert.<locals>.dec)r�r�)r�rre)r�rf�system_must_validate_cert�s	ri@iZdoubleZIEEEztest requires IEEE 754 doublesz
requires zlibz
requires gzipzrequires bz2z
requires lzma�javaZgetandroidapilevel�win32z/system/bin/shz/bin/shz$testz@testz	{}_{}_tmpzhttp://www.pythontest.net)�æuİuŁuφuКuאu،uتuก� u€u-àòɘŁğr�ZNFD�ntr�u-共Ł♡ͣ�ztWARNING: The filename %r CAN be encoded by the filesystem encoding (%s). Unicode filename tests may not be effective��s-��surrogateescape)s�w�rs���s�s��r�c
cs�d}|dkr&t��}d}tj�|�}nXyt�|�d}WnDtk
r|}z&|sP�tjd|�d|��t	dd�Wdd}~XYnX|r�t�
�}z
|VWd|r�|t�
�kr�t|�XdS)a�Return a context manager that creates a temporary directory.

    Arguments:

      path: the directory to create temporarily.  If omitted or None,
        defaults to creating a temporary directory using tempfile.mkdtemp.

      quiet: if False (the default), the context manager raises an exception
        on error.  Otherwise, if the path is specified and cannot be
        created, only a warning is issued.

    FNTz5tests may fail, unable to create temporary directory z: �)r�)�tempfile�mkdtempr�r��realpath�mkdirr�rhr�r��getpidr)r��quietZdir_createdr��pidrererf�temp_dir�s&

r#c
cs|t��}yt�|�WnDtk
rZ}z&|s.�tjd|�d|��tdd�Wdd}~XYnXzt��VWdt�|�XdS)agReturn a context manager that changes the current working directory.

    Arguments:

      path: the directory to use as the temporary current working directory.

      quiet: if False (the default), the context manager raises an exception
        on error.  Otherwise, it issues only a warning and keeps the current
        working directory the same.

    zBtests may fail, unable to change the current working directory to z: r)r�N)r��getcwd�chdirr�rhr�r�)r�r!Z	saved_dirr�rererf�
change_cwd�s
r&�tempcwdc
cs:t||d��$}t||d��}|VWdQRXWdQRXdS)a�
    Context manager that temporarily creates and changes the CWD.

    The function temporarily changes the current working directory
    after creating a temporary directory in the current directory with
    name *name*.  If *name* is None, the temporary directory is
    created using tempfile.mkdtemp.

    If *quiet* is False (default) and it is not possible to
    create or change the CWD, an error is raised.  If *quiet* is True,
    only a warning is raised and the original CWD is used.

    )r�r!)r!N)r#r&)rwr!Z	temp_pathZcwd_dirrererfrs�umaskc	cs&t�|�}z
dVWdt�|�XdS)z8Context manager that temporarily sets the process umask.N)r�r()r(ZoldmaskrererfrIs

�datacCsbtj�|�r|S|dk	r&tj�||�}tgtj}x*|D]"}tj�||�}tj�|�r8|Sq8W|S)a[Try to find a file on sys.path or in the test directory.  If it is not
    found the argument passed to the function is returned (this does not
    necessarily signal failure; could still be the legitimate path).

    Setting *subdir* indicates a relative path to use to find the file
    rather than looking directly in the path directories.
    N)r�r��isabsr��
TEST_HOME_DIRrp�exists)r�Zsubdirr�Zdn�fnrererfr%s
cCs(t�|tjtjBtjB�}t�|�dS)z>Create an empty file. If the file already exists, truncate it.N)r��open�O_WRONLY�O_CREAT�O_TRUNCr)r��fdrererfr7scCs,t|���}dd�|D�}d�|�}d|S)z%Like repr(dict), but in sorted order.cSsg|]}d|�qS)z%r: %rre)�.0Zpairrererf�
<listcomp>?szsortdict.<locals>.<listcomp>z, z{%s})�sortedr�r�)�dictr�Z	reprpairsZ
withcommasrererfrY<s
cCs*ttd�}z|��S|��tt�XdS)z`
    Create an invalid file descriptor by opening and closing a file and return
    its fd.
    �wbN)r.r�filenorr)r�rererf�make_bad_fdCs

r9)�lineno�offsetc	Csp|�t��}t|dd�WdQRX|j}|�|j�|dk	rJ|�|j|�|�|j�|dk	rl|�|j|�dS)Nz
<test string>�exec)�assertRaises�SyntaxError�compileZ	exceptionZassertIsNotNoner:�assertEqualr;)�testcaseZ	statementr:r;�cmr�rererfr%Osc	sTddl}ddl}��dd��|j�|�d�d�d}tj�t	|�}���fdd�}tj�
|�r|||�}|dk	rt|St|�td�t
r�td	|t�d
�|j��}tr�|j�d�|j|dd
�}tr�|j�d�dkr�tj|d�}z@t|d��,}	|��}
x|
�r|	�|
�|��}
q�WWdQRXWd|��X||�}|dk	�rD|Std|��dS)Nr�checkr��/���cs>t|f����}�dkr|S�|�r2|�d�|S|��dS)Nr)r.�seekr)r-r�)r�rCr�rerf�check_valid_filecs
z*open_urlresource.<locals>.check_valid_fileZurlfetchz	fetching %s ...)r�)zAccept-Encoding�gzip�)r�zContent-EncodingrH)Zfileobjr7zinvalid resource %r)Zurllib.requestZurllib.parse�pop�parseZurlparser�r�r�r��
TEST_DATA_DIRr,rr!rr�rZrequestZbuild_openerrHZ
addheadersr�r.Zheaders�getZGzipFile�read�writerr
)Zurlr�r��urllibr�r-rGr��opener�out�sre)r�rCr�rfrGZs<	



c@s4eZdZdZdd�Zdd�Zedd��Zdd	�Zd
S)�WarningsRecorderzyConvenience wrapper for the warnings list returned on
       entry to the warnings.catch_warnings() context manager.
    cCs||_d|_dS)Nr)�	_warnings�_last)�selfZ
warnings_listrererf�__init__�szWarningsRecorder.__init__cCsDt|j�|jkr t|jd|�S|tjjkr0dStd||f��dS)NrEz%r has no attribute %r)r�rUrVr�rh�WarningMessage�_WARNING_DETAILSr�)rW�attrrererf�__getattr__�s
zWarningsRecorder.__getattr__cCs|j|jd�S)N)rUrV)rWrererfrh�szWarningsRecorder.warningscCst|j�|_dS)N)r�rUrV)rWrererf�reset�szWarningsRecorder.resetN)	rarbrcrdrXr\�propertyrhr]rerererfrT�s
rTc	cst�d�}|j�d�}|r"|��tjdd�� }tjd�d�t	|�VWdQRXt
|�}g}xv|D]n\}}d}	xH|dd�D]8}|j}
t�
|t|
�tj�r�t|
j|�r�d}	|�|�q�W|	sf|sf|�||jf�qfW|r�td	|d
��|�rtd|d
��dS)z�Catch the warnings, then check if all the expected
    warnings have been raised and re-raise unexpected warnings.
    If 'quiet' is True, only re-raise the unexpected warnings.
    r�Z__warningregistry__T)�recordrh�alwaysNFzunhandled warning %srz)filter (%r, %s) did not catch any warning)rp�	_getframe�	f_globalsrM�clearrhrir{�simplefilterrTr}�message�re�matchrv�I�
issubclassr��remover�rar
)�filtersr!�frame�registry�wZreraiseZmissingry�cat�seenZwarningrererf�_filterwarnings�s0
rqcOs.|�d�}|s$dtff}|dkr$d}t||�S)a�Context manager to silence warnings.

    Accept 2-tuples as positional arguments:
        ("message regexp", WarningCategory)

    Optional argument:
     - if 'quiet' is True, it does not fail if a filter catches nothing
        (default True without argument,
         default False if some filters are defined)

    Without argument, it defaults to:
        check_warnings(("", Warning), quiet=True)
    r!r�NT)rM�Warningrq)rkrr!rererfrP�s

c	csBtjdd�� }tjdtd�dVt�WdQRX|�|g�dS)a"Context manager to check that no ResourceWarning is emitted.

    Usage:

        with check_no_resource_warning(self):
            f = open(...)
            ...
            del f

    You must remove the object which may emit ResourceWarning before
    the end of the context manager.
    T)r_r`)�categoryN)rhrirj�ResourceWarning�
gc_collectr@)rAZwarnsrererfrQ�s
c@s(eZdZdZdd�Zdd�Zdd�ZdS)	ra,Context manager to force import to return a new module reference.

    This is useful for testing module-level behaviours, such as
    the emission of a DeprecationWarning on import.

    Use like this:

        with CleanImport("foo"):
            importlib.import_module("foo") # new reference
    cGsNtj��|_x<|D]4}|tjkrtj|}|j|kr>tj|j=tj|=qWdS)N)rpr{�copy�original_modulesra)rWZmodule_namesZmodule_namer�rererfrXs




zCleanImport.__init__cCs|S)Nre)rWrererf�	__enter__szCleanImport.__enter__cGstj�|j�dS)N)rpr{r�rw)rW�
ignore_excrererf�__exit__szCleanImport.__exit__N)rarbrcrdrXrxrzrerererfr�s

c@sheZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�ZdS)rRz_Class to help protect the environment variable properly.  Can be used as
    a context manager.cCstj|_i|_dS)N)r�r	�_environ�_changed)rWrererfrXszEnvironmentVarGuard.__init__cCs
|j|S)N)r{)rW�envvarrererf�__getitem__ szEnvironmentVarGuard.__getitem__cCs*||jkr|j�|�|j|<||j|<dS)N)r|r{rM)rWr}�valuerererf�__setitem__#s
zEnvironmentVarGuard.__setitem__cCs2||jkr|j�|�|j|<||jkr.|j|=dS)N)r|r{rM)rWr}rererf�__delitem__)s

zEnvironmentVarGuard.__delitem__cCs
|j��S)N)r{�keys)rWrererfr�0szEnvironmentVarGuard.keyscCs
t|j�S)N)�iterr{)rWrererf�__iter__3szEnvironmentVarGuard.__iter__cCs
t|j�S)N)r�r{)rWrererf�__len__6szEnvironmentVarGuard.__len__cCs|||<dS)Nre)rWr}rrererf�set9szEnvironmentVarGuard.setcCs
||=dS)Nre)rWr}rererf�unset<szEnvironmentVarGuard.unsetcCs|S)Nre)rWrererfrx?szEnvironmentVarGuard.__enter__cGsJx<|j��D].\}}|dkr0||jkr:|j|=q||j|<qW|jt_dS)N)r|r�r{r�r	)rWry�k�vrererfrzBs

zEnvironmentVarGuard.__exit__N)rarbrcrdrXr~r�r�r�r�r�r�r�rxrzrerererfrRsc@s(eZdZdZdd�Zdd�Zdd�ZdS)	�
DirsOnSysPatha�Context manager to temporarily add directories to sys.path.

    This makes a copy of sys.path, appends any directories given
    as positional arguments, then reverts sys.path to the copied
    settings when the context ends.

    Note that *all* sys.path modifications in the body of the
    context manager, including replacement of the object,
    will be reverted at the end of the block.
    cGs(tjdd�|_tj|_tj�|�dS)N)rpr��original_value�original_object�extend)rW�pathsrererfrXXszDirsOnSysPath.__init__cCs|S)Nre)rWrererfrx]szDirsOnSysPath.__enter__cGs|jt_|jtjdd�<dS)N)r�rpr�r�)rWryrererfrz`szDirsOnSysPath.__exit__N)rarbrcrdrXrxrzrerererfr�Ls
r�c@s*eZdZdZdd�Zdd�Zd	dd�ZdS)
r&z�Raise ResourceDenied if an exception is raised while the context manager
    is in effect that matches the specified exception and attributes.cKs||_||_dS)N)r��attrs)rWr�rrererfrXjszTransientResource.__init__cCs|S)Nre)rWrererfrxnszTransientResource.__enter__NcCsT|dk	rPt|j|�rPx:|j��D]$\}}t||�s4Pt||�|kr Pq Wtd��dS)z�If type_ is a subclass of self.exc and value has attributes matching
        self.attrs, raise ResourceDenied.  Otherwise let the exception
        propagate (if any).Nz%an optional resource is not available)rir�r�r�r�r�r)rWZtype_r�	tracebackr[Z
attr_valuerererfrzqs
zTransientResource.__exit__)NNN)rarbrcrdrXrxrzrerererfr&es)�errnocCsNtjg}ttd�r|�tj�ttd�r4|�tj�ttd�rJ|�tj�|S)zr
    Get the different socket error numbers ('errno') which can be received
    when a connection is refused.
    �ENETUNREACH�
EADDRNOTAVAIL�EHOSTUNREACH)r��ECONNREFUSEDr�r�r�r�r�)�errorsrererf�get_socket_conn_refused_errs�s


r��>@)r��errnosc	
#slddddddg}ddd	d
dg}td|��|�g��sRd
d�|D��dd�|D�����fdd�}t��}z�y|dk	r�t�|�dVWn�tjk
r�}z$tr�tj�	�j
dd��|�Wdd}~XYn�tk
�rV}zlx\|j
}t|�dk�rt
|dt��r|d}q�t|�dk�r6t
|dt��r6|d}q�Pq�W||��Wdd}~XYnXWdt�|�XdS)z�Return a context manager that raises ResourceDenied when various issues
    with the Internet connection manifest themselves as exceptions.)r��o)�
ECONNRESET�h)r��q)r��e)�	ETIMEDOUT�n)r��c)Z	EAI_AGAIN���)ZEAI_FAIL���)Z
EAI_NONAME���)Z
EAI_NODATA���)Z
WSANO_DATAi�*zResource %r is not availablecSsg|]\}}tt||��qSre)r�r�)r3rw�numrererfr4�sz&transient_internet.<locals>.<listcomp>cSsg|]\}}tt||��qSre)r�r)r3rwr�rererfr4�scs�t|dd�}t|tj�s�t|tj�r,|�ks�t|tjj�rRd|jkrPdks�nt|tjj	�r~d|j
ks�d|j
ks�d|j
ks�|�kr�ts�tj
��jdd��|�dS)	Nr�i�iW�ConnectionRefusedError�TimeoutError�EOFErrorr�
)r��
isinstancerr�ZgaierrorrP�errorZ	HTTPError�codeZURLErrorr�rrp�stderrrOr�)r��n)�captured_errnos�denied�
gai_errnosrerf�filter_error�s


z(transient_internet.<locals>.filter_errorNrr�rr�)rrZgetdefaulttimeoutZsetdefaulttimeout�nntplibZNNTPTemporaryErrorrrpr�rOr�r�r�r�)	Z
resource_namer�r�Zdefault_errnosZdefault_gai_errnosr�Zold_timeoutr��are)r�r�r�rfr*�sP



c
csFddl}tt|�}tt||���ztt|�VWdtt||�XdS)z�Return a context manager used by captured_stdout/stdin/stderr
    that temporarily replaces the sys stream *stream_name* with a StringIO.rN)�ior�rp�setattr�StringIO)Zstream_namer�Zorig_stdoutrererf�captured_output�s
r�cCstd�S)z�Capture the output of sys.stdout:

       with captured_stdout() as stdout:
           print("hello")
       self.assertEqual(stdout.getvalue(), "hello\n")
    r�)r�rerererfr�scCstd�S)z�Capture the output of sys.stderr:

       with captured_stderr() as stderr:
           print("hello", file=sys.stderr)
       self.assertEqual(stderr.getvalue(), "hello\n")
    r�)r�rerererfr�scCstd�S)a	Capture the input to sys.stdin:

       with captured_stdin() as stdin:
           stdin.write('hello\n')
           stdin.seek(0)
           # call test code that consumes from sys.stdin
           captured = input()
       self.assertEqual(captured, "hello")
    �stdin)r�rerererfrs
cCs*t��trt�d�t��t��dS)a�Force as many objects as possible to be collected.

    In non-CPython implementations of Python, this is needed because timely
    deallocation is not guaranteed by the garbage collector.  (Even in CPython
    this can be the case in case of reference cycles.)  This means that __del__
    methods may be called later than expected and weakrefs may remain alive for
    longer than expected.  This function tries its best to force all garbage
    objects to disappear.
    g�������?N)�gcZcollectr>r�r�rerererfrus


ruccs.t��}t��z
dVWd|r(t��XdS)N)r�Z	isenabled�disable�enable)Zhave_gcrererf�
disable_gc"s
r�cCs:t�d�pd}d}x|��D]}|�d�r|}qW|dkS)z,Find if Python was built with optimizations.Z	PY_CFLAGSr�z-O)r�z-O0z-Og)�	sysconfig�get_config_varr�rr)ZcflagsZ	final_optr�rererf�python_is_optimized-s
r�ZnPZ0nZgettotalrefcountZ2PZ0Pr�cCst�t|t�S)N)�struct�calcsize�_header�_align)�fmtrererf�calcobjsize>sr�cCst�t|t�S)N)r�r��_vheaderr�)r�rererf�calcvobjsizeAsr�i@icCspddl}t�|�}t|�tkr(|jt@sBt|�tkrLt|�jt@rL||j7}dt|�||f}|�|||�dS)Nrz&wrong size for %s: got %d, expected %d)	�	_testcapirp�	getsizeofr��	__flags__�_TPFLAGS_HEAPTYPE�_TPFLAGS_HAVE_GCZSIZEOF_PYGC_HEADr@)�test�o�sizer�r�ryrererf�check_sizeofHs

r�cs��fdd�}|S)Ncs$���fdd�}�j|_�j|_|S)Nc
s�y ddl}t|��}|�|�}Wn(tk
r6�YnBd}}Yn0Xx,�D]$}y|�||�PWqPYqPXqPWz
�||�S|r�|r�|�||�XdS)Nr)�localer��	setlocaler�)r��kwdsr�rsZorig_localeZloc)�catstrr��localesrerf�innerYs$



z1run_with_locale.<locals>.decorator.<locals>.inner)rard)r�r�)r�r�)r�rfr�Xsz"run_with_locale.<locals>.decoratorre)r�r�r�re)r�r�rfrSWscs�fdd�}|S)Ncs"��fdd�}�j|_�j|_|S)Nc	s�y
tj}Wntk
r(t�d��YnXdtjkr@tjd}nd}�tjd<|�z
�||�S|dkrrtjd=n
|tjd<t��XdS)Nztzset requiredZTZ)r��tzsetr�rtrur�r	)r�r�r�Zorig_tz)r��tzrerfr�}s





z-run_with_tz.<locals>.decorator.<locals>.inner)rard)r�r�)r�)r�rfr�|szrun_with_tz.<locals>.decoratorre)r�r�re)r�rfrZ{siir�cCs�dttdtd�}t�d|tjtjB�}|dkr>td|f��tt|�	d��||�	d��
��}|a|tkrrt}|t
dkr�td|f��|adS)Ni)r��m�g�tz(\d+(\.\d+)?) (K|M|G|T)b?$zInvalid memory limit %rrrz$Memory limit %r too low to be useful)�_1M�_1Grfrg�
IGNORECASE�VERBOSEr�r��float�group�lower�real_max_memuse�MAX_Py_ssize_t�_2Gr)�limitZsizesr�ZmemlimitrererfrW�s$c@s(eZdZdZdd�Zdd�Zdd�ZdS)	�_MemoryWatchdogz`An object which periodically watches the process' memory consumption
    and prints it out.
    cCsdjt��d�|_d|_dS)Nz/proc/{pid}/statm)r"F)r�r�r �procfile�started)rWrererfrX�sz_MemoryWatchdog.__init__c
Cs�yt|jd�}Wn>tk
rN}z t�d�|�t�tj�	�dSd}~XYnXt
d�}tjtj
|g|tjd�|_|��d|_dS)N�rz!/proc not available for stats: {}zmemory_watchdog.py)r�r�T)r.r�r�rhr�r�r�rpr��flushr�
subprocess�Popen�
executableZDEVNULL�mem_watchdogrr�)rWr�r�Zwatchdog_scriptrererf�start�s
z_MemoryWatchdog.startcCs|jr|j��|j��dS)N)r�r�Z	terminate�wait)rWrererf�stop�s
z_MemoryWatchdog.stopN)rarbrcrdrXr�r�rerererfr��sr�cs���fdd�}|S)atDecorator for bigmem tests.

    'size' is a requested size for the test (in arbitrary, test-interpreted
    units.) 'memuse' is the number of bytes per unit for the test, or a good
    estimate of it. For example, a test that needs two byte buffers, of 4 GiB
    each, could be decorated with @bigmemtest(size=_4G, memuse=2).

    The 'size' argument is normally passed to the decorated test method as an
    extra argument. If 'dry_run' is true, the value passed to the test method
    may be less than the requested value. If 'dry_run' is false, it means the
    test doesn't support dummy runs when -M is not specified.
    cs ���fdd����_��_�S)Ncs��j}�j}tsd}n|}ts"�sDt||krDt�d||d��trztrzt�tdj||dd��t�}|�	�nd}z
�||�S|r�|�
�XdS)Niz'not enough memory: %.1fG minimum neededi@z* ... expected peak memory use: {peak:.1f}G)Zpeak)r��memuser�rtrurr�r�r�r�r�)rWr�r��maxsizeZwatchdog)�dry_runr�r�rerfr��s*

z.bigmemtest.<locals>.decorator.<locals>.wrapper)r�r�)r�)r�r�r�)r�r�rfr��szbigmemtest.<locals>.decoratorre)r�r�r�r�re)r�r�r�rfr2�s
!cs�fdd�}|S)z0Decorator for tests that fill the address space.csDttkr8tdkr$tdkr$t�d��q@t�dtd��n�|�SdS)Nl����lz-not enough memory: try a 32-bit build insteadz'not enough memory: %.1fG minimum neededi@)rr�rtru)rW)r�rerfr�
sz!bigaddrspacetest.<locals>.wrapperre)r�r�re)r�rfr3sc@seZdZdd�ZdS)r+cCst��}||�|S)N)rtZ
TestResult)rWr�r�rererf�runszBasicTestRunner.runN)rarbrcr�rerererfr+scCs|S)Nre)r�rererf�_id sr�cCs:|dkrt�st�tj�St|�r&tSt�d�|��SdS)Nr�zresource {0!r} is not enabled)r�rtr�r�r r�r�)r�rererf�requires_resource#s
r�cCstdd�|�S)z9
    Decorator for tests only applicable on CPython.
    T)�cpython)�impl_detail)r�rererfr4+scKsVtf|�rtS|dkrLt|�\}}|r,d}nd}t|���}|�d�|��}t�|�S)Nz*implementation detail not available on {0}z%implementation detail specific to {0}z or )	r@r��
_parse_guardsr5r�r�r�rtr�)ry�guardsZ
guardnames�defaultrererfr�1s
r�cCsH|sddidfSt|���d}t|���|gt|�ks>t�||fS)Nr�TFr)r}�valuesr�r
)r�Zis_truerererfr�>s
r�cKs t|�\}}|�t����|�S)a5This function returns True or False depending on the host platform.
       Examples:
          if check_impl_detail():               # only on CPython (default)
          if check_impl_detail(jython=True):    # only on Jython
          if check_impl_detail(cpython=False):  # everywhere except on CPython
    )r�rMrqZpython_implementationr�)r�r�rererfr@Hscs,ttd�s�St����fdd��}|SdS)zEDecorator to temporarily turn off tracing for the duration of a test.�gettracec	s.t��}zt�d��||�St�|�XdS)N)rpr�settrace)r�rZoriginal_trace)r�rerfr�Xs


zno_tracing.<locals>.wrapperN)r�rpr�r�)r�r�re)r�rf�
no_tracingSs
rcCstt|��S)aDecorator for tests which involve reference counting.

    To start, the decorator does not run the test if is not run by CPython.
    After that, any trace function is unset during the test to prevent
    unexpected refcounts caused by the trace function.

    )rr4)r�rererf�
refcount_testcsrcCsRg}xB|jD]8}t|tj�r2t||�|�|�q||�r|�|�qW||_dS)z>Recursively filter test cases in a suite based on a predicate.N)Z_testsr�rt�	TestSuite�
_filter_suiter�)�suiteZpredZnewtestsr�rererfrns
rcCs�ttjttdk	d�}|�|�}tdk	r4t�|���|jsD|j	sDt
�|��s�t|j
�dkrp|jsp|j
dd}n4t|j�dkr�|j
s�|jdd}nd}ts�|d7}t|��dS)z2Run tests from a unittest.TestSuite-derived class.N)�	verbosityZcapture_outputrrzmultiple errors occurredz!; run in verbose mode for details)rrpr�r�junit_xml_listr�r�Zget_xml_elementZtestsRunZskippedrZ
wasSuccessfulr�r�Zfailuresr
)rZrunnerr�r�rererf�
_run_suitezs"
r
cCstdkrdSt|���SdS)NT)�_match_test_func�id)r�rererf�
match_test�sr
cCsd|kot�d|�S)Nrzz[?*\[\]])rf�search)r�rererf�_is_full_match_test�srcs~|dkrd}|dkrd}d��|tkr4t|�\}�|tkrHt|�\}�t|�at|�a�dk	sh�dk	rz��fdd�}|adS)Nrecs*d}d}�r�|�}�r �|�}|o(|S)NTFre)�test_idZacceptrg)�accept_func�ignore_funcrerf�match_function�sz'set_match_tests.<locals>.match_function)�_accept_test_patterns�_compile_match_function�_ignore_test_patternsrsr)Zaccept_patternsZignore_patternsrre)rrrf�set_match_tests�s	rcs^|sd}d}nHttt|��r(t|�j}n.d�ttj|��}t�	|�j
��fdd�}|}||fS)Nre�|cs$�|�rdStt�|�d���SdS)NTrz)�anyr�r�)r)�regex_matchrerf�match_test_regex�sz1_compile_match_function.<locals>.match_test_regex)�allr�rr��__contains__r��fnmatch�	translaterfr?rg)Zpatternsr�Zregexrre)rrfr�srcGs�tjtjf}t��}xh|D]`}t|t�rT|tjkrJ|�t�tj|��qzt	d��qt||�rj|�|�q|�t�
|��qWt|t�t
|�dS)z1Run tests from unittest.TestCase-derived classes.z)str arguments must be keys in sys.modulesN)rtrZTestCaser�rvrpr{ZaddTestZ
findTestCasesr�Z	makeSuiterr
r
)�classesZvalid_typesr�clsrererfr,�s





cCsdS)z,Just used to check if docstrings are enabledNrererererf�_check_docstringssr"ZWITH_DOC_STRINGSztest requires docstringscCs`ddl}|dkrt}nd}|j|||d�\}}|rBtd||f��trXtd|j|f�||fS)aRun doctest on the given module.  Return (#failures, #tests).

    If optional argument verbosity is not specified (or is None), pass
    support's belief about verbosity on to doctest.  Else doctest's
    usual behavior is used (it searches sys.argv for -v).
    rN)r�optionflagsz%d of %d doctests failedz,doctest (%s) ... %d tests with zero failures)�doctestrZtestmodr
r�ra)r�rr#r$r�r�rererfr-scCstj��fS)N)rpr{rvrerererf�
modules_setup.sr%cCs:dd�tj��D�}tj��tj�|�tj�|�dS)NcSs"g|]\}}|�d�r||f�qS)z
encodings.)rr)r3r�r�rererfr45sz#modules_cleanup.<locals>.<listcomp>)rpr{r�rcr�)Z
oldmodulesZ	encodingsrererf�modules_cleanup1s
r&cCst��tj��fS)N)�_thread�_count�	threading�	_danglingrvrerererfrLTscGs�d}x�t|�D]�}t��tjf}||kr*P|s�da|d}td|d|d|dt|�ftj	d�x |D]}td|��tj	d�qlWtj	�
�d}d}t�d�t
�qWdS)	N�dTrzUWarning -- threading_cleanup() failed to cleanup %s threads (count: %s, dangling: %s)r)r�zDangling thread: g{�G�z�?)�ranger'r(r)r*�environment_alteredr�r�rpr�r�r�r�ru)Zoriginal_valuesZ
_MAX_COUNT�countrZdangling_threads�threadrererfrMWs&



cst����fdd��}|S)z�Use this function when threads are being used.  This will
    ensure that the threads are cleaned up even when the test fails.
    cst�}z�|�St|�XdS)N)rLrM)r��key)r�rerfr�zszreap_threads.<locals>.decorator)r�r�)r�r�re)r�rfrNvs�N@ccs�t��}z
dVWdt��}||}xjt��}||kr8Pt��|kr|t��|}d||�d|d�d|�d|�d�	}t|��t�d�t�q&WXdS)	aH
    bpo-31234: Context manager to wait until all threads created in the with
    statement exit.

    Use _thread.count() to check if threads exited. Indirectly, wait until
    threads exit the internal t_bootstrap() C function of the _thread module.

    threading_setup() and threading_cleanup() are designed to emit a warning
    if a test leaves running threads in the background. This context manager
    is designed to cleanup threads started by the _thread.start_new_thread()
    which doesn't allow to wait for thread exit, whereas thread.Thread has a
    join() method.
    Nz!wait_threads() failed to cleanup z threads after z.1fz seconds (count: z
, old count: �)g{�G�z�?)r'r(r��	monotonicr
r�ru)r�Z	old_countZ
start_timeZdeadliner.Zdtryrererf�wait_threads_exit�s
$
r4cCs,|�|�|��r(d|d�d�}t|��dS)zcJoin a thread. Raise an AssertionError if the thread is still alive
    after timeout seconds.
    zfailed to join the thread in z.1fz secondsN)r��is_aliver
)r/r�ryrererf�join_thread�s
r6cCspttd�rttd�sdSxRyt�dtj�\}}Wntk
rFPYnX|dkrRPtd|tjd�daqWdS)	z�Use this function at the end of test_main() whenever sub-processes
    are started.  This will help ensure that no extra children (zombies)
    stick around to hog resources and create problems when looking
    for refleaks.
    �waitpid�WNOHANGNrErz2Warning -- reap_children() reaped child process %s)r�T)	r�r�r7r8r�r�rpr�r-)r"ZstatusrererfrJ�s	ccs*t|�}g}zZy$x|D]}|��|�|�qWWn*trVtdt|�t|�f��YnXdVWdz�|rt|�t��}}xltdd�D]^}|d7}x$|D]}|�	t
|t��d��q�Wdd�|D�}|s�Ptr�tdt|�|f�q�WWdd	d�|D�}|�r"t�t
j�td
t|���XXdS)Nz/Can't start %d threads, only %d threads startedr��<g{�G�z�?cSsg|]}|��r|�qSre)r5)r3r�rererfr4�sz!start_threads.<locals>.<listcomp>z7Unable to join %d threads during a period of %d minutescSsg|]}|��r|�qSre)r5)r3r�rererfr4�szUnable to join %d threads)r}r�r�rr�r�r�r3r,r��max�faulthandlerZdump_tracebackrpr�r
)ZthreadsZunlockr�r�ZendtimeZ	starttimer�rererfrO�s>


c
csnt||�r<t||�}t|||�z
|VWdt|||�Xn.t|||�z
dVWdt||�rht||�XdS)a�Temporary swap out an attribute with a new object.

    Usage:
        with swap_attr(obj, "attr", 5):
            ...

        This will set obj.attr to 5 for the duration of the with: block,
        restoring the old value at the end of the block. If `attr` doesn't
        exist on `obj`, it will be created and then deleted at the end of the
        block.

        The old value (or None if it doesn't exist) will be assigned to the
        target of the "as" clause, if there is one.
    N)r�r�r��delattr)r�r[�new_val�real_valrererfrU�s




c	csX||kr0||}|||<z
|VWd|||<Xn$|||<z
dVWd||krR||=XdS)a�Temporary swap out an item with a new object.

    Usage:
        with swap_item(obj, "item", 5):
            ...

        This will set obj["item"] to 5 for the duration of the with: block,
        restoring the old value at the end of the block. If `item` doesn't
        exist on `obj`, it will be created and then deleted at the end of the
        block.

        The old value (or None if it doesn't exist) will be assigned to the
        target of the "as" clause, if there is one.
    Nre)r��itemr>r?rererfrT	s

cCst�dd|���}|S)z�Strip the stderr of a Python process from potential debug output
    emitted by the interpreter.

    This will typically be run on the result of the communicate() method
    of a subprocess.Popen object.
    s\[\d+ refs, \d+ blocks\]\r?\n?r�)rf�sub�strip)r�rererf�strip_python_stderr0	srCZ	getcountsz-types are immortal if COUNT_ALLOCS is definedcCst��S)znReturn a list of command-line arguments reproducing the current
    settings in sys.flags and sys.warnoptions.)r�Z_args_from_interpreter_flagsrerererf�args_from_interpreter_flags=	srDcCst��S)zgReturn a list of command-line arguments reproducing the current
    optimization settings in sys.flags.)r�Z"_optim_args_from_interpreter_flagsrerererf�!optim_args_from_interpreter_flagsB	srEc@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
rKcCstjj�|d�||_dS)Nr)�logging�handlers�BufferingHandlerrX�matcher)rWrIrererfrXL	szTestHandler.__init__cCsdS)NFre)rWrererf�shouldFlushU	szTestHandler.shouldFlushcCs|�|�|j�|j�dS)N)r�r�r��__dict__)rWr_rererf�emitX	s
zTestHandler.emitcKs.d}x$|jD]}|jj|f|�rd}PqW|S)zW
        Look for a saved dict whose keys/values match the supplied arguments.
        FT)r�rI�matches)rWrr��drererfrM\	szTestHandler.matchesN)rarbrcrXrJrLrMrerererfrKK	s	c@s eZdZdZdd�Zdd�ZdS)rV)ryrecKs<d}x2|D]*}||}|�|�}|�|||�s
d}Pq
W|S)a.
        Try to match a single dict with the supplied arguments.

        Keys whose values are strings and which are in self._partial_matches
        will be checked for partial (i.e. substring) matches. You can extend
        this scheme to (for example) do regular expression matching, etc.
        TF)rM�match_value)rWrNrr�r�r��dvrererfrMk	s

zMatcher.matchescCsHt|�t|�krd}n.t|�tk	s,||jkr6||k}n|�|�dk}|S)zT
        Try to match a single stored value (dv) with a supplied value (v).
        Fr)r�rv�_partial_matches�find)rWr�rPr�r�rererfrO|	s
zMatcher.match_valueN)rarbrcrQrMrOrerererfrVg	sc
CsZtdk	rtStd}yt�t|�d}Wntttfk
rFd}YnXt�|�|a|S)NrTF)�_can_symlinkrr��symlinkr��NotImplementedErrorr�rj)Zsymlink_path�canrererfr�	s

cCs t�}d}|r|St�|�|�S)z8Skip decorator for tests that require functional symlinkz*Requires functional symlink implementation)rrtr�)r��okryrererfr.�	sc	Cs�tdk	rtSttd�sd}n�t��}tj|d�\}}z�ttd���}y`t�|dd�t�|dd�t�|�	�dd�t
��}t�
d	|�}|dkp�t|�d
��dk}Wntk
r�d}YnXWdQRXWdtt�t|�t|�X|a|S)N�setxattrF)�dirr7s	user.testr�strusted.foos42z
2.6.(\d{1,2})r�')�
_can_xattrr�r�rrZmkstempr.rrXr8rqr�rfrgr�r�r�rr�)rVZtmp_dirZtmp_fpZtmp_name�fpZkernel_versionr�rererf�	can_xattr�	s,

r]cCs t�}d}|r|St�|�|�S)zDSkip decorator for tests that require functional extended attributesz(no non-broken extended attribute support)r]rtr�)r�rWryrererfr7�	scCs�ttd�st�d�|�Stdkr�td}t�tj��P}z>y|�|�daWn&tk
rp}z|aWdd}~XYnXWdt	|�XWdQRXtr�dt}t�|�|�S|SdS)zCDecorator for tests requiring a functional bind() for unix sockets.rzNo UNIX SocketsNZcan_bind_unix_socketFz%Requires a functional unix bind(): %s)
r�rrtr��_bind_nix_socket_errorrrr
r�r)r�r�rr�ryrererfr=�	s

c	Cs^tj|d��H}|j}|��}||kr,|��}ytj�||�Stk
rNdSXWdQRXdS)zKDetects if the file system for the specified directory is case-insensitive.)rYFN)	rZNamedTemporaryFilerw�upperr�r�r��samefiler�)Z	directory�base�	base_pathZ	case_pathrererfr�	s)rgcCs>tt|��tt|��}|r(|t|�8}tdd�|D��}|S)aReturns the set of items in ref_api not in other_api, except for a
    defined list of items to be ignored in this check.

    By default this skips private attributes beginning with '_' but
    includes all magic methods, i.e. those starting and ending in '__'.
    css&|]}|�d�r|�d�r|VqdS)�_�__N)rr�endswith)r3r�rererf�	<genexpr>�	sz&detect_api_mismatch.<locals>.<genexpr>)r�rY)Zref_apiZ	other_apirgZ
missing_itemsrererfr;�	s
cCs�|dkr|jf}nt|t�r"|f}t|�}x^t|�D]R}|�d�s4||krLq4t||�}t|dd�|ks|t|d�s4t|tj	�s4|�
|�q4W|�|j|�dS)aAssert that the __all__ variable of 'module' contains all public names.

    The module's public names (its API) are detected automatically based on
    whether they match the public name convention and were defined in
    'module'.

    The 'name_of_module' argument can specify (as a string or tuple thereof)
    what module(s) an API could be defined in in order to be detected as a
    public API. One case for this is when 'module' imports part of its public
    API from other modules, possibly a C backend (like 'csv' and its '_csv').

    The 'extra' argument can be a set of names that wouldn't otherwise be
    automatically detected as "public", like objects without a proper
    '__module__' attribute. If provided, it will be added to the
    automatically detected ones.

    The 'blacklist' argument can be a set of names that must not be treated
    as part of the public API even though their names indicate otherwise.

    Usage:
        import bar
        import foo
        import unittest
        from test import support

        class MiscTestCase(unittest.TestCase):
            def test__all__(self):
                support.check__all__(self, foo)

        class OtherTestCase(unittest.TestCase):
            def test__all__(self):
                extra = {'BAR_CONST', 'FOO_CONST'}
                blacklist = {'baz'}  # Undocumented name.
                # bar imports part of its API from _bar.
                support.check__all__(self, bar, ('bar', '_bar'),
                                     extra=extra, blacklist=blacklist)

    Nrcrb)
rar�rvr�rYrrr�r��types�
ModuleType�addZassertCountEqual�__all__)Z	test_caser�Zname_of_moduleZextraZ	blacklistZexpectedrwr�rererfr<�	s)



c@s(eZdZdZdZdZdd�Zdd�ZdS)rXz�Try to prevent a crash report from popping up.

    On Windows, don't display the Windows Error Reporting dialog.  On UNIX,
    disable the creation of coredump file.
    Nc
	Csrtj�d�r�ddl}|jj|_d}|j�|�|_|j�|j|B�yddl	}|j
Wnttfk
rlYnLXi|_
x�|j|j|jgD].}|�
||j�}|�||j�}||f|j
|<q�Wn�tdk	�r
y*t�tj�|_t�tjd|jdf�Wnttfk
�rYnXtjdk�rnddd	d
g}tj|tjtjd�}|�|��d}	WdQRX|	��dk�rntd
ddd�|S)z�On Windows, disable Windows Error Reporting dialogs using
        SetErrorMode.

        On UNIX, try to save the previous core file size limit, then set
        soft limit to 0.
        r�rNr�rr�z/usr/bin/defaultsrNzcom.apple.CrashReporterZ
DialogType)r�r�s	developerz:this test triggers the Crash Reporter, that is intentionalr�T)�endr�) rprqrrr�r�r��_k32�SetErrorMode�	old_value�msvcrt�CrtSetReportModer�ro�	old_modes�CRT_WARN�	CRT_ERROR�
CRT_ASSERTZCRTDBG_MODE_FILE�CrtSetReportFileZCRTDBG_FILE_STDERRr�Z	getrlimit�RLIMIT_CORE�	setrlimitr�r�r�r��PIPEZcommunicaterBr�)
rWr�ZSEM_NOGPFAULTERRORBOXro�report_type�old_mode�old_file�cmd�procr�rererfrx;
sN




zSuppressCrashReport.__enter__c	Gs�|jdkrdStj�d�rl|j�|j�|jr�ddl}xj|j��D]$\}\}}|�	||�|�
||�qBWn6tdk	r�yt�tj
|j�Wnttfk
r�YnXdS)zARestore Windows ErrorMode or core file behavior to initial value.Nr�r)rnrprqrrrlrmrqror�rprur�rwrvr�r�)rWryroryrzr{rererfrz|
s
zSuppressCrashReport.__exit__)rarbrcrdrnrqrxrzrerererfrX2
s
Ac	srt���d�y�j��Wn$ttfk
r@t��d��YnXd�����fdd�}|�|�t��|�dS)z�Override 'object_to_patch'.'attr_name' with 'new_value'.

    Also, add a cleanup procedure to 'test_instance' to restore
    'object_to_patch' value for 'attr_name'.
    The 'attr_name' should be a valid attribute for 'object_to_patch'.

    FNTcs �rt����n
t���dS)N)r�r=re)�
attr_is_local�	attr_name�object_to_patchrnrerf�cleanup�
szpatch.<locals>.cleanup)r�rKr�r�Z
addCleanupr�)Z
test_instancer�rZ	new_valuer�re)r~rr�rnrf�patch�
s


r�cCsFyddl}Wntk
r YnX|��r4t�d��ddl}|�|�S)zi
    Run code in a subinterpreter. Raise unittest.SkipTest if the tracemalloc
    module is enabled.
    rNzUrun_in_subinterp() cannot be used if tracemalloc module is tracing memory allocations)�tracemallocro�
is_tracingrtrur��run_in_subinterp)r�r�r�rererfr��
s
r�csHG��fdd�d|�}d�|||���|�tt��t�|���dS)NcseZdZ��fdd�ZdS)z%check_free_after_iterating.<locals>.Acs*d�yt��Wntk
r$YnXdS)NT)�next�
StopIteration)rW)�done�itrerf�__del__�
s
z-check_free_after_iterating.<locals>.A.__del__N)rarbrcr�re)r�r�rerf�A�
sr�F)r=r�r�ruZ
assertTrue)r�r�r!r�r�re)r�r�rf�check_free_after_iterating�
s	r�cCs�ddlm}m}m}|��}|�|�xd|jD]Z}|r@||kr@q.t||�}|rd|dk	sntd|��n
|dkrnq.|�	|d�dkr.|dSq.WdS)a<Check if the compiler components used to build the interpreter exist.

    Check for the existence of the compiler executables whose names are listed
    in 'cmd_names' or all the compiler executables when 'cmd_names' is empty
    and return the first missing executable or None when none is found
    missing.

    r)�	ccompilerr��spawnNz%the '%s' executable is not configured)
Z	distutilsr�r�r�Znew_compilerZcustomize_compilerZexecutablesr�r
Zfind_executable)Z	cmd_namesr�r�r�Zcompilerrwr|rererfr\�
s	


cCs@d}tr6||kr6tdkr.t�ddg���dkatr6|}t�|�S)Ng�h㈵��>Zgetpropzro.kernel.qemu�1)r?�_is_android_emulatorr�Zcheck_outputrBrprB)ZintervalZminimum_intervalrererfrB�
sc
cs>tj��}t��}zt��dVWd|r8tj|dd�XdS)NT)r�Zall_threads)rpr�r8r<�
is_enabledr�r�)r2r�rererf�disable_faulthandlers

r�c	Cs�tj�d�r8yt�d�}t|�dStk
r6YnXd}ttd�rjyt�d�}Wnt	k
rhYnXd}tjdkr�yd	dl
}|jWntt
fk
r�Yn0Xi}x(|j|j|jfD]}|�|d	�||<q�Wzpd	}xft|�D]Z}yt�|�}Wn4t	k
�r(}z|jtjk�r�Wdd}~XYq�Xt�|�|d7}q�WWd|dk	�rzx*|j|j|jfD]}|�|||��q`WX|S)
z/Count the number of open file descriptors.
    )ZlinuxZfreebsdz
/proc/self/fdr��sysconf�SC_OPEN_MAXNrr)rprqrrr�r�r�r�r�r�r�rorpr�rorrrsrtr,�dupr�ZEBADFr)	�namesZMAXFDrqroryr.r2Zfd2r�rererfr]sP





c@s(eZdZdZdd�Zdd�Zdd�ZdS)	�SaveSignalsz�
    Save an restore signal handlers.

    This class is only able to save/restore signal handlers registered
    by the Python signal module: see bpo-13285 for "external" signal
    handlers.
    c	Csjddl}||_ttd|j��|_x>dD]6}yt||�}Wntk
rNw&YnX|j�|�q&Wi|_dS)Nrr)�SIGKILL�SIGSTOP)	�signalr}r,�NSIG�signalsr�r�rjrG)rWr�Zsigname�signumrererfrXVs
zSaveSignals.__init__cCs4x.|jD]$}|j�|�}|dkr"q||j|<qWdS)N)r�r��	getsignalrG)rWr��handlerrererf�savecs
zSaveSignals.savecCs*x$|j��D]\}}|j�||�qWdS)N)rGr�r�)rWr�r�rererf�restoreoszSaveSignals.restoreN)rarbrcrdrXr�r�rerererfr�Ms
r�cCsddl}|jS)Nr)r�Z
WITH_PYMALLOC)r�rererf�
with_pymalloctsr�c@s(eZdZdZdd�Zdd�Zdd�ZdS)	�FakePathz.Simple implementing of the path protocol.
    cCs
||_dS)N)r�)rWr�rererfrX|szFakePath.__init__cCsd|j�d�S)Nz
<FakePath �>)r�)rWrererf�__repr__szFakePath.__repr__cCs6t|jt�s$t|jt�r,t|jt�r,|j�n|jSdS)N)r�r��
BaseExceptionr�ri)rWrererf�
__fspath__�s
zFakePath.__fspath__N)rarbrcrdrXr�r�rerererfr�ysr�c@s eZdZdZdd�Zdd�ZdS)�
_ALWAYS_EQz+
    Object that is equal to anything.
    cCsdS)NTre)rW�otherrererf�__eq__�sz_ALWAYS_EQ.__eq__cCsdS)NFre)rWr�rererf�__ne__�sz_ALWAYS_EQ.__ne__N)rarbrcrdr�r�rerererfr��sr�c@s eZdZdZdd�Zdd�ZdS)�_LARGESTz?
    Object that is greater than anything (except itself).
    cCs
t|t�S)N)r�r�)rWr�rererfr��sz_LARGEST.__eq__cCsdS)NFre)rWr�rererf�__lt__�sz_LARGEST.__lt__N)rarbrcrdr�r�rerererfr��sr�c@s eZdZdZdd�Zdd�ZdS)�	_SMALLESTz<
    Object that is less than anything (except itself).
    cCs
t|t�S)N)r�r�)rWr�rererfr��sz_SMALLEST.__eq__cCsdS)NFre)rWr�rererf�__gt__�sz_SMALLEST.__gt__N)rarbrcrdr�r�rerererfr��sr�c	cs.t��}zt�|�dVWdt�|�XdS)z>Temporarily change the integer string conversion length limit.N)rp�get_int_max_str_digits�set_int_max_str_digits)Z
max_digitsZcurrentrererf�adjust_int_max_str_digits�s


r�)T)F)rereF)F)N)NF)F)r'F)N)F)T)N)NN)Nr)r1)r�)N)Nrere)re(rdraroZcollections.abc�collections�
contextlibZdatetimer�r<rr�r�rn�importlib.utilr�Zlogging.handlersrFr�r�rqrfr�rr�r�r�rpr�rr'r)r�rgrtZurllib.errorrPrhZ
testresultrZmultiprocessing.processZmultiprocessing�zlibrH�bz2Zlzmar�rjr�r	r
rrur�contextmanagerrlr
r�r�r9r:rr5rrrr�r	rr�rrrr�rrr�r�r�r�r�rr�rr�rr�r r!r�r"r#r$rCZHOSTv4rrrrErFrHrrDrrZ
SOCK_MAX_SIZEZ
skipUnlessr��
__getformat__r6r8r/r0r1r>r�r?rArwrr�r Z
TEST_HTTP_URLZFS_NONASCII�	character�fsdecode�fsencode�UnicodeErrorZTESTFN_UNICODEZunicodedata�	normalize�getfilesystemencodingZTESTFN_ENCODINGZTESTFN_UNENCODABLEZgetwindowsversion�encode�UnicodeEncodeErrorr��decode�UnicodeDecodeErrorZTESTFN_UNDECODABLEZTESTFN_NONASCIIr$rr[r#r&rrIr�r�r�r�ZTEST_SUPPORT_DIRr+r�rLrrrYr9r%rG�objectrTrqrPrQr�abc�MutableMappingrRr�r&r�r�r'r�r(r)r�r*r�rrrrur�r�r�r�r�r�r�r�r�r�rSrZr�r�r�Z_4Gr�r�rWr�r2r3r+r�r�r4r�r�r@rrrr
rrrr
rrrr,r"r�ZMISSING_C_DOCSTRINGSZHAVE_DOCSTRINGSZrequires_docstringsr-r%r&r-rLrMrNr4r6rJrOrUrTrCr�Zrequires_type_collectingrDrErGrHrKrVrSrr.r[r]r7r^r=rr;r<rXr�r�r�r\r�rBr�r]r�r�r�r�r^�total_orderingr�r_r�r`r�rerererf�<module>s�










2	
!

J			>&	
&2' 5M		

$#


0





!




"

#
	"


:_";'	






Hacked By AnonymousFox1.0, Coded By AnonymousFox