ְ߂4 d Z ddlZddlZddlZddlmZ ddlmZmZ ddlm Z n # e $ r dZ Y nw xY wej e ej e ej e e ej e ej d Z ej d d Z ej d d Z ej d d Z ej d d Z ej dd d Z ej d d ZdS )zA pytest plugin for using pyfakefs as a fixture When pyfakefs is installed, the "fs" fixture becomes available. :Usage: def my_fakefs_test(fs): fs.create_file('/var/data/xx1.txt') assert os.path.exists('/var/data/xx1.txt') N)capture)PatcherPause)pathlibc # K t | d rt | j }nt }| |j V | dS )zFake filesystem.paramNhasattrr r setUpfstearDownrequestpatchers h/builddir/build/BUILD/cloudlinux-venv-1.0.10/venv/lib/python3.11/site-packages/pyfakefs/pytest_plugin.pyr r sd w 7=)))MMOOO * class)scopec # K t | d rt | j }nt }| |j V | dS )z%Class-scoped fake filesystem fixture.r Nr r s r fs_classr - d w 7=)))MMOOO *r modulec # K t | d rt | j }nt }| |j V | dS )z&Module-scoped fake filesystem fixture.r Nr r s r fs_moduler 9 r r sessionc # K t | d rt | j }nt }| |j V | dS )z'Session-scoped fake filesystem fixture.r Nr r s r fs_sessionr E r r T)tryfirstc , t j dS )zCMake sure that the cache is cleared before the final test shutdown.N)r clear_fs_cache)r exitstatuss r pytest_sessionfinishr" Q s r )hookwrapperr c # > K t j duot j j }|rt t j nt j }|5 dV ddd n# 1 swxY w Y |r+| j dk r"t j dS dS dS )z7Make sure that patching is not active during reporting.Nteardown)r PATCHERis_patchingr contextlibnullcontextwhenpause)reportr+ context_mgrs r pytest_runtest_logreportr. W s O4'GGO,GE,1O%(((z7M7O7OK ** **s A##A'*A'c ^ t j t j d S d S )N)r r&