
    i                         S SK r S SKrS SKrS SKrS SKJr  S SKr S rS rS r	S r
S r\R                  " SS	9S
 5       rSS\S\S\4S jjrS\S\S-  4S jrg)    N)Anyc                    0 [         l        [        U R                  SS5      (       aB  U R                  R                  (       a'  U R                  R                  [         R                  S'   [
        R                  " [        R                  S9  g )Nllama_inputsF)stream)	pytest_test_optionsgetattroptionr   loggingbasicConfigsysstdout)configs    d/var/www/html/ai-image-ml/venv/lib/python3.13/site-packages/executorch/backends/arm/test/conftest.pypytest_configurer      sU    Fv}}ne449S9S/5}}/I/I^,szz*    c                     g N )r   itemss     r   pytest_collection_modifyitemsr          r   c                 B   ^  U 4S jnU" SSSS9  U" SSSS9  U" SSS	S
9  g )Nc                  L   >  TR                   " U 0 UD6  g ! [         a     g f = fr   )	addoption	Exception)argskwargsparsers     r   try_addoption'pytest_addoption.<locals>.try_addoption$   s-    	d-f- 		s    
##z--arm_quantize_io
store_truezDeprecated.)actionhelpz--arm_run_corstoneFVPz--llama_inputs+z3List of two files. Firstly .pt file. Secondly .json)nargsr$   r   )r   r    s   ` r   pytest_addoptionr'   #   s5     %lO),]SBr   c                     g r   r   )sessions    r   pytest_sessionstartr*   3   r   r   c                     g r   r   )r)   
exitstatuss     r   pytest_sessionfinishr-   7   r   r   T)autousec                     SSK n [        R                  R                  SS5      nUS:X  a>  [        R
                  " 5         [        R                  " SS5      nU R                  U5        OX[        R                  U5      (       a3  [        U5      n[        R
                  " U5        U R                  U5        O[        S5      e[        SU S	3S	S
9  g)a  Control random numbers in Arm test suite. Default behavior is to use a
fixed seed (0), which ensures reproducible tests. Use the env variable
ARM_TEST_SEED to set a custom seed, or set it to RANDOM for random seed
behavior.

Examples:
As default use fixed seed (0) for reproducible tests
    pytest --config-file=/dev/null --verbose -s --color=yes  backends/arm/test/ops/test_avg_pool.py -k <TESTCASE>
Use a random seed for each test
    ARM_TEST_SEED=RANDOM pytest --config-file=/dev/null --verbose -s --color=yes  backends/arm/test/ops/test_avg_pool.py -k <TESTCASE>
Rerun with a specific seed
    ARM_TEST_SEED=3478246 pytest --config-file=/dev/null --verbose -s --color=yes  backends/arm/test/ops/test_avg_pool.py -k <TESTCASE>

r   NARM_TEST_SEED0RANDOMl    z@ARM_TEST_SEED env variable must be integers or the string RANDOMz ARM_TEST_SEED= )end)torchosenvirongetrandomseedrandintmanual_seedstrisdigitint	TypeErrorprint)r5   seed_envr:   s      r   set_random_seedrC   A   s      zz~~os3H8~~a+$	X		8}D$N
 	
 
OD6
#-r   r
   fail_if_not_enabledreturnc                     [        [        S5      (       a-  U [        R                  ;   a  [        R                  U    (       a  gU(       a  [        SU  S35      eg)zReturns whether an option is successfully enabled, i.e. if the flag was
given to pytest and the necessary requirements are available.

The optional parameter 'fail_if_not_enabled' makes the function raise a
RuntimeError instead of returning False.

r   TzRequired option 'z' for test is not enabledF)hasattrr   r   RuntimeError)r
   rD   s     r   is_option_enabledrI   g   sK     v''Ff6J6J,JvOcOcdjOk!26(:STUUr   c                 R    U [         R                  ;   a  [         R                  U    $ g)zwReturns the value of an pytest option if it is set, otherwise None.

Args:
    option (str): The option to check for.

N)r   r   )r
   s    r   
get_optionrK   y   s&     %%%##F++r   )F)r   r6   r9   r   typingr   r   r   r   r'   r*   r-   fixturerC   r=   boolrI   rK   r   r   r   <module>rO      s     	  
  +	 		 . .Jc   $	s 	sTz 	r   