File: //opt/saltstack/salt/lib/python3.10/site-packages/cheroot/__pycache__/testing.cpython-310.pyc
o
�N�gL � @ s d Z ddlmZmZmZ eZddlmZ ddl Z ddl
Z
ddlZddlZddl
Z
ddlmZ ddlZddlmZ ddlZdZdZdZdZejjeefdd �ejjeefejjd
�iZdd� Ze
j d
d� �Z!e
j dd� �Z"G dd� d�Z#dd� Z$dd� Z%dd� Z&dS )zAPytest fixtures and other helpers for doing testing by end-users.� )�absolute_import�division�print_function)�closingN)�http_client)�webtestz0.0.0.0z::)� bind_addrZwsgi_app)r Zgatewayc c s� � t | �� }|�d�d }ttfD ]}z||f}| dd|i|��}W n ty, Y qw d|_tj|j d��
� |jsEt�
d� |jr=|V |�� dS )z/Set up and tear down a Cheroot server instance.r ���r )�targetg�������?N� )�config�copy�pop�ANY_INTERFACE_IPV6�ANY_INTERFACE_IPV4�OSErrorZshutdown_timeout� threading�ThreadZ
safe_start�start�ready�time�sleep�stop)Zserver_factoryZconfZ bind_port� interfaceZactual_bind_addrZ
httpserverr r �C/opt/saltstack/salt/lib/python3.10/site-packages/cheroot/testing.py�cheroot_server$ s, ��
��
�r c c � � t tjj�D ]} | V qdS )z4Set up and tear down a Cheroot WSGI server instance.N)r �cheroot�wsgi�Server�Zsrvr r r �wsgi_server@ � ��r! c c r )z4Set up and tear down a Cheroot HTTP server instance.N)r r �server�
HTTPServerr r r r �
native_serverG r"