
    <|h9                     r    d Z ddlmZmZmZ d ZddZd ZddZd Z	d	 Z
dd
Zedk(  r e e              yy)z
Test environment setup.

This establishes the resources that are available for use,
which are tested with `support.is_resource_enabled`.

    )absolute_importdivisionprint_functionc                  P    	 ddl m}  t        |       dgz   S # t        $ r d} Y w xY w)z&Return a fresh list of resource names.r   ALL_RESOURCES)audiocurses	largefilenetworkbsddbdecimalcpu
subprocessurlfetchguixpicklegevent_monkey)test.libregrtestr   ImportErrorlistr   s    W/var/www/html/test/engine/venv/lib/python3.12/site-packages/gevent/testing/resources.pyget_ALL_RESOURCESr   #   s>    
2, "  +  


s    %%Nc                 H   | dd l }|j                  j                  d      } t               }| s|S | j	                  d      }|D ]\  }|s|dk(  rt               }|dk(  rg }|j                  d      r|dd  |v s7|j                  |dd         L|j                  |       ^ |S )Nr   GEVENTTEST_USE_RESOURCES,allnone-   )osenvirongetr   split
startswithremoveappend)resource_strr!   	resourcesrequested_resourcesrequested_resources        r   parse_resourcesr,   G   s    : zz~~&@A!#I&,,S11 1 "&)+I6)I**3/!!"%2  !3AB!78 /01"     c                     t        t                     }t        |       }||k(  rd}|S | r(||z
  }dj                  t        d |D                    }|S d}|S )z}
    Given a list of enabled resources, produce the correct environment variable
    setting to enable (only) that list.
    r    c              3   &   K   | ]	  }d |z     yw)r   N ).0xs     r   	<genexpr>z$unparse_resources.<locals>.<genexpr>   s     EAaEs   r   )setr   joinsorted)r)   all_resourcesenabledresultexplicitly_disableds        r   unparse_resourcesr<      sl      )+,M)nG- M 
+g5E1DEEF M Mr-   c                 z    t        | t              s| t        |       } ddlm} t        |       |_        d|_        | S )z
    Call either with a list of resources or a resource string.

    If ``None`` is given, get the resource string from the environment.
    r    supportT)
isinstancestrr,   r/   r?   r   use_resourcesgevent_has_setup_resources)r)   r?   s     r   setup_resourcesrD      s:     )S!Y%6#I.	 OG)-G&r-   c                  >    ddl m}  | j                  s
t                | S )Nr    r>   )r/   r?   rC   rD   r>   s    r   ensure_setup_resourcesrF      s     --Nr-   c                     t               j                  |       s%t        d| d       ddl}|j	                  d       yy)z
    Call this in standalone test modules that can't use unittest.SkipTest.

    Exits with a status of 0 if the resource isn't enabled.
    z	Skipped: z not enabledr   N)rF   is_resource_enabledprintsysexit)resourcerJ   s     r   exit_without_resourcerM      s4     "#77A856 Br-   c                     d| }|s|}n|dz   |z   dz   }t               j                  |       sdd l}|j                  |      y )NzRequires resource z ()r   )rF   rH   unittestSkipTest)rL   reasonrequiresrP   s       r   skip_without_resourcerT      sP    )13H$)C/!#77A'' Br-   __main__)N)r/   )__doc__
__future__r   r   r   r   r,   r<   rD   rF   rM   rT   __name__rI   r1   r-   r   <module>rY      sR   , A @!H9v: 
	( z	/
 r-   