
    Df
                     ,   d Z ddlZddlZddlZddlmZmZ ddlmZm	Z	 ddl
mZmZmZmZ ddl
mZ ej        d             Zej        d	             Zej        d
             Zej        d             Zej        d             Zej        d             Zd ZdS )zPytest configuration module.

Contains fixtures, which are tightly bound to the Cheroot framework
itself, useless for end-users' app testing.
    N   IS_MACOS
IS_WINDOWS)Gateway
HTTPServer)native_serverthread_and_wsgi_serverthread_and_native_serverwsgi_serverget_server_clientc                  :    d} t           r| dz  } t          r| dz  } | S )z<Return a common HTTP request timeout for tests with queries.皙?r   
   r   )computed_timeouts    D/var/www/media/lib/python3.11/site-packages/cheroot/test/conftest.pyhttp_request_timeoutr      s6      A B    c                     | \  }}|S )z^Set up and tear down a Cheroot WSGI server instance.

    This exposes the server thread.
     )r
   server_thread_srvs      r   wsgi_server_threadr   %   s     1M4r   c                     | \  }}|S )z^Set up and tear down a Cheroot HTTP server instance.

    This exposes the server thread.
    r   )r   r   r   s      r   native_server_threadr   0   s     3M4r   c                      t          |           S )z.Create a test client out of given WSGI server.r   )r   s    r   wsgi_server_clientr   ;   s     [)))r   c                      t          |           S )z.Create a test client out of given HTTP server.r   )r	   s    r   native_server_clientr    B   s     ]+++r   c               #      K   d } t           |                       }t          |           |V  	 	 t          |          }||                                 &# t          $ r Y dS w xY w)z(Provision a server creator as a fixture.c               3   H   K   d V } | d S t          |           }|V  |V  d S )N)make_http_server	bind_addr
httpservers     r   	start_srvzhttp_server.<locals>.start_srvL   sE      EE	F%i00
r   TN)iternextstopStopIteration)r'   srv_creatorr&   s      r   http_serverr-   I   s         yy{{##K
	"k**J%!!!	"    s   'A 
A&%A&c                     t          | t                    }t          j        |j                                                   |j        st          j        d           |j        |S )z7Create and start an HTTP server bound to ``bind_addr``.)r%   gateway)targetr   )	r   r   	threadingThread
safe_startstartreadytimesleepr$   s     r   r#   r#   `   sn      J
 J122288::: 
3   r   )__doc__r1   r6   pytest_compatr   r   serverr   r   testingr	   r
   r   r   r   fixturer   r   r   r   r    r-   r#   r   r   r   <module>r>      sv          * * * * * * * * ( ( ( ( ( ( ( (            ( ' ' ' ' ' 
 
 
       * * *
 , , ,
   ,    r   