
    |h!
                     <    d dl Z d dlmZ d dlmZ d Zd Zd Zd Zy)    N)Path)TMPc                 .    | j                  dddd       y)z*Add custom command-line options to pytest.--slow
store_trueFzRun slow tests)actiondefaulthelpN)	addoption)parsers    M/var/www/html/test/engine/venv/lib/python3.12/site-packages/tests/conftest.pypytest_addoptionr   	   s    
XlEHXY    c                 v    | j                  d      s#|D cg c]  }d|j                  vs| c}|dd yyc c}w )aN  
    Modify the list of test items to exclude tests marked as slow if the --slow option is not specified.

    Args:
        config: The pytest configuration object that provides access to command-line options.
        items (list): The list of collected pytest item objects to be modified based on the presence of --slow option.
    r   slowN)	getoptionkeywords)configitemsitems      r   pytest_collection_modifyitemsr      s9     H%%*JTfDMM.IDJa &Js   66c                     ddl m}  |        t        j                  t        d       t	        j
                  dd       y)aO  
    Initialize session configurations for pytest.

    This function is automatically called by pytest after the 'Session' object has been created but before performing
    test collection. It sets the initial seeds and prepares the temporary directory for the test session.

    Args:
        session: The pytest session object.
    r   )
init_seedsTignore_errors)parentsexist_okN)ultralytics.utils.torch_utilsr   shutilrmtreer   mkdir)sessionr   s     r   pytest_sessionstartr#      s(     9L
MM#T*IIdT*r   c                    ddl m} dD cg c]  }|j                  |      D ]  }|  }}}g d|z   D ]  }t        |      j	                  d        dD cg c]  }|j                  |      D ]  }|  }}}|dz  t
        j                  d	   d
z  t
        g|z   D ]  }t        j                  |d        yc c}}w c c}}w )a  
    Cleanup operations after pytest session.

    This function is automatically called by pytest at the end of the entire test session. It removes certain files
    and directories used during testing.

    Args:
        terminalreporter: The terminal reporter object used for terminal output.
        exitstatus (int): The exit status of the test run.
        config: The pytest config object.
    r   )WEIGHTS_DIR>   *.onnx*.torchscript)zdecelera_portrait_min.movzbus.jpgzyolo11n.onnxzyolo11n.torchscriptT)
missing_ok>   *.mlpackage*_openvino_modelzpath with spaces   z.pytest_cacher   N)	ultralytics.utilsr%   rglobr   unlinkr   r   r   r    )	terminalreporter
exitstatusr   r%   xpathmodelsfile	directorys	            r   pytest_terminal_summaryr6   ,   s     . 8YqKDUDUVWDXYDdYdYFY_bhh +T
T*+ @aqKL]L]^_L`aDdadaFa!$66A8XZ]^agg 5	it45 Z
 bs   B<C)	r   pathlibr   testsr   r   r   r#   r6    r   r   <module>r:      s&      Z

K+"5r   