
    tni                     4    d Z ddlZddlZ G d d          ZdS )z4Tests for runpod.serverless.__init__ module exports.    Nc                   B    e Zd ZdZd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
S )TestServerlessInitz.Test runpod.serverless module __all__ exports.c                     t          t          j        d          sJ t          t          j        j        t
                    sJ t          t          j        j                  dk    sJ dS )z+Test that __all__ is defined in the module.__all__r   N)hasattrrunpod
serverless
isinstancer   listlenselfs    \/var/www/html/gpu-tools/venv/lib/python3.11/site-packages/tests/test_serverless/test_init.pytest_all_definedz#TestServerlessInit.test_all_defined
   s\    v()44444&+3T:::::6$,--111111    c                 ~    t           j        j        D ]*}t          t           j        |          sJ d| d            +dS )z9Test that all symbols in __all__ are actually importable.zSymbol 'z$' in __all__ but not found in moduleN)r   r	   r   r   )r   symbols     r   test_all_symbols_importablez.TestServerlessInit.test_all_symbols_importable   sU    '/ 	o 	oF6,f55nn7n&7n7n7nnnnn	o 	or   c                 v    h d}t          t          j        j                  }||k    sJ d| d|             dS )z1Test that expected public symbols are in __all__.>   startrunpod_versionprogress_update	Expected , got Nsetr   r	   r   )r   expected_symbolsactual_symbolss      r   test_expected_public_symbolsz/TestServerlessInit.test_expected_public_symbols   s[    
 
 

 V.677>1113g?O3g3gWe3g3g11111r   c                     t          t          j        d          sJ t          t          j        j                  sJ t          j        t          j        j                  }d|j        v sJ dS )z4Test that start function is accessible and callable.r   configN)r   r   r	   callabler   inspect	signature
parameters)r   sigs     r   test_start_function_accessiblez1TestServerlessInit.test_start_function_accessible   sf    v('22222)/00000  1 7883>))))))r   c                 ~    t          t          j        d          sJ t          t          j        j                  sJ dS )z5Test that progress_update is accessible and callable.r   N)r   r   r	   r"   r   r   s    r   test_progress_update_accessiblez2TestServerlessInit.test_progress_update_accessible(   s<    v(*;<<<<<)9:::::::r   c                     t          t          j        d          sJ t          t          j        j        t
                    sJ dS )z'Test that runpod_version is accessible.r   N)r   r   r	   r
   r   strr   s    r   test_runpod_version_accessiblez1TestServerlessInit.test_runpod_version_accessible-   s>    v(*:;;;;;&+:C@@@@@@@r   c                 x    h d}t          t          j        j                  }|D ]}||vsJ d| d            dS )z-Test that private symbols are not in __all__.>   logparser_signal_handler_set_config_args_get_realtime_port_get_realtime_concurrencyzPrivate symbol 'z' should not be in __all__Nr   )r   private_symbolsall_symbolsprivate_symbols       r   !test_private_symbols_not_exportedz4TestServerlessInit.test_private_symbols_not_exported2   sm    
 
 
 &+344- 	t 	tN!4446s6s6s6s4444	t 	tr   c                    d t          t          j                  D             }h d}||z
  }t          t          j        j                  }|                    |          sJ d||z
               h d}||k    sJ d| d|             dS )z8Test that __all__ contains only the intended public API.c                 <    h | ]}|                     d           |S )_)
startswith).0names     r   	<setcomp>zETestServerlessInit.test_all_covers_public_api_only.<locals>.<setcomp>D   s8     4 4 4"ooc224 4 4 4r   >   osAnyr.   sysDictjsontimeutilsr/   signalworkermodulesargparse
rp_fastapiRunPodLoggerz%__all__ contains non-public symbols: >   r   r   r   r   r   N)dirr   r	   r   r   issubset)r   module_attrsexpected_private_attrspublic_attrsr5   expected_public_apis         r   test_all_covers_public_api_onlyz2TestServerlessInit.test_all_covers_public_api_onlyA   s    4 4V->)?)? 4 4 4"
 "
 "
 $&<<&+344 ##L11ww3w[fiu[u3w3wwww MLL11113g?R3g3gZe3g3g11111r   N)__name__
__module____qualname____doc__r   r   r   r'   r)   r,   r7   rR    r   r   r   r      s        882 2 2o o o
h h h* * *; ; ;
A A A
t t th h h h hr   r   )rV   r#   runpod.serverlessr   r   rW   r   r   <module>rY      sf    : :     Qh Qh Qh Qh Qh Qh Qh Qh Qh Qhr   